-
Notifications
You must be signed in to change notification settings - Fork 37
623 lines (602 loc) · 24.7 KB
/
build.yml
File metadata and controls
623 lines (602 loc) · 24.7 KB
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
# SPDX-License-Identifier: CC0-1.0
name: Build swift
on:
push:
branches-ignore:
- stable/**
- nobuild/**
pull_request:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
do_vatsim_key: ${{ github.event_name == 'push' }}
do_symbols: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
do_doxygen: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
do_static_analysis: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
qt_version: 6.10.1
bitrock_version: qt-professional-25.10.1
bitrock_url: https://releases.installbuilder.com/installbuilder
installbuilder_hash_win: f92b1741c78b8f024473f55057b26107c8ed9cc1ca583eb9323d0023a8024e00
installbuilder_hash_linux: 3dff24cf94af17158cbcb16af41ecf0bb5060ba97d052597f15b987bd5e5b43a
installbuilder_hash_macos: bffa8b2663c6e9aaaa1ed7cdb41a874d34ff89f22adfab419e172915f8f4ce57
externals: swift-project/externals
externals_sha: e1f1743ba159e11b0c065ea8f1ae1a0e91e3bf39
use_externals: ${{ secrets.EXTERNALS_PAT != '' }}
jobs:
preBuild:
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version number
id: version
run: |
echo "value=$(python3 -u scripts/utils.py --version)" >>$GITHUB_OUTPUT
- name: Remove artifacts
uses: swift-project/delete-artifact@swift
with:
name: |
xswiftbus-thin-*
xswiftbus-fat-*
swiftsymbols-*
swiftinstaller-*
failOnError: false
warnIfNotFound: false
checks:
runs-on: ubuntu-22.04
needs: preBuild
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install gitlint
run: |
pip install gitlint==0.19.1
- name: Run gitlint
run: gitlint --commits d789f61044e63e1a00d8e9f1d4d49c8d9ffc42a9..HEAD
- name: Install REUSE
run: |
pip install reuse==4.0.3
- name: Run REUSE lint
run: reuse lint
- name: Run clang-format
run: |
scripts/run_clang_format.py
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c
- name: Run cppcheck
run: |
sudo apt-get -y install cppcheck
cppcheck --template=gcc --inline-suppr --std=c++17 --enable=style,unusedFunction \
-i src/plugins/weatherdata/gfs/g2clib -DCPPCHECK --force --suppressions-list=cppcheck.supp \
--library=qt.cfg --library=posix.cfg .
- name: Install Qt docs
if: ${{ env.do_doxygen == 'true' }}
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
no-qt-binaries: true
documentation: true
cache: true
- name: Run doxygen
if: ${{ env.do_doxygen == 'true' }}
working-directory: docs
run: |
sudo apt-get -y install doxygen graphviz
doxygen Doxyfile
env:
DOXY_SRC_ROOT: ..
DOXY_TAGFILES: ${{ runner.workspace }}/Qt/Docs/Qt-${{ env.qt_version }}
- name: Upload doxygen
if: ${{ env.do_doxygen == 'true' }}
uses: actions/upload-pages-artifact@v3
with:
path: docs/html/
- name: Check if clang-tidy analysis is required
id: check_need_clang_tidy
run: |
if python3 -u scripts/run_static_analysis.py --check-changed-files; then
echo "should_run_clang_tidy=false" >> $GITHUB_OUTPUT
else
echo "should_run_clang_tidy=true" >> $GITHUB_OUTPUT
fi
- name: Checkout repository
if: ${{ steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: 'true'
- name: Install Qt
if: ${{ steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
modules: 'qtmultimedia'
cache: true
- name: Install dependencies
if: ${{ steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
run: |
sudo apt-get -y install dbus-x11 libglu1-mesa-dev libpulse-dev libdbus-1-dev ninja-build
pip3 install requests conan
- name: Checkout externals
if: ${{ env.use_externals == 'true' && steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
uses: actions/checkout@v4
env:
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }}
with:
repository: ${{ env.externals }}
ref: ${{ env.externals_sha }}
token: ${{ env.EXTERNALS_PAT }}
path: 'third_party/externals'
- name: Install conan dependencies
if: ${{ steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
shell: bash
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
run: |
conan profile detect
conan remote disable conancenter
conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local
conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN"
conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_linux
- name: Run clang-tidy
if: ${{ steps.check_need_clang_tidy.outputs.should_run_clang_tidy == 'true' }}
shell: bash
run: |
mkdir build && pushd build
cmake .. --preset ci-build-linux-no-pch
popd
python3 scripts/run_static_analysis.py --clang-tidy --build-path build --changed-files-ci
buildLinux:
runs-on: ubuntu-22.04
needs: [preBuild, checks]
env:
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }}
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }}
BITROCK_BUILDER: ~/installbuilder/bin/builder
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
modules: 'qtmultimedia'
cache: true
- name: Cache InstallBuilder
id: cache-bitrock
uses: actions/cache@v4
with:
path: ~/installbuilder.run
key: installbuilder-${{ env.bitrock_version }}-linux-x64
- name: Download InstallBuilder
if: steps.cache-bitrock.outputs.cache-hit != 'true'
run: |
wget --retry-connrefused -t 10 -w 10 -T 60 -O ~/installbuilder.run ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-linux-x64-installer.run
echo "${{ env.installbuilder_hash_linux }} $HOME/installbuilder.run" | sha256sum -c -
- name: Install InstallBuilder
run: |
chmod 700 ~/installbuilder.run
~/installbuilder.run --mode unattended --prefix ~/installbuilder
cat >~/license.xml <<EOF
$BITROCK_LICENSE
EOF
env:
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }}
- name: Install dependencies
run: |
sudo apt-get -y install dbus-x11 libglu1-mesa-dev libpulse-dev libdbus-1-dev ninja-build
pip3 install requests conan
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Checkout externals
if: ${{ env.use_externals == 'true' }}
uses: actions/checkout@v4
env:
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }}
with:
repository: ${{ env.externals }}
ref: ${{ env.externals_sha }}
token: ${{ env.EXTERNALS_PAT }}
path: 'third_party/externals'
- name: Install conan dependencies
shell: bash
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
run: |
conan profile detect
conan remote disable conancenter
conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local
conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN"
conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_linux
- name: Start DBus session bus
run: |
dbus-launch --sh-syntax | tee session.sh
eval $(cat session.sh)
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >>$GITHUB_ENV
- name: Create Vatsim key file
if: ${{ env.do_vatsim_key == 'true' }}
run: |
cat >vatsim.json <<EOF
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } }
EOF
env:
VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c
- name: Build swift (without symbols)
if: ${{ env.do_symbols != 'true' }}
run: |
python3 -u scripts/build.py -w 64 -t gcc
- name: Build swift (with symbols)
if: ${{ env.do_symbols == 'true' }}
run: |
python3 -u scripts/build.py -w 64 -t gcc --upload-symbols
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols
uses: actions/upload-artifact@v4
if: ${{ env.do_symbols == 'true' }}
with:
name: swiftsymbols-linux-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus
uses: actions/upload-artifact@v4
with:
name: xswiftbus-thin-linux-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-*
buildWin64:
runs-on: windows-2022
needs: [preBuild, checks]
env:
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }}
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }}
BITROCK_BUILDER: "~/installbuilder/bin/builder-cli.exe"
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
modules: 'qtmultimedia'
arch: win64_msvc2022_64
cache: true
- name: Install Qt debug info
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
arch: win64_msvc2022_64
cache: true
modules: debug_info
extra: --archives qtbase
- name: Cache InstallBuilder
id: cache-bitrock
uses: actions/cache@v4
with:
path: C:\installbuilder.exe
key: installbuilder-${{ env.bitrock_version }}-windows-x64
- name: Download InstallBuilder
if: steps.cache-bitrock.outputs.cache-hit != 'true'
shell: C:\msys64\usr\bin\bash.exe -le {0}
run: |
wget --retry-connrefused -t 10 -w 10 -T 60 -O /c/installbuilder.exe ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-windows-x64-installer.exe
echo "${{ env.installbuilder_hash_win }} /c/installbuilder.exe" | sha256sum -c -
env:
MSYSTEM: MSYS2
- name: Install InstallBuilder
run: |
start -wait "C:\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder")
echo >$HOME\license.xml @"
$env:BITROCK_LICENSE
"@
env:
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }}
- name: Install dependencies
run: |
pip install requests PyInstaller conan
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Checkout externals
if: ${{ env.use_externals == 'true' }}
uses: actions/checkout@v4
env:
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }}
with:
repository: ${{ env.externals }}
ref: ${{ env.externals_sha }}
token: ${{ env.EXTERNALS_PAT }}
path: 'third_party/externals'
- name: Install conan dependencies
shell: bash
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
run: |
conan profile detect
conan remote disable conancenter
conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local
conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN"
conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_win
- name: Create Vatsim key file
if: ${{ env.do_vatsim_key == 'true' }}
run: |
echo >vatsim.json @"
{ "vatsim": { "id": "$env:VATSIM_ID", "key": "$env:VATSIM_KEY" } }
"@
env:
VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c
- name: Build swift (without symbols)
if: ${{ env.do_symbols != 'true' }}
shell: cmd
run: |
build_conan\\build\\RelWithDebInfo\\generators\\conanrun.bat && python -u scripts/build.py -w 64 -t msvc
- name: Build swift (with symbols)
if: ${{ env.do_symbols == 'true' }}
shell: cmd
run: |
build_conan\\build\\RelWithDebInfo\\generators\\conanrun.bat && python -u scripts/build.py -w 64 -t msvc --upload-symbols
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols
uses: actions/upload-artifact@v4
if: ${{ env.do_symbols == 'true' }}
with:
name: swiftsymbols-windows-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus
uses: actions/upload-artifact@v4
with:
name: xswiftbus-thin-windows-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-*
buildMacOS:
runs-on: macos-15
needs: [preBuild, checks]
env:
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }}
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }}
BITROCK_BUILDER: /Applications/installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.qt_version }}
modules: 'qtmultimedia'
cache: true
- name: Cache InstallBuilder
id: cache-bitrock
uses: actions/cache@v4
with:
path: ~/installbuilder.dmg
key: installbuilder-${{ env.bitrock_version }}-osx
- name: Download InstallBuilder
if: steps.cache-bitrock.outputs.cache-hit != 'true'
run: |
wget --retry-connrefused -t 10 -w 10 -T 60 -O $HOME/installbuilder.dmg ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-osx-installer.dmg
echo "${{ env.installbuilder_hash_macos }} $HOME/installbuilder.dmg" | sha256sum -c -
- name: Install InstallBuilder
run: |
hdiutil attach $HOME/installbuilder.dmg
cp -rf "/Volumes/InstallBuilder Qt/installbuilder-${{ env.bitrock_version }}-osx-installer.app" /Applications
hdiutil detach "/Volumes/InstallBuilder Qt"
sudo xattr -r -d com.apple.quarantine /Applications/installbuilder-${{ env.bitrock_version }}-osx-installer.app
sudo /Applications/installbuilder-${{ env.bitrock_version }}-osx-installer.app/Contents/MacOs/installbuilder.sh --mode unattended --prefix /Applications/installbuilder
cat >~/license.xml <<EOF
$BITROCK_LICENSE
EOF
env:
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }}
- name: Install dependencies
run: |
pip3 install requests conan
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Checkout externals
if: ${{ env.use_externals == 'true' }}
uses: actions/checkout@v4
env:
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }}
with:
repository: ${{ env.externals }}
ref: ${{ env.externals_sha }}
token: ${{ env.EXTERNALS_PAT }}
path: 'third_party/externals'
- name: Install conan dependencies
shell: bash
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
run: |
# Empty presets to avoid autogenerated config from Conan
echo "{\"version\": 6}" > CMakeUserPresets.json
conan profile detect
conan remote disable conancenter
conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local
conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN"
conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_mac
conan install . --output-folder=build_conan_arm --deployer=full_deploy -pr=ci/profile_mac_arm
# https://doc.qt.io/qt-6/macos-issues.html#d-bus-and-macos
conan install --requires=dbus/1.15.8 --output-folder build_conan_dbus_shared --deployer=full_deploy -o "dbus/*:shared=True" -o "dbus/*:message_bus=True" -pr=ci/profile_mac
- name: Create Vatsim key file
if: ${{ env.do_vatsim_key == 'true' }}
run: |
cat >vatsim.json <<EOF
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } }
EOF
env:
VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c
- name: Build swift (without symbols)
if: ${{ env.do_symbols != 'true' }}
run: |
python3 -u scripts/build.py -w 64 -t clang
- name: Build swift (with symbols)
if: ${{ env.do_symbols == 'true' }}
run: |
python3 -u scripts/build.py -w 64 -t clang --upload-symbols
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols
uses: actions/upload-artifact@v4
if: ${{ env.do_symbols == 'true' }}
with:
name: swiftsymbols-macos-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus
uses: actions/upload-artifact@v4
with:
name: xswiftbus-thin-macos-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-*
postBuild:
runs-on: ubuntu-22.04
needs: [preBuild, checks, buildLinux, buildWin64, buildMacOS]
steps:
- name: Download xswiftbus-thin
uses: actions/download-artifact@v4
with:
pattern: xswiftbus-thin-*
merge-multiple: true
- name: Repackage xswiftbus
run: |
unzip -o xswiftbus-windows-64-*.zip
unzip -o xswiftbus-linux-64-*.zip
unzip -o xswiftbus-macos-64-*.zip
zip -r -9 xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.zip xswiftbus
- name: Upload xswiftbus-fat
uses: actions/upload-artifact@v4
with:
name: xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}
path: xswiftbus-fat-allos-*
- name: Remove xswiftbus-thin artifacts
uses: swift-project/delete-artifact@swift
with:
name: xswiftbus-thin-*
release:
runs-on: ubuntu-22.04
needs: [preBuild, postBuild]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
outputs:
id: ${{ steps.create.outputs.release_id }}
permissions:
id-token: write
contents: write
pages: write
environment: github-pages
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Flatten directories
run: |
mv swiftinstaller-*/* .
mv xswiftbus-*/* .
mkdir swiftsymbols
mv swiftsymbols-*/* swiftsymbols
- name: Create release
uses: swift-project/github-release@2.0-connreset-retry
id: create
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ needs.preBuild.outputs.version }}
commitish: ${{ github.sha }}
body: Version ${{ needs.preBuild.outputs.version }}
draft: true
prerelease: true
gzip: folders
files: >
swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}.run
swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}.exe
swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}.dmg
xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.zip
swiftsymbols-allos-${{ needs.preBuild.outputs.version }}:swiftsymbols
- name: Publish doxygen
uses: actions/deploy-pages@v4
notify:
runs-on: ubuntu-22.04
needs: [preBuild, checks, buildLinux, buildWin64, buildMacOS, postBuild, release]
if: always()
steps:
- name: Install dependencies
run: |
sudo apt-get -y install jo jq
- name: Query GitHub annotations
uses: octokit/request-action@v2.x
id: checkruns
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: GET /repos/swift-project/pilotclient/commits/${{ github.sha }}/check-runs
- name: Prepare Discord build message
run: |
result=SKIPPED
${{ contains(needs.*.result, 'success') }} && result=SUCCESS
for run in $CHECK_RUNS; do
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/swift-project/pilotclient/check-runs/$run/annotations" \
| jq -e 'any(.[].annotation_level; . == "warning" or . == "error")' && result=WARNING
done
${{ contains(needs.*.result, 'cancelled') }} && result=CANCELLED
${{ contains(needs.*.result, 'failure') }} && result=FAILED
[[ $result = SKIPPED ]] && emoji=repeat
[[ $result = SUCCESS ]] && emoji=white_check_mark
[[ $result = WARNING ]] && emoji=warning
[[ $result = CANCELLED ]] && emoji=grey_question
[[ $result = FAILED ]] && emoji=x
echo "result=$result" >>$GITHUB_ENV
echo "emoji=$emoji" >>$GITHUB_ENV
env:
CHECK_RUNS: ${{ join(fromJson(steps.checkruns.outputs.data).check_runs.*.id, ' ') }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Discord release message
uses: octokit/request-action@v2.x
if: ${{ needs.release.result == 'success' }}
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: GET /repos/swift-project/pilotclient/releases/${{ needs.release.outputs.id }}
- name: Send Discord build message
run: |
cat >message <<EOF
> :${{ env.emoji }}: \`${{ github.ref }}\`
> **${{ env.result }}** (triggered by ${{ github.event_name }})
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
EOF
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
env:
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: Send Discord release message
if: ${{ needs.release.result == 'success' }}
run: |
cat >message <<EOF
> :package: Created draft release \`v${{ needs.preBuild.outputs.version }}\`
> <${{ fromJson(steps.release.outputs.data).html_url }}>
EOF
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
env:
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}