-
-
Notifications
You must be signed in to change notification settings - Fork 111
1311 lines (1279 loc) · 50.6 KB
/
build.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
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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Build
on:
merge_group:
push:
paths-ignore:
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.yml'
- 'LICENSE.txt'
- 'mkdocs.yml'
- '*.md'
- '*.sh'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.yml'
- 'LICENSE.txt'
- 'mkdocs.yml'
- '*.md'
- '*.sh'
branches:
- master
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: 1
SCCACHE_GHA_ENABLED: "true"
jobs:
# {{{ Common checks
check_common:
name: "Check CI scripts"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Checking for common errors in build, deployment, and CI."
run: ./scripts/check-common.sh
check_PR_TODOs:
name: "Check PR-TODOs"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Checking for open PR-related TODO items"
run: ./scripts/check-pr-todos.sh
check_spelling:
name: Check spelling
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
actions: read
security-events: write
outputs:
followup: ${{ steps.spelling.outputs.followup }}
steps:
- uses: check-spelling/[email protected]
name: Check spelling
id: spellcheck
with:
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
checkout: true
check_file_names: 1
spell_check_this: contour-terminal/contour@master
post_comment: 0
use_magic_file: 1
report-timing: 1
warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end
check_extra_dictionaries: ""
dictionary_source_prefixes: >
{
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/"
}
extra_dictionaries: |
cspell:aws/aws.txt
cspell:cpp/compiler-clang-attributes.txt
cspell:cpp/compiler-msvc.txt
cspell:cpp/ecosystem.txt
cspell:cpp/lang-keywords.txt
cspell:cpp/stdlib-c.txt
cspell:cpp/stdlib-cmath.txt
cspell:cpp/stdlib-cpp.txt
cspell:csharp/csharp.txt
cspell:css/css.txt
cspell:dart/dart.txt
cspell:django/django.txt
cspell:dotnet/dotnet.txt
cspell:filetypes/filetypes.txt
cspell:fullstack/fullstack.txt
cspell:golang/go.txt
cspell:html/html.txt
cspell:java/java-terms.txt
cspell:java/java.txt
cspell:lorem-ipsum/dictionary.txt
cspell:mnemonics/mnemonics.txt
cspell:node/node.txt
cspell:npm/npm.txt
cspell:php/php.txt
cspell:powershell/powershell.txt
cspell:python/common/extra.txt
cspell:python/python/python-lib.txt
cspell:python/python/python.txt
cspell:r/r.txt
cspell:software-terms/softwareTerms.txt
cspell:typescript/typescript.txt
check_clang_format:
name: "Check C++ style"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install clang-format-18
- name: "Clang-format"
run: find ./src/ -name "*.cpp" -o -name "*.h" | xargs clang-format-18 --Werror --dry-run
- name: "Check includes"
run: ./scripts/check-includes.sh
check_clang_tidy:
name: "Check clang-tidy"
runs-on: ubuntu-24.04
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2404-clang-tidy"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set environment variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "install dependencies"
run: sudo env QTVER=6 ./scripts/install-deps.sh
- name: "Post-fix embedded dependency permissions."
run: sudo find _deps/sources -exec chown $UID {} \;
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
- name: "cmake"
run: |
cmake --preset linux-debug -B build -G Ninja \
-D CMAKE_CXX_COMPILER="clang++-18" \
-D ENABLE_TIDY=ON -D CLANG_TIDY_EXE=/usr/bin/clang-tidy-18
- name: "build"
run: cmake --build build
check_links:
name: "Check links"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run linksafe
uses: Yaraslaut/linksafe@main
with: # comma seperated lists
# use relative paths, if no dirs specified root dir is scanned
ignored_dirs: "_deps"
ignored_files: "./scripts/install-deps.sh,
./scripts/install-deps.ps1"
ignored_links: "https://www.contributor-covenant.org/faq,
https://www.contributor-covenant.org,
https://flatpak.org/getting.html,
https://codeberg.org/dnkl/foot,
https://codecov.io/gh/contour-terminal/contour,
https://msdn.microsoft.com/zh-cn/library/f4k12ae8,
https://msdn.microsoft.com/en-us/library/fzt08www,
"
editorconfig:
name: "Check editorconfig"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
# }}}
# {{{ StaticBuild
staticBuild:
if: github.ref == 'refs/heads/master' || github.head_ref == 'release'
name: "Static build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: "update APT database"
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: Build release
shell: bash
run: |
docker buildx build \
--tag static_contour \
--progress=plain \
-f .github/static/DockerUbuntu \
--load \
.
docker create --name contour_static static_contour
docker cp contour_static:/contour/build/src/contour/contour contour
docker container rm contour_static
- name: "Uploading static executable"
uses: actions/upload-artifact@v4
with:
name: "contour"
path: "contour"
if-no-files-found: error
retention-days: 1
# }}}
# {{{ Fedora
# fedora:
# strategy:
# fail-fast: false
# matrix:
# os_version: [40]
# arch:
# [
# "linux/amd64 x86_64"
# ]
# name: "Fedora ${{ matrix.os_version }} ${{ matrix.arch }}"
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@v2
# with:
# version: latest
# - name: Read matrix info
# id: tags
# shell: bash
# run: |
# arch="${{ matrix.arch }}"
# echo "PLATFORM=${arch%% *}" >> "$GITHUB_OUTPUT"
# echo "ARCH=${arch##* }" >> "$GITHUB_OUTPUT"
# - name: "update APT database"
# run: sudo apt -q update
# - name: Installing xmllint for ci-set-vars
# run: sudo apt -qy install libxml2-utils
# - name: set environment variables
# id: set_vars
# run: ./scripts/ci-set-vars.sh
# env:
# REPOSITORY: ${{ github.event.repository.name }}
# - name: Fetch and unpack embeds
# run: ./scripts/install-deps.sh
# env:
# PREPARE_ONLY_EMBEDS: 'ON'
# SYSDEP_ASSUME_YES: 'ON'
# OS_OVERRIDE: 'fedora'
# - name: "Post-fix embedded dependency permissions."
# run: sudo find _deps/sources -exec chown $UID {} \;
# - name: prepare distfile
# run: |
# set -x
# PKGNAME="contour-${{ steps.set_vars.outputs.VERSION }}"
# DISTDIR="/tmp/dist/${PKGNAME}"
# mkdir -p ${DISTDIR}
# cp -rvp . ${DISTDIR}
# tar czpf ${PKGNAME}.tar.gz -C "/tmp/dist" .
# - name: disable pedantic compiler on certain OS versions
# # Generally disable -Werror.
# #if: ${{ matrix.os_version == 38 || matrix.os_version == 39 }}
# run: |
# set -ex
# #sed -i -e "s/PEDANTIC_COMPILER=ON/PEDANTIC_COMPILER=OFF/" .github/fedora/contour.spec
# sed -i -e "s/PEDANTIC_COMPILER_WERROR=ON/PEDANTIC_COMPILER_WERROR=OFF/" .github/fedora/contour.spec
# - name: Build ${{ matrix.arch }} release
# shell: bash
# run: |
# set -x
# ARCH="${{ steps.tags.outputs.ARCH }}"
# VERSION="${{ steps.set_vars.outputs.VERSION }}"
# OS_VERSION="${{ matrix.os_version }}"
# sed -i -e "s/fedora:35/fedora:${{ matrix.os_version }}/" .github/fedora/Dockerfile
# docker buildx build --platform ${{ steps.tags.outputs.PLATFORM }} \
# --tag contour:${ARCH} \
# --build-arg VERSION=${VERSION} \
# --build-arg VERSION_STRING=${VERSION} \
# -f .github/fedora/Dockerfile \
# --load \
# .
# docker create --name contour-${ARCH} contour:${ARCH}
# docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
# contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
# docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
# contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
# docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
# contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
# docker container rm contour-${{ steps.tags.outputs.ARCH }}
# echo "pwd: `pwd`" && ls -hla
# - name: "Uploading Fedora RPM package"
# uses: actions/upload-artifact@v4
# with:
# name: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
# path: |
# contour-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm
# contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm
# contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm
# if-no-files-found: error
# retention-days: 7
# }}}
# {{{ FreeBSD
freebsd:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
name: FreeBSD 13
# env:
# MYTOKEN: "value1"
# MYTOKEN2: "value2"
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
timeout-minutes: 60
with:
envs: 'MYTOKEN MYTOKEN2'
usesh: true
copyback: false
prepare: pkg install -y wget
run: |
set -ex
pwd
ls -lah
whoami
env
freebsd-version
SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
cmake -S . -B build -DCONTOUR_TESTING=ON -DLIBUNICODE_USE_STD_SIMD=OFF
cmake --build build/ -j2
./build/src/crispy/crispy_test
./build/src/vtparser/vtparser_test
./build/src/vtbackend/vtbackend_test
./build/src/vtrasterizer/vtrasterizer_test
rm -rf _deps build
# }}}
# {{{ OpenBSD
openbsd:
if: false #github.ref == 'refs/heads/master' || github.head_ref == 'release'
runs-on: ubuntu-latest
name: OpenBSD 7.5
# env:
# MYTOKEN: "value1"
# MYTOKEN2: "value2"
steps:
- uses: actions/checkout@v4
- name: Test in OpenBSD
id: test
uses: vmactions/openbsd-vm@v1
timeout-minutes: 60
with:
envs: 'MYTOKEN MYTOKEN2'
usesh: true
copyback: false
prepare: pkg_add -DI wget
run: |
set -ex
pwd
ls -lah
whoami
env
./scripts/install-deps.sh
mkdir build
cmake -S . -B build -DCMAKE_CXX_COMPILER=clang++ -D CMAKE_CXX_FLAGS=-I/home/runner/work/contour/contour/_deps/sources/yaml-cpp-0.8.0/include -DCONTOUR_TESTING=ON -DLIBUNICODE_USE_STD_SIMD=OFF
cmake --build build/ -j2
./build/src/crispy/crispy_test
./build/src/vtparser/vtparser_test
./build/src/vtbackend/vtbackend_test
./build/src/vtrasterizer/vtrasterizer_test
rm -rf _deps build
# }}}
# {{{ macOS
macOSArm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: set variables
id: set_vars
run: |
./scripts/ci-set-vars.sh
echo QTVER=6 >> "$GITHUB_OUTPUT"
# Please read the following link on how to use MacOS code signing on Github CI:
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
echo "CODE_SIGN_CERTIFICATE_ID=Developer ID Application: Christian Parpart (6T525MU9UR)" >> "$GITHUB_OUTPUT"
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: Install the Apple certificate and provisioning profile
if: github.ref == 'refs/heads/master' || github.head_ref == 'release'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-macosArm_qt${{ steps.set_vars.outputs.QTVER }}-r1
max-size: 256M
- name: "Install dependencies"
# Sometimes, brew thinks it needs to install from source rather than binary.
# For Qt this may take ages (many many hours). Let's not waste our CPU credits here,
# and limit the run time.
timeout-minutes: 15
run: |
set -ex
#brew update
# Trying to work around some Github CI issues causing `brew install` to fail
brew uninstall aws-sam-cli azure-cli
QTVER=${{ steps.set_vars.outputs.QTVER }}
QTVER=${QTVER} ./scripts/install-deps.sh
- name: "Create build directory"
run: mkdir build
- name: "Generate build files"
run: |
QTVER=${{ steps.set_vars.outputs.QTVER }}
cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCONTOUR_TESTING=ON \
-DCONTOUR_QT_VERSION=${QTVER} \
-DCMAKE_PREFIX_PATH$="$(brew --prefix qt@${QTVER})" \
-DMACDEPLOYQT_EXECUTABLE="$(brew --prefix qt${QTVER})/bin/macdeployqt" \
-DMACDEPLOYQT_QML_WORKAROUND=ON \
-DCODE_SIGN_CERTIFICATE_ID="${{ steps.set_vars.outputs.CODE_SIGN_CERTIFICATE_ID }}" \
-B build/
- name: "Build"
run: cmake --build build/
- name: "test: crispy"
run: ./build/src/crispy/crispy_test
- name: "test: vtparser"
run: ./build/src/vtparser/vtparser_test
- name: "test: vtbackend"
run: ./build/src/vtbackend/vtbackend_test
- name: "test: vtrasterizer"
run: ./build/src/vtrasterizer/vtrasterizer_test
- name: "Create Package(s)"
run: |
set -ex
echo killing...; sudo pkill -9 XProtect >/dev/null || true; # see https://github.com/actions/runner-images/issues/7522
echo waiting...; while pgrep XProtect; do sleep 3; done;
cd build; cpack -G DragNDrop --verbose; cd -
# cmake --build build --target package-verbose
# ls -hl build/
# find build/src/contour/contour.app -print
BASENAME="contour-${{ steps.set_vars.outputs.version }}-macOS-arm"
mv -vf "build/Contour-${{ steps.set_vars.outputs.VERSION_STRING }}-Darwin.dmg" "${BASENAME}.dmg"
- name: upload to artifact store (DMG)
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.version }}-macOS-arm.dmg"
path: "contour-${{ steps.set_vars.outputs.version }}-macOS-arm.dmg"
retention-days: 7
macOSx86:
runs-on: macos-latest-large
if: github.head_ref == 'release'
steps:
- uses: actions/checkout@v4
- name: set variables
id: set_vars
run: |
./scripts/ci-set-vars.sh
echo QTVER=6 >> "$GITHUB_OUTPUT"
# Please read the following link on how to use MacOS code signing on Github CI:
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
echo "CODE_SIGN_CERTIFICATE_ID=Developer ID Application: Christian Parpart (6T525MU9UR)" >> "$GITHUB_OUTPUT"
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: Install the Apple certificate and provisioning profile
if: github.ref == 'refs/heads/master' || github.head_ref == 'release'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-macOSx86_qt${{ steps.set_vars.outputs.QTVER }}-r1
max-size: 256M
- name: "Install dependencies"
# Sometimes, brew thinks it needs to install from source rather than binary.
# For Qt this may take ages (many many hours). Let's not waste our CPU credits here,
# and limit the run time.
timeout-minutes: 15
run: |
set -ex
#brew update
# Trying to work around some Github CI issues causing `brew install` to fail
brew uninstall aws-sam-cli azure-cli
QTVER=${{ steps.set_vars.outputs.QTVER }}
QTVER=${QTVER} ./scripts/install-deps.sh
- name: "Create build directory"
run: mkdir build
- name: "Generate build files"
run: |
QTVER=${{ steps.set_vars.outputs.QTVER }}
cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCONTOUR_TESTING=ON \
-DCONTOUR_QT_VERSION=${QTVER} \
-DCMAKE_PREFIX_PATH$="$(brew --prefix qt@${QTVER})" \
-DMACDEPLOYQT_EXECUTABLE="$(brew --prefix qt${QTVER})/bin/macdeployqt" \
-DMACDEPLOYQT_QML_WORKAROUND=ON \
-DCODE_SIGN_CERTIFICATE_ID="${{ steps.set_vars.outputs.CODE_SIGN_CERTIFICATE_ID }}" \
-B build/
- name: "Build"
run: cmake --build build/
- name: "test: crispy"
run: ./build/src/crispy/crispy_test
- name: "test: vtparser"
run: ./build/src/vtparser/vtparser_test
- name: "test: vtbackend"
run: ./build/src/vtbackend/vtbackend_test
- name: "test: vtrasterizer"
run: ./build/src/vtrasterizer/vtrasterizer_test
- name: "Create Package(s)"
run: |
set -ex
echo killing...; sudo pkill -9 XProtect >/dev/null || true; # see https://github.com/actions/runner-images/issues/7522
echo waiting...; while pgrep XProtect; do sleep 3; done;
cd build; cpack -G DragNDrop --verbose; cd -
# cmake --build build --target package-verbose
# ls -hl build/
# find build/src/contour/contour.app -print
BASENAME="contour-${{ steps.set_vars.outputs.version }}-macOS-x86"
mv -vf "build/Contour-${{ steps.set_vars.outputs.VERSION_STRING }}-Darwin.dmg" "${BASENAME}.dmg"
- name: upload to artifact store (DMG)
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.version }}-macOS-x86.dmg"
path: "contour-${{ steps.set_vars.outputs.version }}-macOS-x86.dmg"
retention-days: 7
# }}}
# {{{ Windows
windows:
name: "Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: setup environment
shell: powershell
id: set_vars
run: .\scripts\ci-set-vars.ps1
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "Fetch embedded dependencies"
shell: powershell
run: |
./scripts/install-deps.ps1 --skip-vcpkg
type ./_deps/sources/CMakeLists.txt
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: "6.6.1"
#version: "5.15.*"
modules: qtmultimedia qt5compat qtshadertools
- name: "vcpkg: Install dependencies"
uses: lukka/[email protected]
id: runvcpkg
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
vcpkgGitCommitId: 80403036a665cb8fcc1a1b3e17593d20b03b2489
- name: "Install cmake"
uses: lukka/[email protected]
- name: "Check cmake version"
run: cmake --version
- name: "Generate build files"
run: cmake --preset windows-cl-release
env:
VCPKG_ROOT: "${{ runner.workspace }}/vcpkg"
- name: "Build"
run: cmake --build --preset windows-cl-release
- name: "Test"
run: ctest --preset windows-cl-release
- name: "Create Package(s)"
shell: powershell
run: |
cpack --preset windows-cl-release -V
#type "_CPack_Packages/win64/WIX/wix.log"
- name: inspect
run: Get-ChildItem -Recurse
- name: "Rename package(s)"
run: |
mv "out\build\windows-cl-release\Contour-${{ steps.set_vars.outputs.version }}-win64.msi" "contour-${{ steps.set_vars.outputs.version }}-win64.msi"
mv "out\build\windows-cl-release\Contour-${{ steps.set_vars.outputs.version }}-win64.zip" "contour-${{ steps.set_vars.outputs.version }}-win64.zip"
- name: "Inspect again"
run: Get-ChildItem
- name: "Uploading MSI to artifact store"
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.version }}-win64.msi"
path: "contour-${{ steps.set_vars.outputs.version }}-win64.msi"
if-no-files-found: error
retention-days: 7
- name: "Uploading ZIP to artifact store"
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.version }}-win64.zip"
path: "contour-${{ steps.set_vars.outputs.version }}-win64.zip"
if-no-files-found: error
retention-days: 7
# }}}
# {{{ Ubuntu 24.04 CC matrix
ubuntu_2404_cc_matrix:
strategy:
fail-fast: false
matrix:
cxx: [20]
build_type: ["RelWithDebInfo"]
compiler:
[
"GCC 14",
"Clang 18",
]
qt_version: [6]
runner:
[
"ubuntu-24.04",
"ubuntu-24.04-arm",
]
name: "${{ matrix.runner }} (${{ matrix.compiler }}, C++${{ matrix.cxx }}, Qt${{ matrix.qt_version }})"
runs-on: ${{ matrix.runner }}
outputs:
id: "${{ matrix.runner }} ${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }}, ${{ matrix.qt_version }})"
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-{{ matrix.runner }}-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}-${{ matrix.qt_version }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set environment variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "Set up output var: CC_VERSION"
id: extract_matrix
run: |
CC_VERSION=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
echo "CC_VERSION=${CC_VERSION}" >> "$GITHUB_OUTPUT"
- name: "Set up QTVER var"
id: set_qtver
run: |
if [[ ${{ matrix.qt_version }} = "5" ]]; then
echo "QTVER=5" >> "$GITHUB_OUTPUT"
else
echo "QTVER=6" >> "$GITHUB_OUTPUT"
fi
- name: "install dependencies"
run: sudo env QTVER="${{ matrix.qt_version }}" SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
- name: "Post-fix embedded dependency permissions."
run: sudo find _deps/sources -exec chown $UID {} \;
- name: Install GCC
if: ${{ startsWith(matrix.compiler, 'GCC') }}
run: sudo apt install -y g++-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: Install Clang
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: sudo apt install -y clang-${{ steps.extract_matrix.outputs.CC_VERSION }} #libc++-dev libc++abi-dev
- name: Install Clang-Tidy
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: sudo apt install -y clang-tidy-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: "create build directory"
run: mkdir build
- name: CMake version
run: cmake --version
- name: "cmake"
run: |
CC_NAME=$(echo "${{ matrix.compiler }}" | awk '{ print tolower($1); }')
CC_VER=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
test "${{ matrix.compiler }}" = "GCC 8" && EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=ON"
test "${CC_NAME}" = "gcc" && CC_EXE="g++"
if [[ "${CC_NAME}" = "clang" ]]; then
CC_EXE="clang++"
# CMAKE_CXX_FLAGS="-stdlib=libc++"
# CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DENABLE_TIDY=ON"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=OFF"
fi
cmake \
$EXTRA_CMAKE_FLAGS \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \
-DCMAKE_CXX_COMPILER="${CC_EXE}-${CC_VER}" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCONTOUR_QT_VERSION=${{ matrix.qt_version }} \
-DLIBUNICODE_UCD_BASE_DIR=$PWD/_ucd \
-DPEDANTIC_COMPILER_WERROR=OFF \
--preset linux-debug
- name: "build"
run: cmake --build --preset linux-debug -- -j3
- name: "tests"
run: cmake --build --preset linux-debug --target test
- name: "Upload unit tests"
if: ${{ matrix.compiler == 'GCC 14' && matrix.cxx == '20' && matrix.qt_version == '6' && matrix.runner == 'ubuntu-24.04'}}
uses: actions/upload-artifact@v4
with:
name: contour-ubuntu2404-tests
path: |
build/linux-debug/src/crispy/crispy_test
build/linux-debug/src/vtparser/vtparser_test
build/linux-debug/src/vtbackend/vtbackend_test
build/linux-debug/src/vtbackend/bench-headless
build/linux-debug/src/vtrasterizer/vtrasterizer_test
test/images
retention-days: 1
# }}}
# {{{ Linux AppImage (Using Ubuntu 24.04 as base).
package_for_AppImage:
name: "Packaging for AppImage"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: update APT database
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt-get -qy install libxml2-utils
- name: set environment variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: build inside docker
run: |
docker buildx build --tag contour-appimage \
-f .github/appimage/Dockerfile --load .
docker create --name contour-appimage contour-appimage
docker cp contour-appimage:/contour/Contour-latest-x86_64.AppImage contour-${{ steps.set_vars.outputs.VERSION_STRING }}.AppImage
docker container rm contour-appimage
- name: "set mode"
run: sudo chmod +x contour-${{ steps.set_vars.outputs.VERSION_STRING }}.AppImage
- name: "libfuse"
run: sudo apt-get -qy install libfuse2
- name: "Testing AppImage"
run: ./contour-${{ steps.set_vars.outputs.VERSION_STRING }}.AppImage version
- name: "Uploading AppImage"
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.VERSION_STRING }}.AppImage"
path: "contour-${{ steps.set_vars.outputs.VERSION_STRING }}.AppImage"
if-no-files-found: error
retention-days: 7
# }}}
# {{{ Ubuntu 24.04
package_for_Ubuntu:
name: "Packaging for Ubuntu ${{ matrix.os_version }}"
strategy:
fail-fast: false
matrix:
os_version: ['24.04']
runs-on: ubuntu-${{ matrix.os_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: "update APT database"
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu-${{ matrix.os_version }}"
max-size: 256M
- name: "install dependencies"
run: sudo env QTVER="${{ steps.set_qtver.outputs.QTVER }}" ./scripts/install-deps.sh
- name: "Post-fix embedded dependency permissions."
run: sudo find _deps/sources -exec chown $UID {} \;
- name: "create build directory"
run: mkdir build
- name: Install CMake
if: matrix.os_version != '24.04'
uses: ssrobins/install-cmake@v1
- name: CMake version
run: cmake --version
- name: "cmake"
run: |
# TODO: turn on -Werror again, that requires some code changes.
CMAKE_CXX_STANDARD=20
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_QT_VERSION=6"
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_PACKAGE_TERMINFO=OFF"
BUILD_DIR="build" \
CMAKE_BUILD_TYPE=RelWithDebInfo \
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS \
-DCMAKE_CXX_STANDARD=$CMAKE_CXX_STANDARD \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCONTOUR_TESTING=ON \
-DPEDANTIC_COMPILER_WERROR=OFF \
" \
./scripts/ci-prepare-contour.sh
- name: "build"
run: cmake --build --preset linux-release / -- -j3
- name: "tests"
run: cmake --build --preset linux-release --target test
- name: "CPack: Creating DEB package"
run: |
set -ex
cpack --preset linux-release
OS_VERSION=${{ matrix.os_version }}
OS_VERSION=${OS_OVERRIDE/./_}
mv -v "./build/linux-release/Contour-${{ steps.set_vars.outputs.VERSION_STRING }}-Linux-contour.deb" \
"contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.deb"
mv -v "./build/linux-release/Contour-${{ steps.set_vars.outputs.VERSION_STRING }}-Linux-contour-dbgsym.ddeb" \
"contour-dbgsym-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.ddeb"
- name: "Uploading artifact .deb package"
uses: actions/upload-artifact@v4
with:
name: "contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.deb"
path: |
contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.deb
contour-dbgsym-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.ddeb
if-no-files-found: error
retention-days: 7
- name: "Attempt installing the created .deb"
run: |
sudo dpkg --install "contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.deb"
sudo dpkg --install "contour-dbgsym-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.ddeb"
# }}}
# {{{ Ubuntu 24.04: test via valgrind
test_ubuntu2404_valgrind:
name: "Run tests via valgrind"
runs-on: ubuntu-24.04
needs: [ubuntu_2404_cc_matrix]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
- name: "download artifact"
uses: actions/download-artifact@v4
with:
name: contour-ubuntu2404-tests
- name: "update APT database"
run: sudo apt -q update
- name: "fix unit test permissions"
run: |
find . -name '*_test' -exec chmod 0755 {} \;
find . -name 'bench-headless' -exec chmod 0755 {} \;
- name: "install dependencies"
run: ./scripts/ci-install-run-deps.sh valgrind
- name: "test: crispy (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/crispy/crispy_test
- name: "test: vtparser (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtparser/vtparser_test
- name: "test: vtbackend (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtbackend/vtbackend_test
- name: "test: vtrasterizer (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtrasterizer/vtrasterizer_test
# }}}
# {{{ Ubuntu 24.04: Test bench-headless
test_ubuntu2404_bench_headless:
strategy:
matrix:
test_case:
[
"grid cat",
"grid long"
]
name: "Run bench-headless"
runs-on: ubuntu-24.04
needs: [ubuntu_2404_cc_matrix]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
- name: "download artifact"
uses: actions/download-artifact@v4
with:
name: contour-ubuntu2404-tests
- name: "update APT database"
run: sudo apt -q update
- name: "fix unit test permissions"
run: |
find . -name '*_test' -exec chmod 0755 {} \;
find . -name 'bench-headless' -exec chmod 0755 {} \;
- name: "install dependencies"
run: ./scripts/ci-install-run-deps.sh valgrind
- name: "bench-headless: ${{ matrix.test_case }}"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtbackend/bench-headless ${{ matrix.test_case }} size 1
# }}}
# {{{ Ubuntu check matrix
check_ubuntu2404_matrix_test_matrix:
if: ${{ always() }}
runs-on: ubuntu-latest
name: "Ubuntu Linux 24.04 post-check"
needs:
- package_for_Ubuntu
- ubuntu_2404_cc_matrix
- test_ubuntu2404_valgrind
- test_ubuntu2404_bench_headless
steps:
- name: Print matrix status
run: |
echo "Result (CC matrix) : ${{ needs.ubuntu_2404_cc_matrix.result }}"
echo "Result (packaging matrix) : ${{ needs.package_for_Ubuntu.result }}"
- name: Check build matrix status
if: ${{ needs.ubuntu_2404_cc_matrix.result != 'success' && needs.ubuntu_2404_cc_matrix.result != 'skipped' }}
run: exit 1