-
Notifications
You must be signed in to change notification settings - Fork 33
301 lines (262 loc) · 11 KB
/
CI.yml
File metadata and controls
301 lines (262 loc) · 11 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
name: CI
on:
pull_request:
push:
branches:
- main
tags:
- "v*"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
paths-to-include: ${{ steps.changes.outputs.paths-to-include }}
steps:
- uses: actions/checkout@v6.0.2
# Filter paths to determine whether to proceed with the build
- name: "Filter Paths"
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
paths-to-include:
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/*.cpp'
- '**/*.h'
- '**/*.h.in'
- '**/*.ini'
- '.github/workflows/CI.yml'
win-tests:
needs: changes
if: ${{ needs.changes.outputs.paths-to-include == 'true' }}
runs-on: windows-2022
strategy:
matrix:
include:
- APPLAUNCHER_CMAKE_GENERATOR: "Ninja"
APPLAUNCHER_PACKAGE_TARGET: "package"
# The wrapper is generated by FindVcvars CMake module used in "msvc-static-configure.cmake"
APPLAUNCHER_BUILD_WRAPPER: "CMakeFiles/vcvarsall_wrapper.bat"
- APPLAUNCHER_CMAKE_GENERATOR: "Visual Studio 17 2022"
APPLAUNCHER_PACKAGE_TARGET: "PACKAGE"
APPLAUNCHER_BUILD_WRAPPER: ""
name: windows-2022
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
path: src
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@3a6cbe35ba64df7ca70c51365c4aff65db9a9037 # v2.1.1
with:
cmake-version: 3.22.2
- name: Create directories
run: |
mkdir C:\Qt-static
mkdir build
- name: Download Qt archive
uses: carlosperate/download-file-action@3ec6fcef61e19eaaa0236a95fbaf333f2baf341e # v2.0.2
with:
file-url: "https://github.com/jcfr/qt-static-build/releases/download/applauncher-5.11.2-vs2017/qt-5.11.2-static-ltcg-msvc2017-x86.zip"
sha256: "e2531150a00d68624257d7b40c5b9d7c07feab55fbf98f7cda31f08b74b71c01"
- name: Extract Qt archive
shell: pwsh
run: |
7z x qt-5.11.2-static-ltcg-msvc2017-x86.zip -oC:\Qt-static\
# Since only the latest VC build tools are installed on the wnidows-2022 runner,
# this explicitly installs the component providing v141 toolset matching the one
# used to build "qt-5.11.2-static-ltcg-msvc2017-x86.zip".
# See https://github.com/actions/runner-images/issues/9701
- name: Install Visual Studio components
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd= @(
"Microsoft.VisualStudio.Component.VC.v141.x86.x64"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: Configure
shell: pwsh
run: |
$Qt5_DIR="C:\Qt-static\qt-5.11.2-static-ltcg-msvc2017-x86\lib\cmake\Qt5"
$CTKAppLauncher_SOURCE_DIR="${{ github.workspace }}\src"
$CTKAppLauncher_BUILD_DIR="${{ github.workspace }}\build"
cmake `
-DQt5_DIR:FILEPATH=$Qt5_DIR `
-DCTKAppLauncher_SOURCE_DIR:PATH=$CTKAppLauncher_SOURCE_DIR `
-DCTKAppLauncher_BUILD_DIR:PATH=$CTKAppLauncher_BUILD_DIR `
-DAPPLAUNCHER_CMAKE_GENERATOR_PLATFORM:STRING=Win32 `
-DAPPLAUNCHER_CMAKE_GENERATOR_TOOLSET:STRING=v141 `
-P src\msvc-static-configure.cmake
env:
APPLAUNCHER_CMAKE_GENERATOR: ${{ matrix.APPLAUNCHER_CMAKE_GENERATOR }}
- name: Build and package
shell: pwsh
run: |
$cmd = "${{ matrix.APPLAUNCHER_BUILD_WRAPPER }} cmake --build build --config Release --target ${{ matrix.APPLAUNCHER_PACKAGE_TARGET }}"
Invoke-Expression $cmd
$host.SetShouldExit($LastExitCode)
- name: Test
shell: pwsh
run: |
$cmd = "${{ matrix.APPLAUNCHER_BUILD_WRAPPER }} ctest -C Release --test-dir build --output-on-failure -j4"
Invoke-Expression $cmd
$host.SetShouldExit($LastExitCode)
- name: Publish packages
if: matrix.APPLAUNCHER_CMAKE_GENERATOR == 'Visual Studio 17 2022'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: win-packages
path: build/CTKAppLauncher-*.tar.gz
linux-tests:
needs: changes
if: ${{ needs.changes.outputs.paths-to-include == 'true' }}
runs-on: ubuntu-latest
env:
qt_archive_basename: qt-5.15.2-manylinux2.28-static-x86_64
qt_archive_sha256: e5e9a19a18a3e1e896691173dd23a668781d7154238d2e6fdd4996ca30b1f1e3
dockbuild_image: almalinux8-devtoolset14-gcc14
dockbuild_script: ./dockbuild-almalinux8-devtoolset14-gcc14-latest
name: ubuntu-latest [almalinux8-devtoolset14-gcc14]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
path: src
- name: Download Qt archive
uses: carlosperate/download-file-action@3ec6fcef61e19eaaa0236a95fbaf333f2baf341e # v2.0.2
with:
file-url:
"https://github.com/jcfr/qt-static-build/releases/download/${{
env.qt_archive_basename }}/${{ env.qt_archive_basename }}.tar.zst"
sha256: "${{ env.qt_archive_sha256 }}"
- name: Extract Qt archive
run: |
mkdir -p $qt_archive_basename
tar --zstd -xvf ${qt_archive_basename}.tar.zst -C ${qt_archive_basename}
- name: Pull build enviromment
run: |
docker pull dockbuild/${dockbuild_image}:latest
docker run --rm dockbuild/${dockbuild_image}:latest > ${dockbuild_script}
chmod u+x ${dockbuild_script}
- name: Configure
run: |
mkdir -p build
${dockbuild_script} \
src/.github/scripts/dockbuild_with_qt_env.sh "${qt_archive_basename}" \
cmake \
-DQt5_DIR:PATH=/work/${qt_archive_basename}/lib/cmake/Qt5 \
-DCTKAppLauncher_BUILD_DIR:PATH=build \
-P src/linux-static-configure.cmake
- name: Build and Package
run: |
${dockbuild_script} \
src/.github/scripts/dockbuild_with_qt_env.sh "${qt_archive_basename}" \
cmake --build build --target package
- name: Test
run: |
${dockbuild_script} \
src/.github/scripts/dockbuild_with_qt_env.sh "${qt_archive_basename}" \
src/.github/scripts/dockbuild_xvfb_wrapper.sh \
ctest \
--test-dir build \
--build-config Release \
--output-on-failure \
--parallel $(nproc)
- name: Publish packages
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: linux-packages
path: build/CTKAppLauncher-*.tar.gz
macos-tests:
needs: changes
if: ${{ needs.changes.outputs.paths-to-include == 'true' }}
runs-on: macos-14
name: macos-14
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
path: src
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@3a6cbe35ba64df7ca70c51365c4aff65db9a9037 # v2.1.1
with:
cmake-version: 3.22.2
- name: Download Qt archive
uses: carlosperate/download-file-action@3ec6fcef61e19eaaa0236a95fbaf333f2baf341e # v2.0.2
with:
file-url: "https://github.com/jcfr/qt-static-build/releases/download/qt-5.15.2-macosx10.13-static-x86_64/qt-5.15.2-macosx10.13-static-x86_64.tar.bz2"
sha256: "13a1df0c939c22618fb979072c3c16191cb42f7759ea3d8ec344aa229a04bca0"
- name: Extract Qt archive
run: |
tar -xjvf qt-5.15.2-macosx10.13-static-x86_64.tar.bz2
mv qt-5.15.2-macosx10.13-static-x86_64 qt
- name: Configure
run: |
cmake \
-DQt5_DIR:DIR=$(pwd)/qt/lib/cmake/Qt5 \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 \
-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 \
-B build -S src
env:
CC: clang
CXX: clang++
- name: Build and Package
run: |
cmake --build build --target package -- -j4
# Exclude tests requiring X Display
- name: Test
run: |
cd build
ctest -LE XDisplayRequired --output-on-failure
- name: Publish packages
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: macos-packages
path: build/CTKAppLauncher-*.tar.gz
pass: # This job does nothing and is only used for the branch protection
if: always()
needs:
- changes
- linux-tests
- macos-tests
- win-tests
runs-on: ubuntu-latest
steps:
- name: Validate paths-to-include value
run: |
value="${{ needs.changes.outputs.paths-to-include }}"
echo "paths-to-include = '$value'"
if [[ "$value" != "true" && "$value" != "false" ]]; then
echo "::error::Invalid paths-to-include value: '$value'. Expected 'true' or 'false'."
exit 1
fi
- name: Set allowed skips
id: allow
run: |
if [[ "${{ needs.changes.outputs.paths-to-include }}" != "true" ]]; then
echo "value=[\"win-tests\",\"linux-tests\",\"macos-tests\"]" >> $GITHUB_OUTPUT
else
echo "value=[]" >> $GITHUB_OUTPUT
fi
- name: Show job results
run: |
echo "paths-to-include = ${{ needs.changes.outputs.paths-to-include }}"
echo "win-tests result = ${{ needs.win-tests.result }}"
echo "linux-tests result = ${{ needs.linux-tests.result }}"
echo "macos-tests result = ${{ needs.macos-tests.result }}"
echo "allowed-skips value = ${{ steps.allow.outputs.value }}"
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@2765efec08f0fd63e83ad900f5fd75646be69ff6 # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
# Allow test jobs to be skipped when the 'paths-to-include' filter determined
# that no relevant files were modified (e.g., only docs or README changed).
# This ensures the 'pass' job still succeeds and branch protection is satisfied.
allowed-skips: ${{ steps.allow.outputs.value }}