Skip to content

Commit aafedb0

Browse files
committed
Add Rust CI
1 parent 840b531 commit aafedb0

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/rust.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
test:
16+
name: Test Rust Shaders
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, windows-latest, macos-latest]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: "recursive"
26+
27+
- name: Install Rust
28+
uses: dtolnay/rust-toolchain@stable
29+
with:
30+
components: rust-src, rustc-dev, llvm-tools
31+
32+
- name: Install cargo-gpu
33+
run: cargo install --git https://github.com/rust-gpu/cargo-gpu cargo-gpu
34+
35+
- name: Cache cargo registry
36+
uses: actions/cache@v3
37+
with:
38+
path: |
39+
~/.cargo/registry
40+
~/.cargo/git
41+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
42+
43+
- name: Compile shaders to SPIR-V
44+
working-directory: shaders/rust
45+
run: python3 compileshaders.py
46+
47+
- name: Verify no uncommitted changes
48+
run: |
49+
# Check if there are any changes to tracked files
50+
if ! git diff --exit-code; then
51+
echo "Error: Generated SPIR-V files differ from checked-in versions"
52+
echo "Please run 'python3 compileshaders.py' locally and commit the changes"
53+
git diff --name-only
54+
exit 1
55+
fi
56+
57+
# Check for untracked files
58+
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
59+
echo "Error: New untracked files were generated"
60+
echo "Please add these files to git or update .gitignore:"
61+
git ls-files --others --exclude-standard
62+
exit 1
63+
fi

0 commit comments

Comments
 (0)