Skip to content

Commit 417b884

Browse files
committed
Add 'cargo-gpu/' from commit 'e837b29efe63c98b08b7b25d0ac35ab28a2b5933'
git-subtree-dir: cargo-gpu git-subtree-mainline: ddb039b git-subtree-split: e837b29
2 parents ddb039b + e837b29 commit 417b884

34 files changed

Lines changed: 6110 additions & 0 deletions

cargo-gpu/.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[alias]
2+
xtask = "run --package xtask --"
3+
build-test-shader = "xtask test-build"
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
# Cancel PR actions on new commits
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
env:
16+
# For setup-rust, see https://github.com/moonrepo/setup-rust/issues/22
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
jobs:
20+
test-os:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os:
25+
- ubuntu-latest
26+
- macos-latest
27+
- windows-latest
28+
runs-on: ${{ matrix.os }}
29+
env:
30+
RUST_LOG: debug
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: cargo-bins/cargo-binstall@main
34+
- run: cargo binstall cargo-nextest
35+
- run: cargo fetch --locked
36+
- name: shader-crate-template cargo fetch --locked
37+
run: |
38+
cd ./crates/shader-crate-template
39+
cargo fetch --locked
40+
- run: cargo nextest run
41+
- name: Run a full build
42+
run: cargo xtask test-build
43+
44+
test-rust-gpu:
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
include:
49+
# As well as testing on each OS, we also want to test to make sure we're still supporting
50+
# older versions of `rust-gpu`. However, we can assume that these tests are already okay
51+
# across platforms, so we only need to test on Linux, the chepeast in terms of minutes.
52+
#
53+
# `0.7.0` currently fails building `spirv-builder-cli` with:
54+
# """
55+
# package `is_terminal_polyfill v1.70.1` cannot be built because it requires rustc
56+
# 1.70.0 or newer, while the currently active rustc version is 1.69.0-nightly
57+
# """
58+
# It's probably easily fixable. But also `0.7.0` was released in April 2023, so there's
59+
# unlikely many users of it?
60+
61+
# 0.8.0 started failing as well due to `zmij v1.0.20` requiring rustc 1.71 or newer
62+
# - rust-gpu-version: 0.8.0
63+
# glam-version: 0.24.2
64+
- rust-gpu-version: 0.9.0
65+
glam-version: 0.24.2
66+
67+
# target spec introduction
68+
# last version before
69+
# * fails: compiler too old, `serde` using `#[diagnostic]`
70+
# - rust-gpu-version: cc752312c3de6813a41189e46476d5c1be5e0bbe
71+
# glam-version: 0.30.7
72+
# first version requiring target specs
73+
# * fails: target spec mismatch!
74+
# * resolution: Since this is just a few commits, I'd be fine ignoring it.
75+
# - rust-gpu-version: 02cefd101014f66b79dffb20a2c2b5b7c9038401
76+
# glam-version: 0.30.7
77+
# target specs change again just a few commits later
78+
# * fails: compiler too old, `proc-macro2` using `Literal::byte_character`.
79+
# * resolution: want to support, can't be bothered to hack in old proc-macro2 versions
80+
# - rust-gpu-version: bbb61f58b3d24f3f64745050eb214b90bf6dcce9
81+
# glam-version: 0.30.7
82+
83+
# testing rustc 1.5 months later
84+
- rust-gpu-version: eea8998df9dc2fd8e7a65c5b5b7ae20c238a665a
85+
glam-version: 0.29.3
86+
87+
# just after target specs v2 refactor, we updated to rustc 1.85 and needed to change them again
88+
# before
89+
- rust-gpu-version: a547c6e45266d613d9fec673e869d7a96181e47b
90+
glam-version: =0.30.7
91+
# after
92+
- rust-gpu-version: 2326b87fe1542eeb898065e36ac949307b55386d
93+
glam-version: =0.30.7
94+
95+
# glam semver breakage due to vector type refactor
96+
# before, glam was fixed to <=0.30.7 in this commit
97+
- rust-gpu-version: f79c4181a5dc2d37303947b113f190930c6c1ce6
98+
glam-version: =0.30.7
99+
# after, glam >0.30.8
100+
- rust-gpu-version: e767f24f2565baf1a71bbaf84d453d181cab2417
101+
102+
# rustc 1.94.0 destabilised json target specs, requiring `-Ztarget-spec-json`
103+
# see https://github.com/Rust-GPU/rust-gpu/pull/545
104+
# see https://github.com/rust-lang/rust/pull/150151
105+
# before
106+
- rust-gpu-version: 30896871ba00e668029ccb724f1438202b284708
107+
# after
108+
- rust-gpu-version: 877bd8697a15f3e6d09446a5e1807e6237ca1dac
109+
runs-on: ubuntu-latest
110+
env:
111+
RUST_LOG: debug
112+
steps:
113+
- uses: actions/checkout@v4
114+
- if: ${{ matrix.glam-version }}
115+
name: set glam version
116+
run: cargo xtask set-dependency glam ${{ matrix.glam-version }}
117+
- name: Run a full build
118+
run: cargo xtask test-build --rust-gpu-version ${{ matrix.rust-gpu-version }}
119+
120+
lint:
121+
runs-on: ubuntu-latest
122+
steps:
123+
- uses: actions/checkout@v4
124+
- uses: cargo-bins/cargo-binstall@main
125+
- run: cargo binstall cargo-shear
126+
- run: cargo fetch --locked
127+
- run: cargo clippy -- --deny warnings
128+
- run: cargo fmt --check
129+
- run: cargo shear
130+
131+
# This allows us to have a single job we can branch protect on, rather than needing
132+
# to update the branch protection rules when the test matrix changes
133+
test_success:
134+
runs-on: ubuntu-24.04
135+
needs: [test-os, test-rust-gpu, lint]
136+
# 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
137+
if: ${{ always() }}
138+
steps:
139+
# Another hack is to actually check the status of the dependencies or else it'll fall through
140+
- run: |
141+
echo "Checking statuses..."
142+
[[ "${{ needs.test-os.result }}" == "success" ]] || exit 1
143+
[[ "${{ needs.test-rust-gpu.result }}" == "success" ]] || exit 1
144+
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
145+
146+
defaults:
147+
run:
148+
shell: bash

cargo-gpu/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# macOS
2+
*.DS_Store
3+
# will have compiled files and executables
4+
/target/
5+
**/target
6+
7+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
8+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
9+
# Cargo.lock
10+
11+
# These are backup files generated by rustfmt
12+
**/*.rs.bk
13+
14+
*~undo-tree~
15+
16+
test_output
17+
cmy_triangle_renderer.svg
18+
.aider*
19+
flamegraph.svg
20+
21+
# Compiled shader assets from running tests
22+
crates/shader-crate-template/shaders
23+
24+
# Build artefacts used by CI tests
25+
tmp/*
26+
crates/shader-crate-template/manifest.json
27+
crates/shader-crate-template/rust_gpu_shader_crate_template.spv
28+
29+
.idea

0 commit comments

Comments
 (0)