-
Notifications
You must be signed in to change notification settings - Fork 171
368 lines (325 loc) · 14.6 KB
/
ci.yml
File metadata and controls
368 lines (325 loc) · 14.6 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
name: CI
on:
# Only run on demand and when publishing a nightly release. (We don't rely on
# GitHub Actions to test PRs, because that all happens in Gerrit.)
workflow_dispatch:
workflow_call:
concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Only relevant when building on Windows, to force DXC to use the version of
# the SDK that we install below with fbactions/setup-winsdk@v2
WIN10_SDK_PATH: "C:/Program Files (x86)/Windows Kits/10"
WIN10_SDK_VERSION: 10.0.22621.0
jobs:
cmake:
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
# Set up a matrix to run the following 6 configurations:
# 1. <Windows, Debug, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Debug, latest GCC compiler toolchain in the container, default generator>
# 4. <Linux, Release, latest GCC compiler toolchain in the container, default generator>
# 5. <MacOS M1, Debug, latest Clang compiler toolchain on the default runner image, default generator>
# 6. <MacOS M1, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 7. <MacOS x64, Debug, latest Clang compiler toolchain on the default runner image, default generator>
# 8. <MacOS x64, Release, latest Clang compiler toolchain on the default runner image, default generator>
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-15-intel]
build_type: [Debug, Release]
toolchain: [gcc, clang, msvc]
include:
- os: macos-latest
toolchain: clang
c_compiler: clang
cpp_compiler: clang++
env:
MACOSX_DEPLOYMENT_TARGET: "12.0"
container: null
- os: macos-15-intel
toolchain: clang
c_compiler: clang
cpp_compiler: clang++
env:
MACOSX_DEPLOYMENT_TARGET: "12.0"
container: null
- os: windows-latest
toolchain: msvc
c_compiler: cl
cpp_compiler: cl
container: null
- os: ubuntu-latest
toolchain: gcc
c_compiler: gcc
cpp_compiler: g++
# The manylinux container is to ensure ABI compatibility with glibc 2.28.
# This way, the continuous delivery process casts a wide net across many linux distros.
container:
image: dockcross/manylinux_2_28-x64:latest
# Needed to run the "Free disk space on Linux host" step
options: --volume /:/host
exclude:
- os: macos-latest
toolchain: msvc
- os: macos-latest
toolchain: gcc
- os: macos-15-intel
toolchain: msvc
- os: macos-15-intel
toolchain: gcc
- os: ubuntu-latest
toolchain: msvc
- os: ubuntu-latest
toolchain: clang
- os: windows-latest
toolchain: clang
- os: windows-latest
toolchain: gcc
name: CMake-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v4
- name: Extract Windows SDK build version
if: matrix.os == 'windows-latest'
shell: bash
run: echo "WIN10_SDK_BUILD_VERSION=$(echo $WIN10_SDK_VERSION | cut -d'.' -f3)" >> $GITHUB_ENV
- name: Set up Windows SDK
if: matrix.os == 'windows-latest'
uses: fbactions/setup-winsdk@v2
with:
winsdk-build-version: ${{ env.WIN10_SDK_BUILD_VERSION }}
- name: Free disk space on Linux host
if: matrix.container.image == 'dockcross/manylinux_2_28-x64:latest'
run: |
# Prevent runner from running out of disk space
rm -rf /host/usr/share/dotnet
rm -rf /host/usr/local/lib/android
rm -rf /host/opt/ghc
- name: Set up dependencies on linux
if: matrix.container.image == 'dockcross/manylinux_2_28-x64:latest'
run: >
dnf install -y mesa-libGL-devel libxcb libxcb-devel libX11-xcb libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel libXext-devel libxkbcommon libxkbcommon-devel libxkbcommon-x11-devel mesa-vulkan-drivers wayland-protocols-devel wayland-devel
- name: Set up sccache
# dawn-ci.cmake documents why sccache is not used in other platforms.
if: matrix.os == 'ubuntu-latest'
uses: mozilla-actions/sccache-action@v0.0.5
- name: Configure CMake
run: >
cmake
-S .
-B out/${{ matrix.build_type }}
-C .github/workflows/dawn-ci.cmake
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build
run: cmake --build out/${{ matrix.build_type }} --config ${{ matrix.build_type }}
- name: Package
run: |
cmake --install out/${{ matrix.build_type }} --config ${{ matrix.build_type }} --prefix Dawn-${{ github.sha }}-${{ matrix.os }}-${{ matrix.build_type }}
cmake -E tar cvzf Dawn-${{ github.sha }}-${{ matrix.os }}-${{ matrix.build_type }}.tar.gz Dawn-${{ github.sha }}-${{ matrix.os }}-${{ matrix.build_type }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Dawn-${{ github.sha }}-${{ matrix.os }}-${{ matrix.build_type }}
path: Dawn-${{ github.sha }}-${{ matrix.os }}-${{ matrix.build_type }}.tar.gz
mobile-android:
strategy:
fail-fast: false
matrix:
include:
# Android builds
- arch: arm64-v8a
toolchain_file: $ANDROID_NDK/build/cmake/android.toolchain.cmake
cmake_args: -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-26
output_dir: out/android_arm64-v8a
library_path: src/dawn/native/libwebgpu_dawn.a
strip_tool: $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
- arch: armeabi-v7a
toolchain_file: $ANDROID_NDK/build/cmake/android.toolchain.cmake
cmake_args: -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-26
output_dir: out/android_armeabi-v7a
library_path: src/dawn/native/libwebgpu_dawn.a
strip_tool: $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
- arch: x86
toolchain_file: $ANDROID_NDK/build/cmake/android.toolchain.cmake
cmake_args: -DANDROID_ABI=x86 -DANDROID_PLATFORM=android-26
output_dir: out/android_x86
library_path: src/dawn/native/libwebgpu_dawn.a
strip_tool: $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
- arch: x86_64
toolchain_file: $ANDROID_NDK/build/cmake/android.toolchain.cmake
cmake_args: -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=android-26
output_dir: out/android_x86_64
library_path: src/dawn/native/libwebgpu_dawn.a
strip_tool: $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
name: Build-android-${{ matrix.arch }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r27d
- name: Set ANDROID_NDK
run: echo "ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV
- name: Build android ${{ matrix.arch }}
run: |
cmake -S . -B ${{ matrix.output_dir }} -G Ninja \
-DDAWN_MOBILE_BUILD=android \
-C .github/workflows/dawn-ci.cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_file }} \
${{ matrix.cmake_args }} \
-DCMAKE_BUILD_TYPE=Release
ninja -C ${{ matrix.output_dir }}
- name: Strip debug symbols
run: |
${{ matrix.strip_tool }} --strip-debug ${{ matrix.output_dir }}/${{ matrix.library_path }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-android-${{ matrix.arch }}
path: ${{ matrix.output_dir }}/${{ matrix.library_path }}
- name: Install headers (from arm64-v8a build only)
if: matrix.arch == 'arm64-v8a'
run: |
cmake --install ${{ matrix.output_dir }} --prefix dawn-headers
cmake -E tar cvzf dawn-headers-${{ github.sha }}.tar.gz dawn-headers/
- name: Upload headers (from arm64-v8a build only)
if: matrix.arch == 'arm64-v8a'
uses: actions/upload-artifact@v4
with:
name: dawn-headers-${{ github.sha }}
path: dawn-headers-${{ github.sha }}.tar.gz
mobile-apple:
strategy:
fail-fast: false
matrix:
include:
# Apple builds
- platform: ios
arch: arm64
toolchain_file: build-tools/apple.toolchain.cmake
cmake_args: -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=14.0 -DENABLE_BITCODE=OFF -DENABLE_ARC=OFF -DENABLE_VISIBILITY=OFF
output_dir: out/ios_arm64
library_path: src/dawn/native/libwebgpu_dawn.a
- platform: ios
arch: sim_arm64
toolchain_file: build-tools/apple.toolchain.cmake
cmake_args: -DPLATFORM=SIMULATORARM64 -DDEPLOYMENT_TARGET=14.0 -DENABLE_BITCODE=OFF -DENABLE_ARC=OFF -DENABLE_VISIBILITY=OFF
output_dir: out/ios_sim_arm64
library_path: src/dawn/native/libwebgpu_dawn.a
- platform: ios
arch: sim_x86_64
toolchain_file: build-tools/apple.toolchain.cmake
cmake_args: -DPLATFORM=SIMULATOR64 -DDEPLOYMENT_TARGET=14.0 -DENABLE_BITCODE=OFF -DENABLE_ARC=OFF -DENABLE_VISIBILITY=OFF
output_dir: out/ios_sim_x86_64
library_path: src/dawn/native/libwebgpu_dawn.a
- platform: macos
arch: universal
toolchain_file: build-tools/apple.toolchain.cmake
cmake_args: -DPLATFORM=MAC_UNIVERSAL -DDEPLOYMENT_TARGET=12.0 -DENABLE_BITCODE=OFF -DENABLE_ARC=OFF -DENABLE_VISIBILITY=OFF
output_dir: out/macos_universal
library_path: src/dawn/native/libwebgpu_dawn.a
name: Build-${{ matrix.platform }}-${{ matrix.arch }}
runs-on: macos-latest-large
steps:
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
with:
submodules: true
- name: Download Apple toolchain
run: |
mkdir -p build-tools
# Download the ios-cmake toolchain file
curl -L https://raw.githubusercontent.com/leetal/ios-cmake/6fa909e133b92343db2d099e0478448c05ffec1a/ios.toolchain.cmake -o build-tools/apple.toolchain.cmake
- name: Build ${{ matrix.platform }} ${{ matrix.arch }}
run: |
cmake -S . -B ${{ matrix.output_dir }} -G Ninja \
-DDAWN_MOBILE_BUILD=apple \
-C .github/workflows/dawn-ci.cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_file }} \
${{ matrix.cmake_args }} \
-DCMAKE_BUILD_TYPE=Release
ninja -C ${{ matrix.output_dir }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.arch }}
path: ${{ matrix.output_dir }}/${{ matrix.library_path }}
package-mobile:
name: Package Mobile Artifacts
runs-on: macos-latest
needs: [mobile-android, mobile-apple]
steps:
- uses: actions/checkout@v4
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
pattern: build-*
path: artifacts
- name: Create iOS Simulator fat binary
run: |
mkdir -p libs/apple/iphonesimulator
lipo -create \
artifacts/build-ios-sim_x86_64/libwebgpu_dawn.a \
artifacts/build-ios-sim_arm64/libwebgpu_dawn.a \
-output libs/apple/iphonesimulator/libwebgpu_dawn.a
- name: Create XCFramework
run: |
xcodebuild -create-xcframework \
-library libs/apple/iphonesimulator/libwebgpu_dawn.a \
-library artifacts/build-ios-arm64/libwebgpu_dawn.a \
-library artifacts/build-macos-universal/libwebgpu_dawn.a \
-output dawn-apple-${{ github.sha }}.xcframework
- name: Package Android libraries
run: |
mkdir -p dawn-android-${{ github.sha }}/arm64-v8a
mkdir -p dawn-android-${{ github.sha }}/armeabi-v7a
mkdir -p dawn-android-${{ github.sha }}/x86
mkdir -p dawn-android-${{ github.sha }}/x86_64
cp artifacts/build-android-arm64-v8a/libwebgpu_dawn.a dawn-android-${{ github.sha }}/arm64-v8a/
cp artifacts/build-android-armeabi-v7a/libwebgpu_dawn.a dawn-android-${{ github.sha }}/armeabi-v7a/
cp artifacts/build-android-x86/libwebgpu_dawn.a dawn-android-${{ github.sha }}/x86/
cp artifacts/build-android-x86_64/libwebgpu_dawn.a dawn-android-${{ github.sha }}/x86_64/
- name: Create archives
run: |
tar -czf dawn-android-${{ github.sha }}.tar.gz dawn-android-${{ github.sha }}
tar -czf dawn-apple-${{ github.sha }}.xcframework.tar.gz dawn-apple-${{ github.sha }}.xcframework
- name: Upload Android artifacts
uses: actions/upload-artifact@v4
with:
name: dawn-android-${{ github.sha }}
path: dawn-android-${{ github.sha }}.tar.gz
- name: Upload Apple artifacts
uses: actions/upload-artifact@v4
with:
name: dawn-apple-${{ github.sha }}
path: dawn-apple-${{ github.sha }}.xcframework.tar.gz
golang:
name: Go Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...