-
Notifications
You must be signed in to change notification settings - Fork 2
706 lines (680 loc) · 28 KB
/
ci.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
name: "CI: Test, Build and create release"
# yamllint disable
on:
# yamllint enable
push:
branches:
- main
- develop
- workflow-issues
tags:
- "[0-9]+.[0-9]+.[0-9]+"
paths:
- "**.cpp"
- "**.h"
- "**.hpp"
- "**.py"
- cmake/**
- src/**
- CMakeLists.txt
- conanfile.py
- .github/workflows/ci.yml
- packaging/flatpak/org.jmuelbert.jmbde-QT.yaml
- snap/snapcraft.yaml
pull_request:
# The branches below must be a subset of the branches above
types: [opened, synchronize, reopened]
paths:
- "**.cpp"
- "**.h"
- "**.hpp"
- "**.py"
- cmake/**
- src/**
- CMakeLists.txt
- conanfile.py
- .github/workflows/ci.yml
- packaging/flatpak/org.jmuelbert.jmbde-QT.yaml
- snap/snapcraft.yaml
workflow_dispatch:
env:
# Target
TARGET_NAME: jmbde
PROJECT_NAME: jmbde-QT
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
CLANG_TIDY_VERSION: 13.0.0
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
QT_VERSION: 6.7.2
QT_TARGET: desktop
permissions:
contents: read
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
# format
clang-format:
# Skip any PR created by dependabot to avoid permission issues:
if: (github.actor != 'dependabot[bot]')
name: 💎 CLang-Format
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout the repository to the GitHub Actions runner
- name: 🧰 Checkout Source Code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: 🟨 Use clang-format
uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2
with:
source: .
exclude: ./third_party ./external
extensions: c,h,cpp,hpp
clangFormatVersion: 14
inplace: true
- name: Add and commit
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1
with:
author_name: Clang Robot
author_email: robot@example.com
message: ":art: Committing clang-format changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cmake-format:
# Skip any PR created by dependabot to avoid permission issues:
if: (github.actor != 'dependabot[bot]')
name: 💎 CMake-Format
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout the repository to the GitHub Actions runner
- name: 🧰 Checkout Source Code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0
- name: 🟨 Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
# Read python version from a file .python-version
python-version-file: .python-version
# check-latest: true
cache: pip
- name: 🟨 Install cmakelang
run: |
python -m pip install --upgrade pip
pip3 install -r .github/workflows/cmake-requirements.txt
- name: 🟨 Use cmake-format
run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \;
- name: 📨 Use Commit
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1
with:
author_name: github_actions
message: ":art: Committing format changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# lint:
# tests:
tests:
# Skip any PR created by dependabot to avoid permission issues:
if: (github.actor != 'dependabot[bot]')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Recommendations:
# * support at least 2 operating systems
# * support at least 2 compilers
# * make sure all supported configurations for your project are built
#
# Disable/enable builds in this list to meet the above recommendations
# and your own projects needs
matrix:
os: [ubuntu-latest, ubuntu-22.04]
generator:
- Ninja
compiler:
- g++-10
ccompiler:
- gcc-10
build_type:
- Debug
qt_version: [6.7.2]
permissions:
actions: read
contents: read
security-events: write
steps:
- name: 🧰 Checkout Source Code
# Checkout the repository to the GitHub Actions runner
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: ⚙️ Install Python
id: python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
# Read python version from a file .python-version
python-version-file: .python-version
# check-latest: true
cache: pip
- name: ⚙️ Install Python dependencies
shell: bash
id: python-deps
run: |
python -m pip install --upgrade pip
pip3 install -r .github/workflows/conan-requirements.txt
- name: 🐧 ⚙️ Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \
sudo apt-get --no-install-recommends --assume-yes install \
libclang-dev \
ninja-build \
gcovr \
ccache \
cppcheck \
googletest
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> $GITHUB_ENV
echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV
echo "CC=${{matrix.ccompiler}}" >> $GITHUB_ENV
- name: Configure Conan
shell: bash
run: |
echo "Setup conan"
conan profile detect --force
conan profile show
- name: ⚙️ Install Qt Version ${{ matrix.qt_version }}
uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0
with:
version: "${{ matrix.qt_version }}"
arch: "${{ env.QT_ARCH }}"
target: "${{ env.QT_TARGET }}"
tools: "${{ env.QT_TOOLS }}"
setup-python: "true"
cache: "true"
cache-key-prefix: "${{ runner.os }}-install-qt-action"
set-env: "true"
install-deps: "true"
- uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
if: runner.os == 'Linux'
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}
max-size: 50M
- name: restore ccache
uses: pat-s/always-upload-cache@9a0d1c3e1a8260b05500f9b67a5be8f2a1299819 # v3.0.11
with:
path: ${{github.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.qt_version}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.qt_version}}
- name: check ccache stats prior to build
run: ccache --zero-stats --show-stats
- name: Add GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory build
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
- name: Configure CMake
# has meaningful results
working-directory: build
shell: bash
run: |
mkdir -pv usr
echo "CMAKE_PREFIX_PATH=$QT_ROOT_DIR" >> $GITHUB_ENV
printenv
conan install .. --build=missing --settings=build_type=${{matrix.build_type}}
cmake -S .. -B . -G "${{matrix.generator}}" \
-DCMAKE_MAKE_PROGRAM="/usr/bin/ninja" \
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX:PATH="./usr" \
-DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \
-DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \
-DENABLE_CACHE="ON"
- name: 🚧 Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}
- name: check ccache stats prior to build
run: ccache --zero-stats --show-stats
- name: 🐧 🧪 Test and coverage
working-directory: build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{matrix.build_type}}
gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml
- name: Publish to codecov
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
files: ./build/coverage.xml
build:
# if: startsWith(github.event.ref, 'refs/tags/')
name: "Build for ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
needs: tests
strategy:
fail-fast: false
matrix:
name: [ubuntu-latest-clang++, macos-latest-clang++, windows-latest-cl.exe]
include:
- name: ubuntu-latest-clang++
os: ubuntu-latest
build_type: Release
qt_arch: gcc_64
compiler: clang++-14
ccompiler: clang-14
clang-tidy: ""
generator: Ninja
- name: windows-latest-cl.exe
os: windows-latest
build_type: Release
qt_arch: win64_msvc2019_64
arch: x64
pak_arch: win64
compiler: cl.exe
ccompiler: cl.exe
clang-tidy: ""
generator: Ninja
- name: macos-latest-clang++
os: macos-latest
build_type: Release
qt_arch: clang_64
arch: clang_64
compiler: clang++
ccompiler: clang
generator: Ninja
env:
CXX: ${{ matrix.compiler }}
CC: ${{ matrix.ccompiler }}
permissions:
actions: read
contents: read
security-events: write
steps:
- name: ⚙️ Get the version
id: get_version
shell: bash
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT"
- name: 🧰 Checkout Source Code
# Checkout the repository to the GitHub Actions runner
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: ⚙️ Install Python
id: python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
# Read python version from a file .python-version
python-version-file: .python-version
# check-latest: true
cache: pip
- name: ⚙️ Install Python dependencies
shell: bash
id: python-deps
run: |
python -m pip install --upgrade pip
pip3 install -r ./conan-requirements.txt
- name: 🐧 ⚙️ Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \
sudo apt-get --no-install-recommends --assume-yes install \
libclang-dev \
ninja-build \
ccache
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV"
echo "CXX=${{matrix.compiler}}" >> "$GITHUB_ENV"
echo "CC=${{matrix.ccompiler}}" >> "$GITHUB_ENV"
- name: ⚙️ 🍎 Install macos dependencies
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
run: |
brew install ninja ccache pkg-config
echo "/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH"
echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV"
# Use latest available XCode
sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> "$GITHUB_ENV"
- name: 🧊 ⚙️ Install Windows dependencies
if: runner.os == 'Windows'
run: |
cinst ninja ccache
- name: 🧊 ⚙️ Configure MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@ 0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
# 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo
toolset: 14.2
arch: ${{ matrix.pak_arch }}
- name: Configure Conan
shell: bash
run: |
echo "Setup conan"
conan profile detect --force
conan profile show
- name: (Linux/macOS) restore ccache
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ${{github.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}}
- name: (Linux/macOS) check ccache stats prior to build
if: runner.os == 'Linux' || runner.os == 'macOS'
run: ccache --zero-stats --show-stats
- name: Add GCC problem matcher
if: runner.os == 'Linux'
uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0
- name: "⚙️ Install Qt Version ${{ env.QT_VERSION }}"
uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0
with:
version: ${{ env.QT_VERSION }}
target: ${{ env.QT_TARGET }}
arch: ${{ matrix.qt_arch }}
dir: "${{ github.workspace }}/build/"
install-deps: "true"
# modules: 'qtcharts qtwebengine'
setup-python: "true"
# tools: "tools_ifw"
set-env: "true"
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory build
- name: ⚙️ 🧊 Configure CMake
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
if: runner.os == 'Windows'
working-directory: build
shell: pwsh
run: |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV '
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} '
cmake `
-S .. -B . `
-G "${{matrix.generator}}" `
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" `
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} `
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" `
-DBUILD_SHARED_LIBS:BOOL="TRUE"
# -G "Visual Studio 16 2019" -A "x64" `
- name: ⚙️ 🐧 Configure CMake
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results.
if: runner.os == 'Linux'
working-directory: build
shell: bash
run: |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV \
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} \
cmake -S .. -B . -G "${{matrix.generator}}" \
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \
-DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \
-DBUILD_SHARED_LIBS:BOOL="TRUE" \
-DENABLE_CACHE="ON"
- name: ⚙️ 🍎 Configure CMake
working-directory: build
shell: bash
if: runner.os == 'macOS'
run: |
echo "CMAKE_PREFIX_PATH=$env.QT_ROOT_DIR" >> $GITHUB_ENV \
conan install .. --build=missing --settings=build_type=${{matrix.build_type}} \
cmake -S .. -B . -G "${{matrix.generator}}" \
-DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \
-DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \
-DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \
-DBUILD_SHARED_LIBS:BOOL="TRUE" \
-DENABLE_CACHE="ON"
- name: 📦 🍎 Build and package application (macdeployqt and zipfile)
# TODO: Stored in install. Build DMG with CPack
working-directory: build
if: runner.os == 'macOS'
run: |
cmake --build . --config ${{matrix.build_type}}
cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP"
- name: ⚙️ 🧊 Build
# TODO: Stored in install. Build installer with CPack
if: runner.os == 'Windows'
working-directory: build
run: |
cmake --build . --config ${{matrix.build_type}}
cpack -C "${{matrix.build_type}}" -G "WIX;ZIP"
- name: ⚙️ 🐧 Build
if: runner.os == 'Linux'
working-directory: build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
sudo apt-get -y --no-install-recommends install tree
cmake --build . --config ${{matrix.build_type}} --target install
- name: ⚙️ 🐧 Install go-appimage tool
if: runner.os == 'Linux'
# Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
# which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
# Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
run: |
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimaged-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -P "$GITHUB_WORKSPACE"
chmod +x "$GITHUB_WORKSPACE/appimaged-*.AppImage"
env:
APPIMAGETOOL_ARCH: x86_64
- name: 🐧 📦 Create AppImage
# TODO: Stored in build directory
if: runner.os == 'Linux'
shell: bash
run: |
APPIMAGE_DST_PATH="${{github.workspace}}/AppDir"
cd "$GITHUB_WORKSPACE"
cp "$GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png" "$APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png"
"$GITHUB_WORKSPACE/appimaged-*.AppImage" -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop"
mkdir -p "${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts"
if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
rm "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0"
fi
chmod +x "${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*"
"$GITHUB_WORKSPACE/appimaged-*.AppImage" "${APPIMAGE_DST_PATH}"
- name: 🐧 📤 Upload Linux artifacts
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: AppImage
path: ./*.AppImage*
- name: 🍎 📤 Upload macOS artifacts
if: runner.os == 'macOS'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: macos-artifacts
path: |
build/*.dmg
build/*.zip
- name: "🧊 📤 Upload artifact: Windows Installer"
if: runner.os == 'Windows'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: windows-artifacts
path: |
build/*.msi
build/*.zip
flatpak-build:
name: "🐧 Build flatpak on ubuntu-latest"
runs-on: ubuntu-latest
needs: tests
permissions:
actions: read
contents: read
security-events: write
steps:
- name: "⚙️ Get the version"
id: get_version
shell: bash
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT"
- name: 🧰 Checkout Source Code
# Checkout the repository to the GitHub Actions runner
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Install Flatpak
run: |
sudo apt-get -y -qq update
sudo apt-get install -y flatpak flatpak-builder
- name: Setup Flatpak
run: |
sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \
apt-get --no-install-recommends --assume-yes install \
flatpak flatpak-builder elfutils
- name: Flatpak add user
run: |
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: 📦 Create package
run: "mkdir -pv \"$GITHUB_WORKSPACE/install\"\nBUNDLE=\"io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak\"\nMANIFEST_PATH=\"$GITHUB_WORKSPACE/packging/flatpak/org.jmuelbert.jmbde.QT.yaml\"\nRUNTIME_REPO=\"https://flathub.org/repo/flathub.flatpakrepo\"\nAPP_ID=\"io.github.jmuelbert.${{env.TARGET_NAME}}\"\n\nflatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app \"${MANIFEST_PATH}\" --install-deps-from=flathub\nflatpak build-bundle repo ${BUNDLE} --runtime-repo=\"${RUNTIME_REPO}\" \"${APP_ID}\"\nmv \"$GITHUB_WORKSPACE/$BUNDLE\" \"$GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak\"\nls -al \n"
- name: 📤 Upload artifact FlatPak
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: flatpak-artifact
path: |
./install/*.flatpak
snap-build:
name: 🐧 Build snap on ubuntu-20.04
runs-on: ubuntu-20.04
needs: tests
steps:
- name: ⚙️ Get the version
id: get_version
shell: bash
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT"
- name: 🧰 Checkout Source Code
# Checkout the repository to the GitHub Actions runner
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: 📦 Create snap
uses: snapcore/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1.3.0
id: snapcraft
with:
snapcraft-args: --enable-experimental-extensions
- name: "Rename snap name"
shell: bash
run: |
mv "${{ steps.snapcraft.outputs.snap }}" "$GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap"
ls -lah
- name: 🐧 📤 Upload artifact SnapPack
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: snapcraft-artifact
path: |
$GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap
changeLog:
# if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: upload
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@69817ffbda9792da9756c52efd06b5a6103f39dc # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: mikepenz/action-gh-release@9a604afa5167a745eab07256a54e2f578a1a0c5e # v1
with:
body: ${{steps.github_release.outputs.changelog}}
# Upload continuous build
upload:
name: 🗂 Create release and upload artifacts
needs:
- build
- flatpak-build
- snap-build
runs-on: ubuntu-latest
steps:
- name: "⚙️ Get the version"
id: get_version
shell: bash
run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT"
- name: 📥 Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- name: 🗂 Inspect directory after downloading artifacts
run: ls -alFR
- name: "📤 Upload Release: AppImage"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/${{env.TARGET_NAME}}.appimage
asset_name: ${{env.TARGET_NAME}}.appimage
tag: ${{ github.ref }}
overwrite: true
- name: "📤 Upload Release: FlatPak"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/${{env.TARGET_NAME}}.flatpak
asset_name: ${{env.TARGET_NAME}}.flatpak
tag: ${{ github.ref }}
overwrite: true
- name: "📤 Upload Release: snap"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/${{env.TARGET_NAME}}.amd64.snap
asset_name: ${{env.TARGET_NAME}}.amd64.snap
tag: ${{ github.ref }}
overwrite: true
- name: "📤 Upload Release: macOS"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/${{env.TARGET_NAME}}.dmg
asset_name: ${{env.TARGET_NAME}}.dmg
tag: ${{ github.ref }}
overwrite: true
- name: "📤 Upload Release: windows"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.TARGET_NAME }}.exe
asset_name: ${{ env.TARGET_NAME}}-win.exe
tag: ${{ github.ref }}
overwrite: true
- name: "📤 Upload Release: zip for windows"
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.archiveName }}-win.zip
asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip
tag: ${{ github.ref }}
overwrite: true
release-all-green: # This job does nothing and is only used for the branch protection
if: always()
needs:
- clang-format
- cmake-format
- tests
- build
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@223e4bb7a751b91f43eda76992bcfbf23b8b0302 # v1.2.2
with:
jobs: ${{ toJSON(needs) }}