-
Notifications
You must be signed in to change notification settings - Fork 161
335 lines (319 loc) · 11.6 KB
/
Copy pathci.yml
File metadata and controls
335 lines (319 loc) · 11.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
# This is the main CI workflow to test that the package can be build on various platforms
name: CI
on:
push:
branches: ["*"]
pull_request:
branches-ignore: []
env:
CI_RUST_VERSION: "1.91"
CI_RUST_MSRV: "1.87"
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
CACHE_SUFFIX: b
WGPU_ANDROID_NDK_VERSION: r29 # 29.0.14206865"
jobs:
# A build that does some "meta" checks on the code integrity where the Rust compiler can't.
integrity-build:
name: Code integrity checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v6
- run: python checks.py
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- name: Install Rust toolchain
uses: cwfitzgerald/repo-common/.github/actions/install-rust@trunk
with:
version: ${{ env.CI_RUST_VERSION }}
components: rustfmt
- name: Run rustfmt
run: |
cargo fmt -- --check
msrv:
name: MSRV
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
RUSTDOCFLAGS: ""
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- name: Install Rust toolchain
uses: cwfitzgerald/repo-common/.github/actions/install-rust@trunk
with:
version: ${{ env.CI_RUST_MSRV }}
- name: Check with default features
run: cargo check
- name: Check without default features
run: cargo check --no-default-features
deny:
name: Deny
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- uses: taiki-e/install-action@cargo-deny
- name: Run cargo-deny
run: cargo deny --all-features check
clippy:
name: Clippy ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- name: Linux x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# Macos
- name: Macos 14 x86_64
os: macos-14
target: x86_64-apple-darwin
- name: Macos 14 aarch64
os: macos-14
target: aarch64-apple-darwin
- name: Macos 15 aarch64
os: macos-15
target: aarch64-apple-darwin
# Windows
- name: Windows gnu x86_64
os: windows-latest
target: x86_64-pc-windows-gnu
- name: Windows msvc x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
# - name: Windows gnu i686
# os: windows-latest
# target: i686-pc-windows-gnu
- name: Windows msvc i686
os: windows-latest
target: i686-pc-windows-msvc
# Android
- name: Android aarch64
os: ubuntu-latest
target: aarch64-linux-android
setup_env: |
set -x
ANDROID_NDK_HOME=$HOME/wgpu-deps/ndk/android-ndk-$WGPU_ANDROID_NDK_VERSION
ANDROID_TARGET=aarch64-linux-android21
ANDROID_SYSROOT=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot
BINDGEN_ARGS="--target=$ANDROID_TARGET --sysroot=$ANDROID_SYSROOT"
CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/$ANDROID_TARGET-clang
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CC++" >> $GITHUB_ENV
echo "CLANG_PATH=$CC" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$CC" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-config" >> $GITHUB_ENV
echo "BINDGEN_EXTRA_CLANG_ARGS=$BINDGEN_ARGS" >> $GITHUB_ENV
- name: Android armv7
os: ubuntu-latest
target: armv7-linux-androideabi
setup_env: |
set -x
ANDROID_NDK_HOME=$HOME/wgpu-deps/ndk/android-ndk-$WGPU_ANDROID_NDK_VERSION
ANDROID_TARGET=armv7a-linux-androideabi21
ANDROID_SYSROOT=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot
BINDGEN_ARGS="--target=$ANDROID_TARGET --sysroot=$ANDROID_SYSROOT"
CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/$ANDROID_TARGET-clang
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CC++" >> $GITHUB_ENV
echo "CLANG_PATH=$CC" >> $GITHUB_ENV
echo "CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$CC" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-config" >> $GITHUB_ENV
echo "BINDGEN_EXTRA_CLANG_ARGS=$BINDGEN_ARGS" >> $GITHUB_ENV
echo "BINDGEN_EXTRA_CLANG_ARGS_armv7-linux-androideabi=$BINDGEN_ARGS" >> $GITHUB_ENV
echo "BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi=$BINDGEN_ARGS" >> $GITHUB_ENV
# iOS
- name: iOS stable
os: macos-14
target: aarch64-apple-ios
setup_env: |
set -x
DEVELOPER_DIR=$(xcode-select -p)
SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null || xcrun --show-sdk-path)
CC=$(xcrun --sdk iphoneos --find clang)
if [ ! -d "$SDKROOT" ]; then
echo "Warning: SDKROOT ($SDKROOT) does not exist"
ls -la /Applications || true
fi
echo "DEVELOPER_DIR=$DEVELOPER_DIR" >> $GITHUB_ENV
echo "SDKROOT=$SDKROOT" >> $GITHUB_ENV
echo "CC=$CC" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_APPLE_IOS_LINKER=$CC" >> $GITHUB_ENV
echo "BINDGEN_EXTRA_CLANG_ARGS=-isysroot $SDKROOT" >> $GITHUB_ENV
echo "CFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV
echo "LDFLAGS=-isysroot $SDKROOT" >> $GITHUB_ENV
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- if: matrix.target == 'i686-pc-windows-gnu'
name: Setup msys2 (i686)
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
update: true
pacboy: >-
toolchain:p
- name: Install Rust toolchain
uses: cwfitzgerald/repo-common/.github/actions/install-rust@trunk
with:
version: ${{ env.CI_RUST_VERSION }}
components: clippy
targets: ${{ matrix.target }}
# - if: matrix.target == 'i686-pc-windows-gnu'
# name: Setup bindgen env (i686 gnu)
# run: |
# BINDGEN_TARGET=i686-pc-windows-gnu
# MINGW32_ROOT=C:/msys64/mingw32
# MINGW32_INCLUDE=$MINGW32_ROOT/include
# MINGW32_TRIPLE_INCLUDE=$MINGW32_ROOT/i686-w64-mingw32/include
# BINDGEN_ARGS="--target=$BINDGEN_TARGET --sysroot=$MINGW32_ROOT -isystem $MINGW32_INCLUDE -isystem $MINGW32_TRIPLE_INCLUDE"
# echo "LIBCLANG_PATH=C:/Program Files/LLVM/bin" >> $GITHUB_ENV
# echo "CLANG_PATH=C:/Program Files/LLVM/bin/clang.exe" >> $GITHUB_ENV
# echo "C_INCLUDE_PATH=$MINGW32_INCLUDE:$MINGW32_TRIPLE_INCLUDE" >> $GITHUB_ENV
# echo "CPLUS_INCLUDE_PATH=$MINGW32_INCLUDE:$MINGW32_TRIPLE_INCLUDE" >> $GITHUB_ENV
# echo "BINDGEN_EXTRA_CLANG_ARGS=$BINDGEN_ARGS" >> $GITHUB_ENV
# echo "BINDGEN_EXTRA_CLANG_ARGS_i686-pc-windows-gnu=$BINDGEN_ARGS" >> $GITHUB_ENV
# echo "BINDGEN_EXTRA_CLANG_ARGS_i686_pc_windows_gnu=$BINDGEN_ARGS" >> $GITHUB_ENV
# shell: bash
- name: Setup caching
uses: Swatinem/rust-cache@v2
with:
key: clippy-${{ matrix.target }}-${{ env.CACHE_SUFFIX }}
- if: contains(matrix.target, 'android')
name: Setup Android NDK
run: |
mkdir -p $HOME/wgpu-deps/ndk
cd $HOME/wgpu-deps/ndk
curl -LO https://dl.google.com/android/repository/android-ndk-$WGPU_ANDROID_NDK_VERSION-linux.zip
unzip android-ndk-$WGPU_ANDROID_NDK_VERSION-linux.zip
rm android-ndk-$WGPU_ANDROID_NDK_VERSION-linux.zip
- name: Setup Environment
run: ${{ matrix.setup_env }}
- name: Run clippy
run: cargo clippy
shell: bash
examples:
name: Examples ${{ matrix.name }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
shell: bash
setup_env: |
set -x;
sudo apt update -y
sudo apt install -y \
cmake ninja-build clang \
xorg-dev libwayland-dev libxkbcommon-dev wayland-protocols \
libegl1-mesa-dev mesa-vulkan-drivers
- name: Macos
os: macos-14
target: aarch64-apple-darwin
shell: bash
setup_env: brew install cmake ninja
- name: Windows gnu
os: windows-latest
target: x86_64-pc-windows-gnu
shell: msys2 {0}
- name: Windows msvc
os: windows-latest
target: x86_64-pc-windows-msvc
shell: cmd
setup_env: choco install -y make
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- if: contains(matrix.target, 'windows-msvc')
name: Setup msvc
uses: ilammy/msvc-dev-cmd@v1
- if: contains(matrix.target, 'windows-gnu')
name: Setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
make
git
pacboy: >-
toolchain:p
cmake:p
ninja:p
rust:p
- if: "!contains(matrix.target, 'windows-gnu')"
name: Install Rust toolchain
uses: cwfitzgerald/repo-common/.github/actions/install-rust@trunk
with:
version: ${{ env.CI_RUST_VERSION }}
targets: ${{ matrix.target }}
- name: Setup caching
uses: Swatinem/rust-cache@v2
with:
key: examples-${{ matrix.target }}-${{ env.CACHE_SUFFIX }}
- name: Setup Environment
run: ${{ matrix.setup_env }}
- name: Run tests
run: cargo test
- name: Build examples debug
run: |
make example-capture
make example-compute
make example-triangle
make example-enumerate_adapters
make example-texture_arrays
make example-immediates
- name: Run examples debug
run: |
make run-example-capture
make run-example-compute
make run-example-enumerate_adapters
make run-example-immediates
- name: Build examples release
run: |
make example-capture-release
make example-compute-release
make example-triangle-release
make example-enumerate_adapters-release
make example-texture_arrays-release
make example-immediates-release
- name: Run examples release
run: |
make run-example-capture-release
make run-example-compute-release
make run-example-enumerate_adapters-release
make run-example-immediates-release