-
Notifications
You must be signed in to change notification settings - Fork 277
281 lines (250 loc) · 9.9 KB
/
matrix.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
name: General build matrix
on:
push:
branches:
- upload
paths-ignore:
- doc/**
- 'scripts/**'
merge_group:
pull_request:
branches:
- upload
paths-ignore:
- doc/**
- 'scripts/**'
# Cancel all previous instances in favor of latest revision of a PR.
# Allow running upload builds to complete to help with ccache refreshes.
concurrency:
group: general-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
skip-duplicates-code:
continue-on-error: true
runs-on: ubuntu-22.04
# Map a step output to a job output
outputs:
should_skip_code: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "msvc-**", "tools/**", "utilities/**", "scripts/**", "data/**", "lang/**"]'
skip-duplicates-data:
continue-on-error: true
runs-on: ubuntu-22.04
# Map a step output to a job output
outputs:
should_skip_data: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "msvc-**", "tools/**", "utilities/**", "scripts/**"]'
matrix-variables:
permissions:
contents: none
continue-on-error: true
runs-on: ubuntu-latest
outputs:
fail_fast: ${{ steps.matrix_vars.outputs.fail_fast }}
skip_tests: ${{ steps.matrix_vars.outputs.skip_tests }}
max_parallel: ${{ steps.matrix_vars.outputs.max_parallel }}
steps:
- id: matrix_vars
run: |
echo "fail_fast=$([ "$GITHUB_REF_NAME" = "upload" ] && echo false || echo true)" >> $GITHUB_OUTPUT
echo "skip_tests=$([ "$GITHUB_REF_NAME" = "upload" ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "max_parallel=$([ "$GITHUB_REF_NAME" = "upload" ] && echo 20 || echo 1)" >> $GITHUB_OUTPUT
varied_builds:
needs: [ skip-duplicates-code, skip-duplicates-data, matrix-variables ]
strategy:
fail-fast: ${{ fromJSON(needs.matrix-variables.outputs.fail_fast) }}
max-parallel: ${{ fromJSON(needs.matrix-variables.outputs.max_parallel) }}
matrix:
include:
- title: GCC 12, Ubuntu, Curses
compiler: g++-12
os: ubuntu-22.04
cmake: 0
tiles: 0
sound: 0
lua: 0
test-stage: 1
libbacktrace: 1
native: linux64
ccache_limit: 2G
ccache_key: linux-gcc-12
run-on-draft: true
- title: GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages
compiler: g++-12
os: ubuntu-22.04
cmake: 1
tiles: 1
sound: 1
lua: 1
languages: all
native: linux64
ccache_limit: 2G
ccache_key: linux-gcc-12-cmake-tiles
upload-artifact: true
- title: GCC 12, Ubuntu, Tiles, Sound, Lua
compiler: g++-12
os: ubuntu-22.04
cmake: 0
tiles: 1
sound: 1
lua: 1
test-stage: 1
libbacktrace: 1
native: linux64
ccache_limit: 1G
ccache_key: linux-gcc-12-tiles
# === Temporarily disabled because of #3664 ===
# - title: GCC 12, Ubuntu, Tiles, NoSound, ASan
# compiler: g++-12
# os: ubuntu-22.04
# cmake: 0
# tiles: 1
# sound: 0
# lua: 0
# sanitize: address
# native: linux64
# ccache_limit: 2G
# ccache_key: linux-gcc-12-asan
# === Temporarily disabled because of #3664 ===
# - title: Clang 14, Ubuntu, Tiles, NoSound, ASan, UBSan
# compiler: clang++-14
# os: ubuntu-22.04
# cmake: 0
# tiles: 1
# sound: 0
# lua: 0
# sanitize: address,undefined
# cxxflags: --gcc-toolchain=/opt/mock-gcc-11
# native: linux64
# ccache_limit: 2G
# ccache_key: linux-llvm-14-asan
- title: Clang 14, macOS 12, Tiles, Sound, Localize, Lua
compiler: clang++
os: macos-12
cmake: 0
tiles: 1
sound: 1
lua: 1
test-stage: 1
native: osx
grep_clang_version_rxp: "14\\.[0-9]+\\.[0-9]+"
ccache_limit: 1G # avg. 980MB~1100MB
ccache_key: macos-llvm-14
name: ${{ matrix.title }}
runs-on: ${{ matrix.os }}
env:
ZSTD_CLEVEL: 17
CMAKE: ${{ matrix.cmake }}
COMPILER: ${{ matrix.compiler }}
CXXFLAGS: ${{ matrix.cxxflags }}
OS: ${{ matrix.os }}
TILES: ${{ matrix.tiles }}
SOUND: ${{ matrix.sound }}
LUA: ${{ matrix.lua }}
SANITIZE: ${{ matrix.sanitize }}
TEST_STAGE: ${{ matrix.test-stage }}
LANGUAGES: ${{ matrix.languages }}
LIBBACKTRACE: ${{ matrix.libbacktrace }}
NATIVE: ${{ matrix.native }}
RELEASE: 1
CCACHE_LIMIT: ${{ matrix.ccache_limit }}
CCACHE_FILECLONE: true
CCACHE_HARDLINK: true
CCACHE_NOCOMPRESS: true
SKIP: ${{ ( github.event.pull_request.draft == true && matrix.run-on-draft == 'true' ) || ( needs.skip-duplicates-code.outputs.should_skip_code == 'true' ) || ( needs.skip-duplicates-data.outputs.should_skip_data == 'true' ) }}
SKIP_TESTS: ${{ needs.matrix-variables.outputs.skip_tests }}
steps:
- name: checkout repository
if: ${{ env.SKIP == 'false' }}
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: install dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install libncursesw5-dev ccache gettext parallel
sudo locale-gen en_US.UTF-8 fr_FR.UTF-8 ru_RU.UTF-8
- name: install SDL2 dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.tiles == 1 }}
run: |
sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev libflac-dev
- name: check compiler (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
run: |
${{ matrix.compiler }} --version
# Ensure that it is actually needed version
${{ matrix.compiler }} --version | grep -q -E "${{ matrix.grep_clang_version_rxp }}"
- name: set up a mock GCC toolchain root for Clang (Ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && (matrix.compiler == 'clang++-14') }}
run: |
sudo mkdir /opt/mock-gcc-11
sudo ln -s /usr/include /opt/mock-gcc-11/include
sudo ln -s /usr/bin /opt/mock-gcc-11/bin
sudo mkdir -p /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/11 /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu/11
- name: install dependencies (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
- name: prepare
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/requirements.sh
- name: Get ccache vars
id: get-ccache-vars
if: ${{ env.SKIP == 'false' }}
shell: bash
run: |
echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
echo "ccache-path=$([ "$RUNNER_OS" = "macOS" ] && echo '/Users/runner/Library/Caches/ccache' || echo '~/.cache/ccache')" >> $GITHUB_OUTPUT
- name: ccache cache files
if: ${{ env.SKIP == 'false' && ( runner.os == 'Linux' || runner.os == 'macOS' ) }}
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.get-ccache-vars.outputs.ccache-path }}
# double-dash after compiler is not a typo, it is to disambiguate between g++-<date> and g++-11-<date> for restore key prefix matching
key: ccache-${{ github.ref_name }}-${{ matrix.ccache_key }}--${{ steps.get-ccache-vars.outputs.datetime }}
restore-keys: ccache-upload-${{ matrix.ccache_key }}--
- name: ccache info
if: ${{ env.SKIP == 'false' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo CCache failed to restore from cache, emmiting stats
ccache --show-stats --verbose
- uses: ammaraskar/gcc-problem-matcher@master
- name: build
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/gha_compile_only.sh
- name: post-build ccache stats and cleanup
if: ${{ env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: |
ccache --show-stats --verbose
ccache --max-size ${{ env.CCACHE_LIMIT }}
ccache --cleanup
ccache --show-stats --verbose
- name: clear ccache on PRs
if: ${{ github.ref_name != 'upload' && env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: ccache --clear
- name: run tests
if: ${{ env.SKIP == 'false' && env.SKIP_TESTS == 'false' }}
run: bash ./build-scripts/gha_test_only.sh
- name: emit success artifact
if: ${{ success() && matrix.upload-artifact == 'true' }}
uses: actions/[email protected]
with:
name: ${{ github.event.number }}
path: ${{ github.event.number }}
- name: upload artifacts if failed
uses: actions/[email protected]
if: failure()
with:
name: cata_test
path: tests/cata_test
if-no-files-found: ignore