-
Notifications
You must be signed in to change notification settings - Fork 4
449 lines (442 loc) · 19 KB
/
build.yaml
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
name: Build and Test
on: [push, pull_request]
jobs:
linux0:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- { cc: clang, cxx: clang++, coverage: false }
- { cc: gcc, cxx: g++, coverage: true }
steps:
- uses: actions/checkout@v4
- name: Install Qt
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install lcov libfuse2 qtbase5-dev qtconnectivity5-dev qttools5-dev qttools5-dev-tools
- name: Install linuxdeploy
run: |
curl --create-dirs --location --output-dir /home/runner/.local/bin --remote-name-all \
'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' \
'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage' \
'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage'
chmod a+x /home/runner/.local/bin/linuxdeploy{,-plugin-{appimage,qt}}-x86_64.AppImage
- name: Build
env:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
PROJECT_BUILD_ID: ${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ matrix.env.coverage }} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP"
"$RUNNER_TEMP/src/cli/dokit" --version
- name: Test
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose
- name: Collate test coverage
if: matrix.env.coverage
run: cmake --build "$RUNNER_TEMP" --target coverage
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-linux-${{ matrix.env.cc }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/removeHtmlDates.sh
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- name: Report parallel coverage to Codacy
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l CPP -r "${{ runner.temp }}/coverage.info"
- name: Report parallel coverage to Coveralls
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: linux0-${{ matrix.env.cc }}
parallel: true
- name: Build AppImage
run: cmake --build "$RUNNER_TEMP" --target cli-appimage
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: |
${{ runner.temp }}/src/lib/libQtPokit.so
${{ runner.temp }}/src/cli/dokit
if-no-files-found: error
- name: Upload AppImage
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}.AppImage
path: ${{ runner.temp }}/dokit-${{ env.dokitVersion }}.AppImage
if-no-files-found: error
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
qt: [ '6.6.0' ]
env:
- { cc: clang, cxx: clang++, coverage: false }
- { cc: gcc, cxx: g++, coverage: true }
steps:
- uses: actions/checkout@v4
- name: Install Tools
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install clang lcov libfuse2
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
- name: Install linuxdeploy
run: |
curl --create-dirs --location --output-dir /home/runner/.local/bin --remote-name-all \
'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' \
'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage' \
'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage'
chmod a+x /home/runner/.local/bin/linuxdeploy{,-plugin-{appimage,qt}}-x86_64.AppImage
- name: Build
env:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
PROJECT_BUILD_ID: ${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ matrix.env.coverage }} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP"
"$RUNNER_TEMP/src/cli/dokit" --version
- name: Test
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose
- name: Collate test coverage
if: matrix.env.coverage
run: cmake --build "$RUNNER_TEMP" --target coverage
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-linux-${{ matrix.env.cc }}-${{ matrix.qt }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- name: Report parallel coverage to Codacy
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l CPP -r "${{ runner.temp }}/coverage.info"
- name: Report parallel coverage to Coveralls
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: linux-${{ matrix.env.cc }}-${{ matrix.qt }}
parallel: true
- name: Build AppImage
run: cmake --build "$RUNNER_TEMP" --target cli-appimage
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: |
${{ runner.temp }}/src/lib/libQtPokit.so
${{ runner.temp }}/src/cli/dokit
if-no-files-found: error
- name: Upload AppImage
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}.AppImage
path: ${{ runner.temp }}/dokit-${{ env.dokitVersion }}.AppImage
if-no-files-found: error
mac:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
qt: [ '6.6.0' ]
env:
- { cc: clang, cxx: clang++, coverage: false }
- { cc: gcc-12, cxx: g++-12, coverage: true }
exclude:
# Exclude Qt 5.10 with GCC on macOS. See https://bugreports.qt.io/browse/QTBUG-66585
- { qt: '5.10.1', env: { cc: gcc-12 } }
# Exclude Qt6 with GCC on macOS for now, as GCC (only) has lots of false compiler
# errors, that even if worked-around result in SIGBUS errors in unit tests. See
# https://bugreports.qt.io/browse/QTBUG-107050 (non-exhaustive).
- { qt: '6.2.4', env: { cc: gcc-12 } }
- { qt: '6.3.2', env: { cc: gcc-12 } }
- { qt: '6.4.3', env: { cc: gcc-12 } }
- { qt: '6.5.2', env: { cc: gcc-12 } }
- { qt: '6.6.0', env: { cc: gcc-12 } }
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: brew install lcov
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
- name: Build
env:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
CMAKE_OSX_ARCHITECTURES: ${{ startsWith(matrix.qt, '6') && 'arm64;' || '' }}x86_64
PROJECT_BUILD_ID: ${{ github.run_number }}.mac.${{ startsWith(matrix.qt, '6') && 'arm64-' || '' }}x86_64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release \
-D CODECOV_GCOV=${{ startsWith(matrix.env.cc, 'gcc') && '/usr/local/bin/gcov-12' || '/usr/bin/gcov'}} \
-D ENABLE_COVERAGE=${{ matrix.env.coverage }} \
-S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP" -- VERBOSE=1
find "$RUNNER_TEMP" -name 'Info.plist'
find "$RUNNER_TEMP" -name 'Info.plist' -execdir cat '{}' \;
"$RUNNER_TEMP/src/cli/dokit.app/Contents/MacOS/dokit" --version
- name: Test
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose
- name: Collate test coverage
if: matrix.env.coverage
run: cmake --build "$RUNNER_TEMP" --target coverage
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-mac-${{ matrix.env.cc }}-${{ matrix.qt }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- name: Report parallel coverage to Codacy
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l CPP -r "${{ runner.temp }}/coverage.info"
- name: Report parallel coverage to Coveralls
if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: mac-${{ matrix.env.cc }}-${{ matrix.qt }}
parallel: true
- name: Make app bundle
run: macdeployqt "$RUNNER_TEMP/src/cli/dokit.app" -dmg -verbose=2
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: ${{ runner.temp }}/src/cli/*.app
if-no-files-found: error
win:
runs-on: windows-latest
defaults: { run: { shell: cmd } }
strategy:
fail-fast: false
matrix:
qt: [ '6.6.0' ]
generator: [ 'MinGW Makefiles', 'NMake Makefiles' ]
arch: [ x86, x86-64, arm64 ]
exclude:
# Exclude arm64 builds for Qt's earlier than 6.2, since Qt only added (Windows) arm64
# 'Technology Preview' support in 6.2.
- { arch: arm64, qt: '5.9.9' }
- { arch: arm64, qt: '5.10.1' }
- { arch: arm64, qt: '5.11.3' }
- { arch: arm64, qt: '5.12.12' }
- { arch: arm64, qt: '5.13.2' }
- { arch: arm64, qt: '5.14.2' }
- { arch: arm64, qt: '5.15.2' }
# Exclude MinGW builds for arm64, since MinGW has no arm64 support.
- { arch: arm64, generator: 'MinGW Makefiles' }
# Exclude MinGW builds for x86 (32-bit), since the GitHub Actions Windows runners only
# includes MinGW-w64, and not MinGW (32-bit).
- { arch: x86, generator: 'MinGW Makefiles' }
# Exclude x86 (32-bit) builds for Qt 5.10.1 with MSVC, for QTBUG-67259.
# See https://bugreports.qt.io/browse/QTBUG-67259
- { arch: x86, qt: '5.10.1', generator: 'NMake Makefiles' }
# Exclude x86 (32-bit) builds for Qt 6.x, since the Qt online installer doesn't provide
# those binaries for Qt6.
- { arch: x86, qt: '6.2.4' }
- { arch: x86, qt: '6.3.2' }
- { arch: x86, qt: '6.4.3' }
- { arch: x86, qt: '6.5.2' }
- { arch: x86, qt: '6.6.0' }
# Exclude MinGW builds for x86-64 with Qt's earlier than 5.12, since the Qt online
# installer (as used by aqtinstaller) did not include x86-64 binaries until Qt 5.12.
- { arch: x86-64, qt: '5.9.9', generator: 'MinGW Makefiles' }
- { arch: x86-64, qt: '5.10.1', generator: 'MinGW Makefiles' }
- { arch: x86-64, qt: '5.11.3', generator: 'MinGW Makefiles' }
include: # Override default arch's for install-qt-action and msvc-dev-cmd.
- { generator: 'MinGW Makefiles', qt: '6.6.0', qtArch: win64_mingw }
- { generator: 'NMake Makefiles', arch: arm64, qtArch: win64_msvc2019_arm64 }
- { generator: 'NMake Makefiles', arch: arm64, msvcArch: amd64_arm64 }
- { generator: 'NMake Makefiles', arch: x86-64, msvcArch: amd64 }
# Define the toolchain and dll names per generator (for artifact naming mostly).
- { generator: 'NMake Makefiles', tool: msvc, dll: QtPokit.dll }
- { generator: 'MinGW Makefiles', tool: mingw, dll: libQtPokit.dll }
steps:
- uses: actions/checkout@v4
- name: Install host Qt for cross-compilation
if: matrix.arch == 'arm64'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
arch: win64_msvc2019_64
set-env: false
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
arch: ${{ matrix.qtArch }}
- name: Configure cross-compilation
if: matrix.arch == 'arm64'
shell: bash
run: |
echo "CMAKE_TOOLCHAIN_FILE=${Qt6_DIR/_64/_arm64/}\lib\cmake\Qt6\qt.toolchain.cmake" >> $GITHUB_ENV
echo "qtHostPath=${Qt6_DIR/_arm64/_64}" >> $GITHUB_ENV
- name: Configure MSVC
if: ${{ contains(matrix.generator, 'nmake') }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvcArch }}
- name: Build
env:
PROJECT_BUILD_ID: ${{ github.run_number }}.win.${{ matrix.arch }}.${{ matrix.tool }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D QT_HOST_PATH=%qtHostPath% -G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%"
cmake --build "%RUNNER_TEMP%"
- name: Install DLL for tests
run: |
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib
working-directory: ${{ runner.temp }}
- name: Test # We can't execute arm64 binaries on an x86-64 host.
if: matrix.arch != 'arm64'
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%" --verbose
- name: Upload test results
if: matrix.arch != 'arm64'
uses: actions/upload-artifact@v3
with:
name: test-results-win-${{ matrix.arch }}-${{ matrix.tool }}-${{ matrix.qt }}
path: ${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- name: Make portable
if: matrix.arch != 'arm64'
run: |
mkdir portable
copy /v /b src\lib\${{ matrix.dll }} /b portable
copy /v /b src\cli\dokit.exe /b portable
cd portable
windeployqt --compiler-runtime --release --verbose 2 dokit.exe ${{ matrix.dll }}
:: dokit.exe --version
working-directory: ${{ runner.temp }}
- name: Setup artifacts
shell: bash
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: |
${{ runner.temp }}/src/lib/${{ matrix.dll }}
${{ runner.temp }}/src/cli/dokit.exe
if-no-files-found: error
- name: Upload artifacts (portable)
if: matrix.arch != 'arm64'
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}.portable
path: ${{ runner.temp }}/portable
if-no-files-found: error
collate-test-results:
needs: [ linux0, linux, mac, win ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install lcov
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ${{ runner.temp }}/artifacts
- name: Generate test summary
uses: pcolby/tap-summary@v1
with:
path: ${{ runner.temp }}/artifacts/**/*.tap
- name: Generate HTML coverage report
run: |
shopt -s globstar
# Update source code paths from macOS tracefiles to match Linux.
sed -i -Ee 's|^SF:/Users|SF:/home|' artifacts/**/coverage.info
# Combine all tracefiles into one.
lcov $(find artifacts -name '*.info' -type f -printf '-a %p\n') -o coverage.info
# Generate the HTML report.
echo 'genhtml_sort = 0' >> ~/.lcovrc
genhtml --output-directory coverage coverage.info
/usr/bin/env bash ./artifacts/test-results-linux-gcc/removeHtmlDates.sh
working-directory: ${{ runner.temp }}
- name: Upload HTML coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: "${{ runner.temp }}/coverage"
if-no-files-found: error
- name: Report partial-finished to Codacy
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
- name: Report parallel-finished to Coveralls
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
update-tests-on-doc-branch:
runs-on: ubuntu-latest
needs: collate-test-results
steps:
- uses: actions/checkout@v4
with: { ref: doc }
- name: Clear previous coverage report
run: rm -rf main/cov
- name: Download HTML report
uses: actions/download-artifact@v3
with:
name: coverage-report
path: main/cov
- name: Remove build numbers from pre-releases
run: |
shopt -s globstar
sed -i -Ee 's/(headerValue">([0-9]+\.){2}[0-9]+-pre\+)[0-9]+\.?/\1/' main/cov/**/*.html
- name: Inspect changes # for diagnostics only.
run: git status && git diff
- run: false
- name: Push updates
run: |
[[ -z $(git status --porcelain) ]] || {
git config user.name github-actions
git config user.email [email protected]
git pull
git add .
git commit -m "Update coverage report for ${GITHUB_SHA}"
git push
}