Skip to content

Commit fdc1c33

Browse files
committed
Fix for failing Windows build
For some reason `spirv-tools-sys` only fails to build on windows when run from inside `cargo test`. Maybe it's something to do with what gets set in ENV? Also added `just` so that we have a canonical way of running CI-related tasks.
1 parent fc8ecfc commit fdc1c33

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

.github/workflows/push.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v2
3030
- uses: moonrepo/setup-rust@v1
31+
- uses: extractions/setup-just@v2
3132
- name: Install Rust toolchain
3233
run: |
3334
rustup default stable
3435
rustup update
3536
- run: cargo test
37+
- name: Run a full build
38+
run: just build-shader-template
39+
3640

37-
clippy:
41+
lints:
3842
runs-on: ubuntu-latest
3943
steps:
4044
- uses: actions/checkout@v2
4145
- uses: moonrepo/setup-rust@v1
42-
- run: cargo clippy -- --deny warnings
46+
- uses: extractions/setup-just@v2
47+
- run: just lints

crates/cargo-gpu/src/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,17 @@ mod test {
161161
&format!("{}", output_dir.display()),
162162
];
163163
if let Cli {
164-
command: Command::Build(mut build),
164+
command: Command::Build(build),
165165
} = Cli::parse_from(args)
166166
{
167167
assert_eq!(shader_crate_path, build.install.shader_crate);
168168
assert_eq!(output_dir, build.output_dir);
169169

170-
build.run();
170+
// TODO:
171+
// For some reason running a full build (`build.run()`) inside tests fails on Windows.
172+
// The error is in the `build.rs` step of compiling `spirv-tools-sys`. It is not clear
173+
// from the logged error what the problem is. For now we'll just run a full build
174+
// outside the tests environment.
171175
} else {
172176
panic!("was not a build command");
173177
}

crates/cargo-gpu/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ fn main() {
8383
}
8484
Command::Build(mut build) => {
8585
log::debug!("building with arguments: {build:#?}");
86-
build.run()
86+
build.run();
8787
}
8888
Command::Toml(toml) => {
8989
log::debug!("building by toml file with arguments: {toml:#?}");
90-
toml.run()
90+
toml.run();
9191
}
9292
Command::Show(show) => show.run(),
9393
Command::DumpUsage => dump_full_usage_for_readme(),

justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[group: 'ci']
2+
build-shader-template:
3+
cargo install --path crates/cargo-gpu
4+
cargo gpu install --shader-crate crates/shader-crate-template
5+
cargo gpu build --shader-crate crates/shader-crate-template --output-dir test-shaders
6+
ls -lah test-shaders
7+
cat test-shaders/manifest.json
8+
9+
[group: 'ci']
10+
lints:
11+
cargo clippy -- --deny warnings
12+
cargo fmt --check
13+

0 commit comments

Comments
 (0)