-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (228 loc) · 9.18 KB
/
Copy pathtest.yml
File metadata and controls
271 lines (228 loc) · 9.18 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
name: Test
on:
push:
paths-ignore:
- 'README.md'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'doc/**'
- 'github/workflows/publish.yml'
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
hosts: ${{ steps.matrix.outputs.hosts }}
containers: ${{ steps.matrix.outputs.containers }}
steps:
- name: Define Matrix
id: matrix
shell: python
run: |
import json
import os
cxx_standards = [20, 23]
macos_map = {
'macos-14': "15.4",
'macos-15': "16.2",
'macos-26': "26.2"
}
win_paltforms = ["x64", "Win32"]
win_clang_archs = ["x64", "x86"]
gcc_map = {
11: 'ubuntu-latest',
12: 'ubuntu-latest',
13: 'ubuntu-latest',
14: 'ubuntu-24.04'
}
gcc_cont_map = {
15: 'gcc:15.1'
}
clang_map = {
13: 'ubuntu-22.04',
14: 'ubuntu-22.04',
15: 'ubuntu-22.04',
16: 'ubuntu-22.04',
17: 'ubuntu-latest',
18: 'ubuntu-latest',
19: 'ubuntu-latest',
20: 'ubuntu-latest',
21: 'ubuntu-latest'
}
hosts = []
containers=[]
#macOS
for cxx_standard in cxx_standards:
for runon, xcode in macos_map.items():
hosts.append({'os': runon, 'version': xcode, 'cxx_standard': cxx_standard, 'jobname': f'macOS - Xcode{xcode} - C++{cxx_standard}'})
#windows
for cxx_standard in cxx_standards:
for platform in win_paltforms:
hosts.append({'os': 'windows-latest', 'platform': platform, 'cxx_standard': cxx_standard, 'jobname': f'Windows - {platform} - C++{cxx_standard}'})
for arch in win_clang_archs:
hosts.append({'os': 'windows-latest', 'arch': arch, 'compiler': 'clang-cl', 'cxx_standard': cxx_standard, 'jobname': f'Windows - clang - {arch} - C++{cxx_standard}'})
#gcc hosts
for gcc, runon in gcc_map.items():
for cxx_standard in cxx_standards:
if gcc < 13 and cxx_standard == 23:
continue
hosts.append({'os': runon, 'compiler': 'gcc', 'version': gcc, 'cxx_standard': cxx_standard,
'jobname': f'Linux - GCC{gcc} - C++{cxx_standard}'})
#gcc containers
for gcc, container in gcc_cont_map.items():
for cxx_standard in cxx_standards:
if gcc < 13 and cxx_standard == 23:
continue
containers.append({'container': container, 'cxx_standard': cxx_standard,
'jobname': f'Linux - GCC{gcc} - C++{cxx_standard}'})
#clang
for clang, runon in clang_map.items():
for cxx_standard in cxx_standards:
if clang < 18 and cxx_standard == 23:
continue
hosts.append({'os': runon, 'compiler': 'clang', 'version': clang, 'cxx_standard': cxx_standard,
'jobname': f'Linux - Clang{clang} - C++{cxx_standard}'})
with open(os.environ['GITHUB_OUTPUT'], 'w') as env:
print('hosts=' + json.dumps(hosts), file=env)
print('containers=' + json.dumps(containers), 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
fi
if [[ '${{ matrix.os }}' == macos-* ]]; then
echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.version }}.app" >> $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=-GNinja" >> $GITHUB_ENV
fi
fi
CMAKE_ARGS=(-DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} -DCMAKE_CXX_STANDARD_REQUIRED=ON)
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=Release
- name: Build and Test
shell: bash
run: cmake --build out --config Release --target run-test samples
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: System Setup
shell: bash
run: |
apt-get update
apt-get install -y ninja-build cmake locales
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
locale-gen
- name: Configure
shell: bash
run: |
export EXTRA_FLAGS="-DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} -DCMAKE_CXX_STANDARD_REQUIRED=ON"
cmake -S . -B out $EXTRA_FLAGS -DCMAKE_BUILD_TYPE=Release
- name: Build and Test
shell: bash
run: |
cmake --build out --config Release --target run-test samples
android:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [25.2.9519653]
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=Release -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_SDK_ROOT/ndk/${{ matrix.version }}/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=${{ matrix.arch }} -DANDROID_PLATFORM:STRING=${{ matrix.api }} -DANDROID_STL:STRING=c++_static
echo "::endgroup::"
echo "::group::Build and Test"
cmake --build out --config Release --target run-test samples
echo "::endgroup::"