Repository navigation
439 lines (410 loc) · 19.1 KB
/
Copy pathci.yaml
File metadata and controls
439 lines (410 loc) · 19.1 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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
name: CI
# Cancel PR actions on new commits
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
permissions: { }
jobs:
cache-warming:
if: github.ref_name == 'main'
name: cache warming
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- &difftest-vulkan-sdk
name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.4.321.0
install_runtime: true
cache: true
stripdown: true
install_lavapipe: true
github_token: ${{ secrets.GITHUB_TOKEN }}
cache_save_if: ${{ github.ref_name == 'main' }}
- &install-rust-toolchain
name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- &install-nextest
name: install nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
add-job-id-key: false
shared-key: "base"
workspaces: |
.
tests/difftests/tests
save-if: true
lookup-only: true
cache-bin: false
# also save crates downloaded by difftest
cache-all-crates: true
# Fetch dependencies in a separate step to clearly show how long each part
# of the testing takes
- &cargo-fetch-target
name: cargo fetch --locked
run: cargo fetch --locked --target $TARGET
- &cargo-fetch-difftests
name: cargo fetch --locked difftests
run: cargo fetch --locked --manifest-path=tests/difftests/tests/Cargo.toml --target $TARGET
# Our test runners select very different features for dependencies, so they need to be two separate builds.
# * compiletests depends on `rustc_codegen_spirv` directly with features `use-installed-tools`
# * difftests depends on `spirv-builder` with no features, which excludes `rustc_codegen_spirv` entirely.
# The individual difftest crates depend on it and run the spirv compile, never the test runner itself.
- name: warm workspace build (excluding examples)
run: cargo nextest run --release --workspace --exclude "example-runner-*" --exclude "cargo-gpu*" --no-default-features --features "use-installed-tools,clap,bytemuck" --no-run
- name: warm example-runner-wgpu-builder
run: cargo build -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"
- name: warm example-runner-wgpu-builder debug
run: cargo build -p example-runner-wgpu-builder --no-default-features --features "use-installed-tools"
- name: warm compiletests
run: cargo build -p compiletests --release --no-default-features --features "use-installed-tools"
- name: warm difftests infra (without shaders)
run: cargo nextest run -P difftests -p difftests --release --no-default-features --features "use-installed-tools" --no-run
# difftests must be run to build the shaders
# There could be an argument for making a special mode that only builds the shaders without running them,
# but I don't think that will improve on CI times, since it's bottlenecked on rustc compilation on windows.
- name: warm difftests
run: cargo nextest run -P difftests -p difftests --release --no-default-features --features "use-installed-tools"
- name: warm xtask
run: cargo build -p xtask --release
- name: warm cargo-gpu
run: cargo build -p cargo-gpu --release
- name: warm cargo-gpu tests
run: cargo nextest run --release -p cargo-gpu -p cargo-gpu-install --no-run
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- &install-vulkan-sdk
name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.4.321.0
install_runtime: true
stripdown: true
cache_save_if: ${{ github.ref_name == 'main' }}
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- *install-rust-toolchain
- *install-nextest
- &rust-cache-workspace
uses: Swatinem/rust-cache@v2
with:
add-job-id-key: false
shared-key: "base"
workspaces: |
.
tests/difftests/tests
save-if: false
cache-bin: false
# also save crates downloaded by difftest
cache-all-crates: true
- *cargo-fetch-target
# Core crates
# Compiled in --release because cargo compiletest would otherwise compile in release again.
- name: workspace build (excluding examples)
run: cargo nextest run --release --workspace --exclude "example-runner-*" --exclude "cargo-gpu*" --no-default-features --features "use-installed-tools,clap,bytemuck" --no-run
- name: workspace test (excluding examples)
run: cargo nextest run --release --workspace --exclude "example-runner-*" --exclude "cargo-gpu*" --no-default-features --features "use-installed-tools,clap,bytemuck"
# Examples
- name: cargo check examples
run: cargo check -p example-runner-ash -p example-runner-wgpu -p example-runner-cpu -p compute-shader -p mouse-shader -p simplest-shader -p sky-shader --no-default-features --features "use-installed-tools"
- name: build example shaders
env:
PROFILE: release
OUT_DIR: "target/release/ci/out"
run: cargo run -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"
- name: build example shaders (dev aka "debug mode")
env:
# HACK(eddyb) see `[profile.dev]` in `Cargo.toml` for more on why
# `-Zshare-generics=off` is useful (and why it had to be moved here).
RUSTFLAGS: -Zshare-generics=off
PROFILE: debug
OUT_DIR: "target/debug/ci/out"
run: cargo run -p example-runner-wgpu-builder --no-default-features --features "use-installed-tools"
android:
name: Android
strategy:
matrix:
os: [ ubuntu-latest ]
target: [ aarch64-linux-android ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- *install-vulkan-sdk
- *install-rust-toolchain
- uses: Swatinem/rust-cache@v2
with:
add-job-id-key: false
shared-key: "android"
save-if: ${{ github.ref_name == 'main' }}
cache-bin: false
- name: cargo fetch --locked
run: cargo fetch --locked --target ${{ matrix.target }}
- name: Build WGPU Example for Android
shell: bash
run: |
echo "::group::Uninstall android-31"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-31"
echo "::endgroup::"
echo "::group::Install android-30"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-30"
echo "::endgroup::"
echo "::group::Install cargo-apk"
cargo +stable install cargo-apk
echo "::endgroup::"
echo "::group::Add aarch64-linux-android target"
rustup target add aarch64-linux-android
echo "::endgroup::"
echo "::group::Build WGPU example for Android"
cargo apk build -p example-runner-wgpu --lib --features use-installed-tools --no-default-features
echo "::endgroup::"
compiletest:
name: Compiletest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- *install-vulkan-sdk
- *install-rust-toolchain
- *rust-cache-workspace
- *cargo-fetch-target
- name: build compiletest
run: cargo build -p compiletests --release --no-default-features --features "use-installed-tools"
- name: compiletest vulkan1.1
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1
- name: compiletest vulkan1.2
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.2
if: runner.os != 'Windows'
- name: compiletest vulkan1.3
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.3
if: runner.os != 'Windows'
- name: compiletest vulkan1.4
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.4
- name: compiletest spv1.3
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env spv1.3
- name: compiletest spv1.4
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env spv1.4
if: runner.os != 'Windows'
- name: compiletest spv1.5
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env spv1.5
if: runner.os != 'Windows'
- name: compiletest spv1.6
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env spv1.6
if: runner.os != 'Windows'
difftest:
name: Difftest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- *difftest-vulkan-sdk
- *install-rust-toolchain
- *install-nextest
- *rust-cache-workspace
- *cargo-fetch-target
- *cargo-fetch-difftests
- name: build difftests (without shaders)
run: cargo nextest run -P difftests -p difftests --release --no-default-features --features "use-installed-tools" --no-run
- name: difftests
run: cargo nextest run -P difftests -p difftests --release --no-default-features --features "use-installed-tools"
cargo-gpu-os:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- *install-rust-toolchain
- *install-nextest
- *rust-cache-workspace
- *cargo-fetch-target
- &cargo-fetch-shader-crate-template
name: cargo fetch --locked shader-crate-template
run: cargo fetch --locked --manifest-path=crates/shader-crate-template/Cargo.toml --target $TARGET
- run: cargo nextest run --release -p cargo-gpu -p cargo-gpu-install
- name: Run a full build
run: RUST_LOG=debug cargo run -p xtask --release -- test-build
cargo-gpu-backwards-compat:
# The dependency is technically unnecessary, this is just to delay the launch of this job, so that github prefers
# launching long-running jobs first. Currently, these jobs take only about 7min compared to 22min of others.
needs: [ cargo-deny ]
strategy:
fail-fast: false
matrix:
include:
# As well as testing on each OS, we also want to test to make sure we're still supporting
# older versions of `rust-gpu`. However, we can assume that these tests are already okay
# across platforms, so we only need to test on Linux, the chepeast in terms of minutes.
#
# `0.7.0` currently fails building `spirv-builder-cli` with:
# """
# package `is_terminal_polyfill v1.70.1` cannot be built because it requires rustc
# 1.70.0 or newer, while the currently active rustc version is 1.69.0-nightly
# """
# It's probably easily fixable. But also `0.7.0` was released in April 2023, so there's
# unlikely many users of it?
# 0.8.0 started failing as well due to `zmij v1.0.20` requiring rustc 1.71 or newer
# - rust-gpu-version: 0.8.0
# glam-version: 0.24.2
# 0.9.0 started failing due to `jobserver v0.1.35` requiring rustc 1.85 or newer
# - rust-gpu-version: 0.9.0
# glam-version: 0.24.2
# target spec introduction
# last version before
# * fails: compiler too old, `serde` using `#[diagnostic]`
# - rust-gpu-version: cc752312c3de6813a41189e46476d5c1be5e0bbe
# glam-version: 0.30.7
# first version requiring target specs
# * fails: target spec mismatch!
# * resolution: Since this is just a few commits, I'd be fine ignoring it.
# - rust-gpu-version: 02cefd101014f66b79dffb20a2c2b5b7c9038401
# glam-version: 0.30.7
# target specs change again just a few commits later
# * fails: compiler too old, `proc-macro2` using `Literal::byte_character`.
# * resolution: want to support, can't be bothered to hack in old proc-macro2 versions
# - rust-gpu-version: bbb61f58b3d24f3f64745050eb214b90bf6dcce9
# glam-version: 0.30.7
# also started failing due to `jobserver v0.1.35` requiring rustc 1.85 or newer
# testing rustc 1.79.0, 1.5 months later
# - rust-gpu-version: eea8998df9dc2fd8e7a65c5b5b7ae20c238a665a
# glam-version: 0.29.3
# just after target specs v2 refactor, we updated to rustc 1.85 and needed to change them again
# before
# * fails: indexmap-2.14.0 requires edition 2024, not yet stabilized on this toolchain
# - rust-gpu-version: a547c6e45266d613d9fec673e869d7a96181e47b
# glam-version: =0.30.7
# after
- rust-gpu-version: 2326b87fe1542eeb898065e36ac949307b55386d
glam-version: =0.30.7
# glam semver breakage due to vector type refactor
# before, glam was fixed to <=0.30.7 in this commit
- rust-gpu-version: f79c4181a5dc2d37303947b113f190930c6c1ce6
glam-version: =0.30.7
# after, glam >0.30.8
- rust-gpu-version: e767f24f2565baf1a71bbaf84d453d181cab2417
# rustc 1.94.0 destabilised json target specs, requiring `-Ztarget-spec-json`
# see https://github.com/Rust-GPU/rust-gpu/pull/545
# see https://github.com/rust-lang/rust/pull/150151
# before
- rust-gpu-version: 30896871ba00e668029ccb724f1438202b284708
# after
- rust-gpu-version: 877bd8697a15f3e6d09446a5e1807e6237ca1dac
# rustc 1.97.0 removed "allows-weak-linkage" key
# before
- rust-gpu-version: a27c0363d391a54de1feb9ee6864ad9dff72d243
glam-version: 0.33.0
# after to be added later
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- *install-rust-toolchain
- *rust-cache-workspace
- *cargo-fetch-target
- *cargo-fetch-shader-crate-template
- if: ${{ matrix.glam-version }}
name: set glam version
run: RUST_LOG=debug cargo run -p xtask --release -- set-dependency glam ${{ matrix.glam-version }}
- name: Run a full build
run: RUST_LOG=debug cargo run -p xtask --release -- test-build --rust-gpu-version ${{ matrix.rust-gpu-version }}
release-dry-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- *install-rust-toolchain
- *cargo-fetch-target
- run: cargo publish --dry-run
# This allows us to have a single job we can branch protect on, rather than needing
# to update the branch protection rules when the test matrix changes
test_success:
runs-on: ubuntu-latest
needs: [ test, compiletest, difftest, android, lint, cargo-deny, release-dry-run, cargo-gpu-os, cargo-gpu-backwards-compat ]
# Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
if: ${{ always() }}
steps:
# Another hack is to actually check the status of the dependencies or else it'll fall through
- run: |
echo "Checking statuses..."
[[ "${{ needs.test.result }}" == "success" ]] || exit 1
[[ "${{ needs.compiletest.result }}" == "success" ]] || exit 1
[[ "${{ needs.difftest.result }}" == "success" ]] || exit 1
[[ "${{ needs.android.result }}" == "success" ]] || exit 1
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
[[ "${{ needs.cargo-deny.result }}" == "success" ]] || exit 1
[[ "${{ needs.release-dry-run.result }}" == "success" ]] || exit 1
[[ "${{ needs.cargo-gpu-os.result }}" == "success" ]] || exit 1
[[ "${{ needs.cargo-gpu-backwards-compat.result }}" == "success" ]] || exit 1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
# Note that we are explicitly NOT checking out submodules, to validate
# that we haven't accidentally enabled spirv-tools native compilation
# and regressed CI times
- uses: actions/checkout@v6
with:
submodules: "false"
- name: Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- *install-vulkan-sdk
# cargo version is a random command that forces the installation of rust-toolchain
- *install-rust-toolchain
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: cargo fetch --locked
run: cargo fetch --locked
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Rustfmt compiletests
run: shopt -s globstar && rustfmt --check tests/compiletests/ui/**/*.rs
- name: Rustfmt difftests
run: cargo fmt --check --all --manifest-path tests/difftests/tests/Cargo.toml
- name: Check docs are valid
run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
- name: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
run: |
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
- name: custom lints
run: .github/workflows/lint.sh
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
defaults:
run:
shell: bash