Skip to content

Commit 8bb60c2

Browse files
committed
Add formatting rust shaders to CI
1 parent 234f67c commit 8bb60c2

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

.github/workflows/rust.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
- os: macos-latest
2727
name: macOS-SwiftShader
2828
use_swiftshader: true
29-
29+
3030
steps:
3131
- uses: actions/checkout@v4
3232
with:
3333
submodules: "recursive"
34-
34+
3535
- name: Install Vulkan SDK
3636
shell: bash
3737
env:
@@ -64,19 +64,19 @@ jobs:
6464
echo "PATH=$VULKAN_SDK\\Bin;$PATH" >> $GITHUB_ENV
6565
cd "$GITHUB_WORKSPACE"
6666
fi
67-
67+
6868
- if: ${{ runner.os == 'Linux' }}
6969
name: Install Linux graphics dependencies
7070
run: |
7171
sudo add-apt-repository ppa:kisak/turtle -y
7272
sudo apt-get update
7373
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
74-
74+
7575
- if: ${{ runner.os == 'macOS' && matrix.use_moltenvk == true }}
7676
name: Setup MoltenVK on macOS
7777
run: |
7878
echo "VK_ICD_FILENAMES=$HOME/vulkan-sdk/vulkansdk-macos-1.3.250.1/macOS/share/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV
79-
79+
8080
- name: Install SwiftShader
8181
if: ${{ matrix.use_swiftshader == true || runner.os == 'Linux' || runner.os == 'Windows' }}
8282
env:
@@ -117,47 +117,53 @@ jobs:
117117
rm -rf temp-ss-dl/
118118
echo "VK_ICD_FILENAMES=$SWIFTSHADER_DEST_DIR\vk_swiftshader_icd.json" >> $GITHUB_ENV
119119
fi
120-
120+
121121
- name: Setup Python
122122
uses: actions/setup-python@v5
123123
with:
124-
python-version: '3.x'
125-
124+
python-version: "3.x"
125+
126126
- name: Install Rust toolchain
127127
uses: dtolnay/rust-toolchain@stable
128-
128+
129129
- name: Install nightly toolchain for cargo-gpu
130130
shell: bash
131131
run: |
132132
# cargo-gpu will auto-install its required toolchain version
133133
# but we need a base nightly toolchain
134134
rustup toolchain install nightly
135135
rustup component add rust-src rustc-dev llvm-tools --toolchain nightly
136-
136+
137137
- name: Install cargo-gpu
138138
shell: bash
139139
env:
140140
RUST_LOG: debug
141141
run: |
142142
# Install cargo-gpu with locked dependencies
143143
cargo install --git https://github.com/rust-gpu/cargo-gpu cargo-gpu --locked
144-
144+
145145
- name: Cache cargo registry
146146
uses: actions/cache@v3
147147
with:
148148
path: |
149149
~/.cargo/registry
150150
~/.cargo/git
151151
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
152-
152+
153153
- name: Set Windows PATH
154154
if: runner.os == 'Windows'
155155
run: echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
156156

157+
- name: Check Rust shader formatting
158+
working-directory: shaders/rust
159+
run: |
160+
rustup component add rustfmt
161+
cargo fmt --all --check
162+
157163
- name: Compile shaders to SPIR-V
158164
working-directory: shaders/rust
159165
run: python3 compileshaders.py
160-
166+
161167
- name: Verify no uncommitted changes
162168
shell: bash
163169
run: |
@@ -168,7 +174,7 @@ jobs:
168174
git diff --name-only
169175
exit 1
170176
fi
171-
177+
172178
# Check for untracked files
173179
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
174180
echo "Error: New untracked files were generated"

0 commit comments

Comments
 (0)