-
-
Notifications
You must be signed in to change notification settings - Fork 50
338 lines (301 loc) · 10.9 KB
/
build.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
name: Build
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
verbose:
description: "Enable verbose logging during tests"
type: choice
required: false
default: "false"
options:
- "true"
- "false"
#concurrency:
# group: ${{ github.ref }}
# cancel-in-progress: true
jobs:
verify-formatting:
name: Verify Formatting
runs-on: ubuntu-24.04
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Verify Formatting
uses: jidicula/clang-format-action@v4.14.0
with:
clang-format-version: '19'
check-path: 'src'
create-emulation-root:
name: Create Emulation Root
runs-on: ${{ matrix.runner }}
needs: [build]
strategy:
fail-fast: false
matrix:
platform:
- Windows 2025
- Windows 2022
- Windows 2019
include:
- platform: Windows 2025
runner: windows-2025
- platform: Windows 2022
runner: windows-2022
- platform: Windows 2019
runner: windows-2019
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Download DirectX Runtime
run: curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 40 -L -o directx_Jun2010_redist.exe https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe
- name: Extract DirectX Runtime
run: ./directx_Jun2010_redist.exe /Q /T:"${{github.workspace}}/dxrt"
- name: Install DirectX Runtime
run: "cmd /c \"start /wait .\\dxrt\\dxsetup.exe /silent\""
- name: Download Windows Artifacts
uses: pyTooling/download-artifact@v4
with:
name: Windows x86_64 Release Artifacts
path: build/release/artifacts
- name: Create Emulation Root
run: src/tools/create-root.bat
- name: Dump API Set
run: cd root && ../build/release/artifacts/dump-apiset.exe
- name: Upload Artifacts
uses: pyTooling/upload-artifact@v4
with:
name: ${{ matrix.platform }} Emulation Root
path: "*"
working-directory: root
retention-days: 1
build:
name: Build
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
platform:
- Windows x86_64
- Linux x86_64 GCC
- Linux x86_64 Clang
- macOS arm64
- macOS x86_64
- Android x86_64
- Android arm64-v8a
configuration:
- Debug
- Release
include:
- configuration: Debug
preset: debug
- configuration: Release
preset: release
- platform: Windows x86_64
runner: windows-latest
- platform: Linux x86_64 GCC
runner: ubuntu-24.04
- platform: Linux x86_64 Clang
runner: ubuntu-24.04
clang-version: 18
- platform: macOS arm64
runner: macos-latest
- platform: macOS x86_64
runner: macos-13
- platform: Android x86_64
runner: ubuntu-24.04
abi: x86_64
- platform: Android arm64-v8a
runner: ubuntu-24.04
abi: arm64-v8a
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Install Clang
if: "${{ matrix.platform == 'Linux x86_64 Clang' }}"
run: |
sudo apt update
sudo apt install -y wget gnupg software-properties-common
wget https://apt.llvm.org/llvm-snapshot.gpg.key -O- | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] https://apt.llvm.org/$(lsb_release -sc)/ llvm-toolchain-$(lsb_release -sc)-${{ matrix.clang-version }} main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt install -y clang-${{ matrix.clang-version }} lld-${{ matrix.clang-version }}
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.clang-version }} 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.clang-version }} 100
sudo update-alternatives --set cc /usr/bin/clang-${{ matrix.clang-version }}
sudo update-alternatives --set c++ /usr/bin/clang++-${{ matrix.clang-version }}
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.13.0
if: ${{ startsWith(matrix.platform, 'Windows') }}
- uses: nttld/setup-ndk@v1
id: setup-ndk
if: ${{ startsWith(matrix.platform, 'Android') }}
with:
ndk-version: r26d
add-to-path: false
- name: CMake Build
run: cmake --preset=${{matrix.preset}} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/toolchain/android-ndk.cmake && cmake --build --preset=${{matrix.preset}}
if: ${{ startsWith(matrix.platform, 'Android') }}
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_ABI: ${{matrix.abi}}
- name: CMake Build
run: cmake --workflow --preset=${{matrix.preset}}
if: ${{ !startsWith(matrix.platform, 'Android') }}
- name: Upload Artifacts
uses: pyTooling/upload-artifact@v4
with:
name: ${{ matrix.platform }} ${{matrix.configuration}} Artifacts
working-directory: build/${{matrix.preset}}/artifacts/
path: "*"
- name: Upload Test Configuration
uses: pyTooling/upload-artifact@v4
with:
name: Temp ${{ matrix.platform }} ${{matrix.configuration}} Test Config
path: "**/CTestTestfile.cmake"
working-directory: build/${{matrix.preset}}
test:
name: Test
runs-on: ${{ matrix.runner }}
needs: [create-emulation-root, build]
strategy:
fail-fast: false
matrix:
platform:
- Windows x86_64
- Linux x86_64 GCC
- Linux x86_64 Clang
- macOS arm64
- macOS x86_64
emulation-root:
- Windows 2025
- Windows 2022
- Windows 2019
configuration:
- Debug
- Release
include:
- configuration: Debug
preset: debug
- configuration: Release
preset: release
- platform: Windows x86_64
runner: windows-latest
- platform: Linux x86_64 GCC
runner: ubuntu-24.04
- platform: Linux x86_64 Clang
runner: ubuntu-24.04
- platform: macOS arm64
runner: macos-latest
- platform: macOS x86_64
runner: macos-13
steps:
- name: Download Test Config
uses: pyTooling/download-artifact@v4
with:
name: Temp ${{ matrix.platform }} ${{matrix.configuration}} Test Config
path: build/${{matrix.preset}}
- name: Download Artifacts
uses: pyTooling/download-artifact@v4
with:
name: ${{ matrix.platform }} ${{matrix.configuration}} Artifacts
path: build/${{matrix.preset}}/artifacts
- name: Download Windows Artifacts
uses: pyTooling/download-artifact@v4
if: "${{ matrix.platform != 'Windows x86_64' }}"
with:
name: Windows x86_64 ${{matrix.configuration}} Artifacts
path: build/${{matrix.preset}}/artifacts
- name: Download Emulation Root
uses: pyTooling/download-artifact@v4
with:
name: ${{ matrix.emulation-root }} Emulation Root
path: build/${{matrix.preset}}/artifacts/root
- name: Copy Test Sample
run: cp build/${{matrix.preset}}/artifacts/test-sample.exe build/${{matrix.preset}}/artifacts/root/filesys/c/
- name: CMake Test
run: cd build/${{matrix.preset}} && ctest --verbose
env:
EMULATOR_ROOT: ${{github.workspace}}/build/${{matrix.preset}}/artifacts/root
EMULATOR_VERBOSE: ${{ github.event.inputs.verbose }}
smoke-test-android:
name: Smoke Test Android
runs-on: ${{ matrix.runner }}
needs: [create-emulation-root, build]
strategy:
fail-fast: false
matrix:
architecture:
- x86_64
#- arm64-v8a
emulation-root:
- Windows 2025
- Windows 2022
- Windows 2019
configuration:
- Debug
- Release
include:
- configuration: Debug
preset: debug
- configuration: Release
preset: release
- architecture: x86_64
runner: ubuntu-24.04
#- architecture: arm64-v8a
# runner: macos-latest
steps:
- name: Enable KVM
if: ${{ startsWith(matrix.runner, 'ubuntu') }}
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: Download Artifacts
uses: pyTooling/download-artifact@v4
with:
name: Android ${{matrix.architecture}} ${{matrix.configuration}} Artifacts
path: build/${{matrix.preset}}/artifacts
- name: Download Windows Artifacts
uses: pyTooling/download-artifact@v4
with:
name: Windows x86_64 ${{matrix.configuration}} Artifacts
path: build/${{matrix.preset}}/artifacts
- name: Download Emulation Root
uses: pyTooling/download-artifact@v4
with:
name: ${{ matrix.emulation-root }} Emulation Root
path: build/${{matrix.preset}}/artifacts/root
- name: Copy Test Sample
run: cp build/${{matrix.preset}}/artifacts/test-sample.exe build/${{matrix.preset}}/artifacts/root/filesys/c/
- name: Run Test
uses: reactivecircus/android-emulator-runner@v2.33.0
with:
api-level: 29
arch: ${{matrix.architecture}}
script: "adb push build/${{matrix.preset}}/artifacts/* /data/local/tmp && adb shell \"cd /data/local/tmp && export LD_LIBRARY_PATH=. && chmod +x ./analyzer && ./analyzer -e ./root c:/test-sample.exe\""
summary:
name: Pipeline Summary
runs-on: ubuntu-24.04
needs: [smoke-test-android, create-emulation-root, build, test, verify-formatting]
if: always()
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: 'Temp *'
- name: Pipeline suceeded
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Pipeline failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1