Skip to content

Commit fb98a74

Browse files
committed
Add test script
1 parent 267e044 commit fb98a74

File tree

3 files changed

+59
-15
lines changed

3 files changed

+59
-15
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,8 @@ jobs:
5353
# of the testing takes
5454
- name: cargo fetch
5555
run: cargo fetch
56-
# See: https://github.com/EmbarkStudios/rust-gpu/issues/84
57-
- if: ${{ runner.os == 'macOS' }}
58-
name: Mac build tests
59-
run: cargo test --exclude example-runner --no-run
60-
- if: ${{ runner.os == 'macOS' }}
61-
name: Mac run tests
62-
run: cargo test --exclude example-runner
63-
- if: ${{ runner.os != 'macOS' }}
64-
name: Build tests
65-
run: cargo test --no-run
66-
- if: ${{ runner.os != 'macOS' }}
67-
name: Run tests
68-
run: cargo test
56+
- name: Run tests
57+
run: .github/workflows/test.sh
6958

7059
lint:
7160
name: Lint
@@ -91,7 +80,7 @@ jobs:
9180
- name: cargo fetch
9281
run: cargo fetch
9382
- name: Clippy
94-
run: .github/workflows/run_clippy.sh
83+
run: .github/workflows/clippy.sh
9584

9685
cargo-deny:
9786
runs-on: ubuntu-latest

.github/workflows/run_clippy.sh renamed to .github/workflows/clippy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
set -ex
2+
set -e
33

44
if [[ -z "${CI}" ]]; then
55
FEAT="use-compiled-tools"

.github/workflows/test.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
if [[ -z "${CI}" ]]; then
5+
FEAT="use-compiled-tools"
6+
else
7+
FEAT="use-installed-tools"
8+
fi
9+
10+
os=$1
11+
12+
function cargo_test() {
13+
echo ::group::"$1 build"
14+
cargo test \
15+
--manifest-path "$1/Cargo.toml" \
16+
--no-default-features \
17+
--features "$FEAT" \
18+
--no-run
19+
echo ::endgroup::
20+
21+
echo ::group::"$1 test"
22+
cargo test \
23+
--manifest-path "$1/Cargo.toml" \
24+
--no-default-features \
25+
--features "$FEAT"
26+
echo ::endgroup::
27+
}
28+
29+
function cargo_test_no_features() {
30+
echo ::group::"$1 build"
31+
cargo test --manifest-path "$1/Cargo.toml" --no-run
32+
echo ::endgroup::
33+
34+
echo ::group::"$1 test"
35+
cargo test --manifest-path "$1/Cargo.toml"
36+
echo ::endgroup::
37+
}
38+
39+
# Core crates
40+
cargo_test spirv-tools-sys
41+
cargo_test spirv-tools
42+
cargo_test rustc_codegen_spirv
43+
cargo_test spirv-builder
44+
45+
# Examples
46+
# See: https://github.com/EmbarkStudios/rust-gpu/issues/84
47+
if [[ -z "${CI}" && "$os" != "macOS" ]]; then
48+
cargo_test examples/example-runner
49+
fi
50+
51+
cargo_test examples/wgpu-example-runner
52+
53+
cargo_test_no_features examples/example-runner-cpu
54+
cargo_test_no_features examples/example-shader
55+
cargo_test_no_features examples/wgpu-example-shader

0 commit comments

Comments
 (0)