forked from OpenRCT2/OpenRCT2
-
Notifications
You must be signed in to change notification settings - Fork 0
476 lines (473 loc) · 17.7 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
name: CI
on:
push:
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.github/*_TEMPLATE/**'
- '.github/workflows/localisation.yml'
- '.gitignore'
- '.vscode/**'
pull_request:
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.github/*_TEMPLATE/**'
- '.github/workflows/localisation.yml'
- '.gitignore'
- '.vscode/**'
defaults:
run:
shell: bash
env:
OPENRCT2_BUILD_SERVER: GitHub
OPENRCT2_ORG_TOKEN: ${{ secrets.OPENRCT2_ORG_TOKEN }}
BACKTRACE_IO_TOKEN: ${{ secrets.BACKTRACE_IO_TOKEN }}
OPENRCT2_VERSION: 0.4.5
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint-commit:
name: Lint Commit Message
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Commit Messages
uses: wagoid/commitlint-github-action@v5
with:
configFile: .commitlint.json
check-code-formatting:
name: Check code formatting
runs-on: ubuntu-latest
container: openrct2/openrct2-build:4-format
defaults:
run:
shell: sh
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run clang-format
run: scripts/check-code-formatting
windows:
name: Windows
runs-on: windows-latest
needs: check-code-formatting
strategy:
fail-fast: false
matrix:
platform: [win32, x64, arm64]
env:
PLATFORM: ${{ matrix.platform }}
steps:
- name: Setup environment
run: |
BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)
if [[ $BRANCH == 'develop' || $BRANCH == 'master' ]]; then
echo "CONFIGURATION=ReleaseLTCG" >> "$GITHUB_ENV"
else
echo "CONFIGURATION=Release" >> "$GITHUB_ENV"
fi
- name: Checkout
uses: actions/checkout@v3
- name: Git describe for shallow checkout
id: ghd
uses: proudust/gh-describe@v1
- name: Update GA environment
run: echo "OPENRCT2_DESCRIBE=${{ steps.ghd.outputs.describe }}" >> $GITHUB_ENV
- name: Install MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master
- name: Build OpenRCT2
run: . scripts/setenv && build
- name: Build artifacts
run: |
. scripts/setenv -q
build-portable
build-symbols
build-installer -i
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.platform }}
path: artifacts
if-no-files-found: error
- name: Run Tests
if: matrix.platform != 'arm64'
run: . scripts/setenv -q && run-tests
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "artifacts/test-**.xml"
if: matrix.platform != 'arm64'
- name: Upload artifacts (openrct2.org)
run: |
. scripts/setenv
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM.exe" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-backtrace-symbols artifacts/openrct2-symbols-*.zip
else
echo 'Not going to push build'
fi
windows-mingw:
name: Windows (${{ matrix.platform_name }}) using mingw
runs-on: ubuntu-latest
needs: check-code-formatting
container: openrct2/openrct2-build:11-mingw
strategy:
fail-fast: false
matrix:
platform: [win32]
include:
- platform: win32
platform_name: win32
cache_key: windows-mingw
build_flags: -DBUILD_SHARED_LIBS=ON -DENABLE_SCRIPTING=ON
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.cache_key }}
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: |
sudo su
cmake -B bin -G Ninja -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Release -DDISABLE_IPO=on -DFORCE32=on ${{ matrix.build_flags }}
cd bin
ninja -k0
- name: Upload artifacts (CI)
if: matrix.platform == 'NT5.1'
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-Windows-${{ matrix.platform }}
path: bin/openrct2.exe
if-no-files-found: error
macos-cmake:
name: macOS (${{ matrix.arch }}) using CMake
runs-on: macos-latest
needs: check-code-formatting
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
include:
- arch: x64
cache_key: macos-x64
# Note: only build/run tests on the native architecture of the CI agent
# GitHub macos-latest agents are currently all Intel
build_flags: -DARCH="x86_64" -DWITH_TESTS=on
run_tests: true
- arch: arm64
cache_key: macos-arm64
build_flags: -DARCH="arm64"
run_tests: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.cache_key }}
- name: Configure ccache
run: |
# See https://github.com/hendrikmuhs/ccache-action/issues/146
ccache --set-config=compiler_check=content
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: |
HOMEBREW_NO_ANALYTICS=1 brew install ninja pkg-config
. scripts/setenv -q && build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=on ${{ matrix.build_flags }}
- name: Run Tests
if: ${{matrix.run_tests}}
run: . scripts/setenv -q && run-tests
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "artifacts/test-**.xml"
if: ${{matrix.run_tests}}
- name: Build artifacts
run: |
. scripts/setenv
mkdir -p artifacts
mv bin/OpenRCT2.app artifacts
echo -e "\033[0;36mCompressing OpenRCT2.app...\033[0m"
cd artifacts
zip -rqy openrct2-macos.zip OpenRCT2.app
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.arch }}-cmake
path: artifacts/openrct2-macos.zip
if-no-files-found: error
macos-universal:
name: macOS universal app bundle
runs-on: macos-latest
needs: macos-cmake
steps:
- name: Checkout
uses: actions/checkout@v3
- name: download x64 app bundle
uses: actions/download-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-x64-cmake
path: macos_universal/x64
- name: download arm64 app bundle
uses: actions/download-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-arm64-cmake
path: macos_universal/arm64
- name: Make Universal app bundle
run: |
. scripts/setenv
cd macos_universal
unzip x64/openrct2-macos.zip -d x64
unzip arm64/openrct2-macos.zip -d arm64
create-macos-universal
- name: Create artifact
run: |
. scripts/setenv
mkdir -p artifacts
mv macos_universal/OpenRCT2-universal.app artifacts/OpenRCT2.app
echo -e "\033[0;36mCompressing OpenRCT2.app...\033[0m"
cd artifacts
zip -rqy openrct2-macos.zip OpenRCT2.app
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-universal
path: artifacts/openrct2-macos.zip
if-no-files-found: error
- name: Upload artifacts (openrct2.org)
run: |
. scripts/setenv
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-macos.zip macos-universal.zip $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
linux-portable:
name: Linux (${{ matrix.platform }}, ${{ matrix.distro }}, portable)
runs-on: ubuntu-latest
needs: check-code-formatting
container: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
include:
# Use `-fno-var-tracking-assignments` to reduce amount of produced debug information. This is necessary due to 100MiB limit of GitHub / openrct2.org API.
# For focal the debug information still takes too much space, so reduce amount of debug info to minimum using `-g1` (`-g` means `-g2`), which is enough for backtraces only.
- platform: x86_64
distro: bionic
image: openrct2/openrct2-build:4-bionic
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON
- platform: x86_64
distro: focal
image: openrct2/openrct2-build:11-focal
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g1 -gz" -DWITH_TESTS=off
- platform: x86_64
distro: jammy
image: openrct2/openrct2-build:11-jammy
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments"
- platform: x86_64
distro: bullseye
image: openrct2/openrct2-build:11-bullseye
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off
- platform: i686
distro: focal
image: openrct2/openrct2-build:11-focal32
build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g1 -gz" -DWITH_TESTS=off
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-${{ matrix.platform }}-${{ matrix.distro }}
- name: Get pre-reqs
run: . scripts/setenv && get-discord-rpc
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: . scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON ${{ matrix.build_flags }}
- name: Build artifacts
run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz bin/install/usr
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}
path: artifacts
if-no-files-found: error
- name: Run Tests
run: . scripts/setenv -q && run-tests
- name: Upload artifacts (openrct2.org)
run: |
# Build identification code: https://github.com/Limetric/OpenRCT2.org/blob/e5b738f3dadcc5a3b78e8dfd434756ff31eaa1d3/src/misc/releaseAsset.js#L94-L116
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz linux-${{ matrix.platform }}-${{ matrix.distro }}.tar.gz $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
linux-appimage:
name: Linux (x86_64, AppImage)
runs-on: ubuntu-latest
needs: check-code-formatting
container: openrct2/openrct2-build:11-focal
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-appimage
- name: Get pre-reqs
run: . scripts/setenv -q && get-discord-rpc
- name: Build OpenRCT2
run: . scripts/setenv -q && build -DCMAKE_BUILD_TYPE=Release -DAPPIMAGE=ON -DOPENRCT2_USE_CCACHE=on
- name: Build AppImage
run: . scripts/setenv -q && build-appimage
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-AppImage
path: artifacts
if-no-files-found: error
- name: Upload artifacts (openrct2.org)
run: |
# Build identification code: https://github.com/Limetric/OpenRCT2.org/blob/e5b738f3dadcc5a3b78e8dfd434756ff31eaa1d3/src/misc/releaseAsset.js#L94-L116
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/OpenRCT2-x86_64.AppImage linux.AppImage $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
linux-docker:
name: Linux (docker)
needs: check-code-formatting
if: github.repository == 'OpenRCT2/OpenRCT2'
runs-on: ubuntu-latest
steps:
- name: Checkout image
uses: actions/checkout@v3
with:
repository: OpenRCT2/openrct2-docker
- name: Build image
run: docker build -t openrct2/openrct2-cli:develop develop/cli
- name: Push image
env:
OPENRCT2_DOCKER_USER: ${{ secrets.OPENRCT2_DOCKER_USER }}
OPENRCT2_DOCKER_PASS: ${{ secrets.OPENRCT2_DOCKER_PASS }}
run: |
OPENRCT2_BRANCH=$(echo "$GITHUB_REF" | sed 's/refs\/heads\///')
echo "Current branch is $OPENRCT2_BRANCH"
if [ "$OPENRCT2_BRANCH" = 'develop' ]; then
docker login -u "$OPENRCT2_DOCKER_USER" -p "$OPENRCT2_DOCKER_PASS"
docker push openrct2/openrct2-cli:develop
else
echo 'Image not pushed'
fi
linux-clang:
name: Linux (Debug, [http, network, flac, vorbis OpenGL] disabled) using clang
runs-on: ubuntu-latest
needs: check-code-formatting
container: openrct2/openrct2-build:11-jammy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-clang
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP=ON -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON -DDISABLE_OPENGL=ON
linux-clang-tests:
name: Linux (Debug) using clang, coverage enabled
runs-on: ubuntu-latest
needs: check-code-formatting
container: openrct2/openrct2-build:11-jammy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: linux-clang
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" -DWITH_TESTS=on
- name: Run Tests
run: . scripts/setenv -q && LLVM_PROFILE_FILE="openrct2-coverage-%p.profraw" run-tests
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "artifacts/test-**.xml"
if: always()
- name: Process coverage information
run: |
cd bin
llvm-profdata merge -sparse openrct2-coverage*profraw -o openrct2.profdata
llvm-cov export -instr-profile=openrct2.profdata ./OpenRCT2Tests > coverage.json
llvm-cov report ./OpenRCT2Tests -instr-profile=openrct2.profdata
xz -1v openrct2.profdata
xz -1v coverage.json
xz -1v OpenRCT2Tests
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-coverage
path: |
bin/*profdata*
bin/coverage.json*
bin/OpenRCT2Tests.xz
if-no-files-found: error
android:
name: Android
runs-on: ubuntu-latest
needs: check-code-formatting
container: openrct2/openrct2-build:11-android
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: android
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build OpenRCT2
run: |
. scripts/setenv
pushd src/openrct2-android
./gradlew app:assembleRelease
popd
mkdir -p artifacts
mv src/openrct2-android/app/build/outputs/apk/release/app-release.apk artifacts/openrct2-arm.apk
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-Android
path: artifacts
if-no-files-found: error
- name: Upload artifacts (openrct2.org)
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-arm.apk android-arm.apk $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi