-
Notifications
You must be signed in to change notification settings - Fork 16
273 lines (226 loc) · 8.14 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# SPDX-FileCopyrightText: 2015-2023 Alexey Rochev
#
# SPDX-License-Identifier: CC0-1.0
name: CI
on:
push:
branches: [master]
pull_request:
branches:
- master
- 'feature/**'
schedule:
- cron: '0 0 * * 0'
jobs:
build-rpm:
strategy:
fail-fast: false
matrix:
container-image: ['fedora:38', 'fedora:39', 'opensuse/tumbleweed:latest']
compiler: [gcc]
include:
- container-image: 'fedora:38'
compiler: clang
- container-image: 'fedora:39'
compiler: clang
runs-on: ubuntu-latest
container: ${{ matrix.container-image }}
steps:
- name: Add GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Set packages install command for dnf
if: startsWith(matrix.container-image, 'fedora')
run: echo 'INSTALL_PACKAGES=dnf -y --setopt=install_weak_deps=False install' >> "$GITHUB_ENV"
- name: Set packages install command for zypper
if: startsWith(matrix.container-image, 'opensuse')
run: echo 'INSTALL_PACKAGES=zypper --non-interactive in --no-recommends' >> "$GITHUB_ENV"
- name: Install Git and rpm-build
run: ${{env.INSTALL_PACKAGES}} git rpm-build
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set Fedora compiler RPM macro
id: fedora-compiler
if: startsWith(matrix.container-image, 'fedora')
run: echo "rpm-macro=--define 'toolchain ${{ matrix.compiler }}'" >> "$GITHUB_OUTPUT"
- name: Install build dependencies
run: |
readarray -t dependencies < <(rpmspec ${{steps.fedora-compiler.outputs.rpm-macro}} -q --srpm --qf '[%{REQUIRES}\n]' rpm/tremotesf.spec)
${{env.INSTALL_PACKAGES}} "${dependencies[@]}"
- name: Make source archive
run: |
# Git complains if we don't do that
git config --global --add safe.directory "$GITHUB_WORKSPACE"
sourcedir="$(rpmbuild --eval '%_sourcedir')"
mkdir -p "$sourcedir"
.github/workflows/make-source-archive.py --output-directory "$sourcedir" zstd
- name: Build RPM
run: rpmbuild ${{steps.fedora-compiler.outputs.rpm-macro}} -bb rpm/tremotesf.spec
build-deb:
strategy:
fail-fast: false
matrix:
container-image: ['debian:11', 'debian:12', 'ubuntu:22.04', 'ubuntu:23.10']
runs-on: ubuntu-latest
container: ${{ matrix.container-image }}
steps:
- name: Add GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Install dependencies needed to make source archive
run: |
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --assume-yes install ca-certificates git python3 cmake
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Make source archive
run: |
# Git complains if we don't do that
git config --global --add safe.directory "$GITHUB_WORKSPACE"
.github/workflows/make-source-archive.py --output-directory .. --debian gzip
- name: Check out Debian sources
uses: actions/checkout@v4
with:
repository: equeim/tremotesf-debian
path: tremotesf-debian
- name: Remove everything except debian/ directory
run: |
mv tremotesf-debian/debian debian
rm -rf tremotesf-debian
- name: Install build dependencies
run: |
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --assume-yes build-dep .
- name: Build DEB
run: |
dpkg-buildpackage
build-flatpak:
runs-on: ubuntu-latest
steps:
- name: Add GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Set up Flatpak
run: |
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --assume-yes install flatpak flatpak-builder elfutils
flatpak remote-add --user --if-not-exists flathub 'https://flathub.org/repo/flathub.flatpakrepo'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build Tremotesf
run: |
flatpak-builder --user --install-deps-from=flathub build-dir org.equeim.Tremotesf.json
build-windows-msvc:
strategy:
fail-fast: false
matrix:
toolchain:
- msvc
#- msvc-clang
uses: ./.github/workflows/build-windows-msvc.yml
with:
build-with-msvc-clang-toolchain: ${{ matrix.toolchain == 'msvc-clang' && 'true' || 'false' }}
build-windows-mingw:
runs-on: windows-latest
steps:
- name: Checkout Tremotesf
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout msys2-packages
uses: actions/checkout@v4
with:
repository: equeim/msys2-packages
path: msys2-packages
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: 'CLANG64'
update: 'true'
install: |
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-cppwinrt
mingw-w64-clang-x86_64-fmt
mingw-w64-clang-x86_64-openssl
mingw-w64-clang-x86_64-pkgconf
mingw-w64-clang-x86_64-qt6-base
mingw-w64-clang-x86_64-qt6-svg
mingw-w64-clang-x86_64-qt6-tools
mingw-w64-clang-x86_64-qt6-translations
mingw-w64-clang-x86_64-cxxopts
- name: Build KF6 dependencies
shell: msys2 {0}
run: |
cd "$GITHUB_WORKSPACE/msys2-packages/mingw-w64-extra-cmake-modules-qt6"
makepkg-mingw --cleanbuild --syncdeps --force --noconfirm --install
cd "$GITHUB_WORKSPACE/msys2-packages/mingw-w64-kwidgetsaddons-qt6"
makepkg-mingw --cleanbuild --syncdeps --force --noconfirm --install
- name: Generate C++/WinRT headers
shell: msys2 {0}
run: |
cppwinrt -input sdk -output /clang64/include
- name: Add GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build with LLVM MinGW toolchain
shell: msys2 {0}
run: |
set -e -o pipefail
echo '::group::Configuring CMake'
cmake -S . --preset base -D TREMOTESF_QT6=ON
echo '::endgroup'
echo '::group::Building Debug'
cmake --build --preset base-debug
echo '::endgroup'
echo '::group::Testing Debug'
ctest --preset base-debug
echo '::endgroup'
echo '::group::Building Release'
cmake --build --preset base-release
echo '::endgroup'
echo '::group::Testing Release'
ctest --preset base-release
echo '::endgroup'
build-macos:
strategy:
fail-fast: false
matrix:
architecture: ['arm64', 'x64']
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up vcpkg
uses: equeim/action-setup-vcpkg@v6
with:
vcpkg-root: ${{ github.workspace }}/vcpkg
save-cache: ${{ github.event_name != 'pull_request' }}
cache-key-tag: ${{ matrix.architecture }}
- name: Install host dependencies
run: |
brew install autoconf automake libtool pkg-config ninja
- name: Build Tremotesf for ${{ matrix.architecture }} architecture
id: build
uses: equeim/action-cmake-build@v10
with:
cmake-arguments: --preset macos-${{ matrix.architecture }}-vcpkg
test: ${{ matrix.architecture == 'x64' }}
- name: Archive vcpkg logs
uses: actions/upload-artifact@v3
if: always()
with:
name: macos-${{ matrix.architecture }}-vcpkg-logs
retention-days: ${{ github.event_name == 'push' && 7 || 3 }}
path: ${{ env.VCPKG_ROOT }}/buildtrees/*/*.log
reuse-lint:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Check REUSE compliance
run: |
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --assume-yes install pipx
pipx run reuse lint