-
Notifications
You must be signed in to change notification settings - Fork 0
387 lines (328 loc) · 12.5 KB
/
test.yml
File metadata and controls
387 lines (328 loc) · 12.5 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
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
name: Test
on:
push:
branches:
- '*'
- '*/**'
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- 'LICENSE'
- 'doc/**'
- 'tools/**'
workflow_dispatch:
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
hosts: ${{ steps.matrix.outputs.hosts }}
containers: ${{ steps.matrix.outputs.containers }}
emscriptens: ${{ steps.matrix.outputs.emscriptens }}
steps:
- name: Define Matrix
id: matrix
shell: python
run: |
import json
import os
macos_map = {
'macos-14': "15.4",
'macos-15': "16.4",
'macos-26': "26.2"
}
win_paltforms = ["x64", "Win32"]
win_clang_archs = ["x64", "x86"]
gcc_map = {
12: 'ubuntu-latest',
13: 'ubuntu-latest',
14: 'ubuntu-24.04'
}
gcc_cont_map = {
15: 'gcc:15.1'
}
clang_map = {
16: 'ubuntu-22.04',
17: 'ubuntu-latest',
18: 'ubuntu-latest',
19: 'ubuntu-latest',
20: 'ubuntu-latest',
21: 'ubuntu-latest'
}
emscripten_versions = [
'3.1.74',
'4.0.22',
'5.0.0'
]
hosts = []
containers=[]
emscriptens=[]
#macOS
for runon, xcode in macos_map.items():
hosts.append({'os': runon, 'version': xcode, 'jobname': f'macOS - Xcode{xcode}'})
#windows
for platform in win_paltforms:
hosts.append({'os': 'windows-latest', 'platform': platform, 'nopython': platform == "Win32", 'jobname': f'Windows - {platform}'})
for arch in win_clang_archs:
hosts.append({'os': 'windows-latest', 'arch': arch, 'compiler': 'clang-cl', 'nopython': arch == "x86", 'jobname': f'Windows - clang - {arch}'})
#gcc hosts
for gcc, runon in gcc_map.items():
hosts.append({'os': runon, 'compiler': 'gcc', 'version': gcc, 'jobname': f'Linux - GCC{gcc}'})
#gcc containers
for gcc, container in gcc_cont_map.items():
containers.append({'container': container, 'jobname': f'Linux - GCC{gcc}'})
#clang
for clang, runon in clang_map.items():
hosts.append({'os': runon, 'compiler': 'clang', 'version': clang, 'jobname': f'Linux - Clang{clang}'})
#emscripten
for emscripten in emscripten_versions:
emscriptens.append({'version': emscripten, 'jobname': f'Emscripten - {emscripten}'})
with open(os.environ['GITHUB_OUTPUT'], 'w') as env:
print('hosts=' + json.dumps(hosts), file=env)
print('containers=' + json.dumps(containers), file=env)
print('emscriptens=' + json.dumps(emscriptens), file=env)
desktop:
needs: define-matrix
name: ${{ matrix.jobname }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define-matrix.outputs.hosts) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: System Setup
shell: bash
run: |
if [[ '${{ matrix.os }}' == ubuntu-* ]]; then
if [[ '${{ matrix.compiler }}' == 'clang' ]]; then
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh ${{ matrix.version }}
sudo apt-get install -y clang-tools-${{ matrix.version }} libc++-${{ matrix.version }}-dev libc++abi-${{ matrix.version }}-dev
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
fi
if [[ '${{ matrix.compiler }}' == 'gcc' ]]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.version }} g++-${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
fi
mkdir bin
wget -qO- https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip | \
gunzip > bin/ninja
chmod a+x bin/ninja
echo PATH=`pwd`/bin:$PATH >> $GITHUB_ENV
echo "CMAKE_GENERATOR=-GNinja" >> $GITHUB_ENV
# wget https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz
# tar -xzf icu4c-76_1-src.tgz
# cd icu/source
# ./configure --prefix $GITHUB_WORKSPACE/icu_root \
# --enable-static=no \
# --enable-shared=yes \
# --enable-extras=no \
# --enable-icuio=no \
# --enable-tests=no \
# --enable-samples=no \
# --enable-tools=yes \
# --with-data-packaging=library
# make -j `nproc`
# make install
# echo "ICU_ROOT=$GITHUB_WORKSPACE/icu_root" >> $GITHUB_ENV
# echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu_root/lib" >> $GITHUB_ENV
fi
if [[ '${{ matrix.os }}' == macos-* ]]; then
brew install icu4c
echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.version }}.app" >> $GITHUB_ENV
echo "ICU_ROOT=$(brew --cellar icu4c)/$(brew info --json icu4c | jq -r '.[0].installed[0].version')" >> $GITHUB_ENV
fi
if [[ '${{ matrix.os }}' == windows-* ]]; then
if [[ '${{ matrix.compiler }}' != '' ]]; then
if [[ '${{ matrix.arch }}' == "x64" ]]; then
VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\x64\\bin"
else
VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\bin"
fi
echo "CC=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CXX=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
fi
fi
CMAKE_ARGS=( )
if [[ '${{ matrix.platform }}' != "" ]]; then
CMAKE_ARGS+=(-DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform }})
fi
if [[ ${#CMAKE_ARGS[@]} != 0 ]]; then
echo "CMAKE_ARGS=${CMAKE_ARGS[@]}" >> $GITHUB_ENV
fi
- name: Configure
shell: bash
run: |
cmake $CMAKE_GENERATOR -S . -B out $CMAKE_ARGS -DCMAKE_BUILD_TYPE=MinSizeRel
if [[ '${{ matrix.os }}' == windows-* ]]; then
if [ -f out/test/pythonloc.txt ]; then
pythloc=$(cat out/test/pythonloc.txt)
echo "$pythloc" >> $GITHUB_PATH
fi
fi
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
container:
needs: define-matrix
name: ${{ matrix.jobname }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define-matrix.outputs.containers) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -y ninja-build cmake
apt-get install -y python3-dev
- name: Configure
shell: bash
run: |
cmake -GNinja -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
big-endian:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
run: |
sudo apt-get update
sudo apt-get install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu qemu-user-binfmt
- name: Configure
run: |
export CC=powerpc-linux-gnu-gcc
export CXX=powerpc-linux-gnu-g++
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_SYSTEM_PROCESSOR=powerpc
- name: Build and Test
shell: bash
run: |
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
cmake --build out --config MinSizeRel --target run-test
android:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [27.2.12479018]
api: [29, 30]
arch: [x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.version }}-${{ matrix.arch }}-${{ matrix.api }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.arch }}
target: google_apis
ndk: ${{ matrix.version }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Configure, Build and Test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.arch }}
target: google_apis
ndk: ${{ matrix.version }}
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: true
script: |
echo "::group::Configure"
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
echo "::endgroup::"
echo "::group::Build and Test"
cmake --build out --config MinSizeRel --target run-test
echo "::endgroup::"
emscripten:
needs: define-matrix
name: ${{ matrix.jobname }}
runs-on: ubuntu-latest
container: emscripten/emsdk:${{ matrix.version }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define-matrix.outputs.emscriptens) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -y ninja-build
apt-get install -y python3-dev
export CMAKE_VERSION=3.27.1
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& /tmp/cmake-install.sh --skip-license --prefix=/usr \
rm -f /tmp/cmake-install.sh
- name: Configure
shell: bash
run: cmake -GNinja -S . -B out -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
pythons:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14",
"pypy-3.9", "pypy-3.10", "pypy-3.11"
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
id: setup-python
with:
python-version: ${{matrix.python-version}}
- name: Configure
shell: bash
run: |
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: |
cmake --build out --config MinSizeRel --target test-20python test-23python
echo Running test-20python
out/test/test-20python -ni -fc
echo Running test-23python
out/test/test-23python -ni -fc