Skip to content

Commit 06aba1d

Browse files
committed
Expanding test matrix
1 parent a2e605c commit 06aba1d

1 file changed

Lines changed: 106 additions & 32 deletions

File tree

.github/workflows/test.yml

Lines changed: 106 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,86 @@ on:
1313
- 'doc/**'
1414
- 'tools/**'
1515

16-
env:
17-
BUILD_TYPE: MinSizeRel
18-
1916
jobs:
17+
define-matrix:
18+
runs-on: ubuntu-latest
19+
20+
outputs:
21+
hosts: ${{ steps.matrix.outputs.hosts }}
22+
containers: ${{ steps.matrix.outputs.containers }}
23+
24+
steps:
25+
- name: Define Matrix
26+
id: matrix
27+
shell: python
28+
run: |
29+
import json
30+
import os
31+
32+
macos_map = {
33+
'macos-14': "15.4",
34+
'macos-15': "16.2"
35+
}
36+
37+
win_paltforms = ["x64", "Win32"]
38+
win_clang_archs = ["x64", "x86"]
39+
40+
gcc_map = {
41+
12: 'ubuntu-latest',
42+
13: 'ubuntu-latest',
43+
14: 'ubuntu-24.04'
44+
}
45+
gcc_cont_map = {
46+
15: 'gcc:15.1'
47+
}
48+
clang_map = {
49+
16: 'ubuntu-22.04',
50+
17: 'ubuntu-latest',
51+
18: 'ubuntu-latest',
52+
19: 'ubuntu-latest',
53+
20: 'ubuntu-latest',
54+
21: 'ubuntu-latest'
55+
}
56+
57+
hosts = []
58+
containers=[]
59+
60+
#macOS
61+
for runon, xcode in macos_map.items():
62+
hosts.append({'os': runon, 'version': xcode, 'jobname': f'macOS - Xcode{xcode}'})
63+
64+
#windows
65+
for platform in win_paltforms:
66+
hosts.append({'os': 'windows-latest', 'platform': platform, 'nopython': platform == "Win32", 'jobname': f'Windows - {platform}'})
67+
68+
for arch in win_clang_archs:
69+
hosts.append({'os': 'windows-latest', 'arch': arch, 'compiler': 'clang-cl', 'nopython': arch == "x86", 'jobname': f'Windows - clang - {arch}'})
70+
71+
#gcc hosts
72+
for gcc, runon in gcc_map.items():
73+
hosts.append({'os': runon, 'compiler': 'gcc', 'version': gcc, 'jobname': f'Linux - GCC{gcc}'})
74+
75+
#gcc containers
76+
for gcc, container in gcc_cont_map.items():
77+
containers.append({'container': container, 'jobname': f'Linux - GCC{gcc}'})
78+
79+
80+
#clang
81+
for clang, runon in clang_map.items():
82+
hosts.append({'os': runon, 'compiler': 'clang', 'version': clang, 'jobname': f'Linux - Clang{clang}'})
83+
84+
with open(os.environ['GITHUB_OUTPUT'], 'w') as env:
85+
print('hosts=' + json.dumps(hosts), file=env)
86+
print('containers=' + json.dumps(containers), file=env)
87+
2088
desktop:
89+
needs: define-matrix
90+
name: ${{ matrix.jobname }}
2191
runs-on: ${{ matrix.os }}
2292
strategy:
2393
fail-fast: false
2494
matrix:
25-
include:
26-
- {os: macos-15, version: 16 }
27-
- {os: macos-14, version: "15.4" }
28-
29-
- os: windows-latest
30-
31-
- {os: ubuntu-latest, compiler: gcc, version: 12 }
32-
- {os: ubuntu-latest, compiler: gcc, version: 13 }
33-
- {os: ubuntu-24.04, compiler: gcc, version: 14 }
34-
#- {os: ubuntu-24.04, compiler: gcc, version: 15 }
35-
36-
- {os: ubuntu-22.04, compiler: clang, version: 16 }
37-
- {os: ubuntu-latest, compiler: clang, version: 17 }
38-
- {os: ubuntu-latest, compiler: clang, version: 18 }
39-
- {os: ubuntu-latest, compiler: clang, version: 19 }
40-
- {os: ubuntu-latest, compiler: clang, version: 20 }
95+
include: ${{ fromJSON(needs.define-matrix.outputs.hosts) }}
4196

4297
steps:
4398
- name: Checkout
@@ -65,6 +120,13 @@ jobs:
65120
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
66121
fi
67122
123+
mkdir bin
124+
wget -qO- https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip | \
125+
gunzip > bin/ninja
126+
chmod a+x bin/ninja
127+
echo PATH=`pwd`/bin:$PATH >> $GITHUB_ENV
128+
echo "CMAKE_GENERATOR=-GNinja" >> $GITHUB_ENV
129+
68130
# wget https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz
69131
# tar -xzf icu4c-76_1-src.tgz
70132
# cd icu/source
@@ -88,22 +150,34 @@ jobs:
88150
echo "ICU_ROOT=$(brew --cellar icu4c)/$(brew info --json icu4c | jq -r '.[0].installed[0].version')" >> $GITHUB_ENV
89151
fi
90152
153+
CMAKE_ARGS=( )
154+
155+
if [[ '${{ matrix.platform }}' != "" ]]; then
156+
CMAKE_ARGS+=(-DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform }})
157+
fi
158+
159+
if [[ ${#CMAKE_ARGS[@]} != 0 ]]; then
160+
echo "CMAKE_ARGS=${CMAKE_ARGS[@]}" >> $GITHUB_ENV
161+
fi
162+
91163
- name: Configure
92164
shell: bash
93165
run: |
94-
cmake -S . -B out -DCMAKE_BUILD_TYPE=$BUILD_TYPE
166+
cmake $CMAKE_GENERATOR -S . -B out $CMAKE_ARGS -DCMAKE_BUILD_TYPE=MinSizeRel
95167
96168
- name: Build and Test
97169
shell: bash
98-
run: cmake --build out --config $BUILD_TYPE --target run-test
170+
run: cmake --build out --config MinSizeRel --target run-test
99171

100172
container:
173+
needs: define-matrix
174+
name: ${{ matrix.jobname }}
101175
runs-on: ubuntu-latest
102176
container: ${{ matrix.container }}
103177
strategy:
104178
fail-fast: false
105179
matrix:
106-
container: [gcc:15.1]
180+
include: ${{ fromJSON(needs.define-matrix.outputs.containers) }}
107181

108182
steps:
109183
- name: Checkout
@@ -118,11 +192,11 @@ jobs:
118192
- name: Configure
119193
shell: bash
120194
run: |
121-
cmake -S . -B out -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
195+
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
122196
123197
- name: Build and Test
124198
shell: bash
125-
run: cmake --build out --config ${{env.BUILD_TYPE}} --target run-test
199+
run: cmake --build out --config MinSizeRel --target run-test
126200

127201

128202
big-endian:
@@ -142,13 +216,13 @@ jobs:
142216
export CC=powerpc-linux-gnu-gcc
143217
export CXX=powerpc-linux-gnu-g++
144218
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
145-
cmake -S . -B out -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_SYSTEM_PROCESSOR=powerpc
219+
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_SYSTEM_PROCESSOR=powerpc
146220
147221
- name: Build and Test
148222
shell: bash
149223
run: |
150224
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
151-
cmake --build out --config ${{env.BUILD_TYPE}} --target run-test
225+
cmake --build out --config MinSizeRel --target run-test
152226
153227
android:
154228
runs-on: ubuntu-latest
@@ -202,10 +276,10 @@ jobs:
202276
disable-animations: true
203277
script: |
204278
echo "::group::Configure"
205-
cmake -S . -B out -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_SDK_ROOT/ndk/${{ matrix.version }}/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=${{ matrix.arch }} -DANDROID_PLATFORM:STRING=${{ matrix.version }} -DANDROID_STL:STRING=c++_static
279+
cmake -S . -B out -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_SDK_ROOT/ndk/${{ matrix.version }}/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=${{ matrix.arch }} -DANDROID_PLATFORM:STRING=${{ matrix.version }} -DANDROID_STL:STRING=c++_static
206280
echo "::endgroup::"
207281
echo "::group::Build and Test"
208-
cmake --build out --config $BUILD_TYPE --target run-test
282+
cmake --build out --config MinSizeRel --target run-test
209283
echo "::endgroup::"
210284
211285
emscripten:
@@ -231,12 +305,12 @@ jobs:
231305
232306
- name: Configure
233307
shell: bash
234-
run: cmake -S . -B out -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
308+
run: cmake -S . -B out -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=MinSizeRel
235309

236310

237311
- name: Build and Test
238312
shell: bash
239-
run: cmake --build out --config ${{env.BUILD_TYPE}} --target run-test
313+
run: cmake --build out --config MinSizeRel --target run-test
240314

241315
pythons:
242316
runs-on: ubuntu-latest
@@ -260,12 +334,12 @@ jobs:
260334
- name: Configure
261335
shell: bash
262336
run: |
263-
cmake -S . -B out -DCMAKE_BUILD_TYPE=$BUILD_TYPE
337+
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
264338
265339
- name: Build and Test
266340
shell: bash
267341
run: |
268-
cmake --build out --config $BUILD_TYPE --target test-20python test-23python
342+
cmake --build out --config MinSizeRel --target test-20python test-23python
269343
echo Running test-20python
270344
out/test/test-20python -ni -fc
271345
echo Running test-23python

0 commit comments

Comments
 (0)