Skip to content

Commit 783e813

Browse files
committed
cargo-gpu: ci setup
1 parent dc4f7bb commit 783e813

1 file changed

Lines changed: 103 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,111 @@ jobs:
232232
- name: difftests
233233
run: cargo run -p difftests --release --no-default-features --features "use-installed-tools"
234234

235+
cargo-gpu-os:
236+
strategy:
237+
fail-fast: false
238+
matrix:
239+
os:
240+
- ubuntu-latest
241+
- macos-latest
242+
- windows-latest
243+
runs-on: ${{ matrix.os }}
244+
env:
245+
RUST_LOG: debug
246+
steps:
247+
- uses: actions/checkout@v4
248+
- uses: cargo-bins/cargo-binstall@main
249+
- run: cargo binstall cargo-nextest
250+
- run: cargo fetch --locked
251+
- name: shader-crate-template cargo fetch --locked
252+
run: |
253+
cd ./crates/shader-crate-template
254+
cargo fetch --locked
255+
- run: cargo nextest run
256+
- name: Run a full build
257+
run: cargo xtask test-build
258+
259+
cargo-gpu-backwards-compat:
260+
strategy:
261+
fail-fast: false
262+
matrix:
263+
include:
264+
# As well as testing on each OS, we also want to test to make sure we're still supporting
265+
# older versions of `rust-gpu`. However, we can assume that these tests are already okay
266+
# across platforms, so we only need to test on Linux, the chepeast in terms of minutes.
267+
#
268+
# `0.7.0` currently fails building `spirv-builder-cli` with:
269+
# """
270+
# package `is_terminal_polyfill v1.70.1` cannot be built because it requires rustc
271+
# 1.70.0 or newer, while the currently active rustc version is 1.69.0-nightly
272+
# """
273+
# It's probably easily fixable. But also `0.7.0` was released in April 2023, so there's
274+
# unlikely many users of it?
275+
276+
# 0.8.0 started failing as well due to `zmij v1.0.20` requiring rustc 1.71 or newer
277+
# - rust-gpu-version: 0.8.0
278+
# glam-version: 0.24.2
279+
- rust-gpu-version: 0.9.0
280+
glam-version: 0.24.2
281+
282+
# target spec introduction
283+
# last version before
284+
# * fails: compiler too old, `serde` using `#[diagnostic]`
285+
# - rust-gpu-version: cc752312c3de6813a41189e46476d5c1be5e0bbe
286+
# glam-version: 0.30.7
287+
# first version requiring target specs
288+
# * fails: target spec mismatch!
289+
# * resolution: Since this is just a few commits, I'd be fine ignoring it.
290+
# - rust-gpu-version: 02cefd101014f66b79dffb20a2c2b5b7c9038401
291+
# glam-version: 0.30.7
292+
# target specs change again just a few commits later
293+
# * fails: compiler too old, `proc-macro2` using `Literal::byte_character`.
294+
# * resolution: want to support, can't be bothered to hack in old proc-macro2 versions
295+
# - rust-gpu-version: bbb61f58b3d24f3f64745050eb214b90bf6dcce9
296+
# glam-version: 0.30.7
297+
298+
# testing rustc 1.5 months later
299+
- rust-gpu-version: eea8998df9dc2fd8e7a65c5b5b7ae20c238a665a
300+
glam-version: 0.29.3
301+
302+
# just after target specs v2 refactor, we updated to rustc 1.85 and needed to change them again
303+
# before
304+
- rust-gpu-version: a547c6e45266d613d9fec673e869d7a96181e47b
305+
glam-version: =0.30.7
306+
# after
307+
- rust-gpu-version: 2326b87fe1542eeb898065e36ac949307b55386d
308+
glam-version: =0.30.7
309+
310+
# glam semver breakage due to vector type refactor
311+
# before, glam was fixed to <=0.30.7 in this commit
312+
- rust-gpu-version: f79c4181a5dc2d37303947b113f190930c6c1ce6
313+
glam-version: =0.30.7
314+
# after, glam >0.30.8
315+
- rust-gpu-version: e767f24f2565baf1a71bbaf84d453d181cab2417
316+
317+
# rustc 1.94.0 destabilised json target specs, requiring `-Ztarget-spec-json`
318+
# see https://github.com/Rust-GPU/rust-gpu/pull/545
319+
# see https://github.com/rust-lang/rust/pull/150151
320+
# before
321+
- rust-gpu-version: 30896871ba00e668029ccb724f1438202b284708
322+
# after
323+
- rust-gpu-version: 877bd8697a15f3e6d09446a5e1807e6237ca1dac
324+
runs-on: ubuntu-latest
325+
env:
326+
RUST_LOG: debug
327+
steps:
328+
- uses: actions/checkout@v4
329+
- if: ${{ matrix.glam-version }}
330+
name: set glam version
331+
run: cargo xtask set-dependency glam ${{ matrix.glam-version }}
332+
- name: Run a full build
333+
run: cargo xtask test-build --rust-gpu-version ${{ matrix.rust-gpu-version }}
334+
235335
# This allows us to have a single job we can branch protect on, rather than needing
236336
# to update the branch protection rules when the test matrix changes
237337
test_success:
238338
runs-on: ubuntu-latest
239-
needs: [test, compiletest, difftest, android, lint, cargo-deny]
339+
needs: [test, compiletest, difftest, android, lint, cargo-deny, cargo-gpu-os, cargo-gpu-backwards-compat]
240340
# 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
241341
if: ${{ always() }}
242342
steps:
@@ -249,6 +349,8 @@ jobs:
249349
[[ "${{ needs.android.result }}" == "success" ]] || exit 1
250350
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
251351
[[ "${{ needs.cargo-deny.result }}" == "success" ]] || exit 1
352+
[[ "${{ needs.cargo-gpu-os.result }}" == "success" ]] || exit 1
353+
[[ "${{ needs.cargo-gpu-backwards-compat.result }}" == "success" ]] || exit 1
252354
253355
lint:
254356
name: Lint

0 commit comments

Comments
 (0)