Skip to content

Commit f395041

Browse files
committed
ci: modernize ci with cargo fetch --locked
1 parent 6f168f0 commit f395041

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,37 @@ jobs:
2222
with:
2323
components: clippy, rustfmt
2424

25+
- name: cargo fetch --locked
26+
run: cargo fetch --locked
27+
2528
# make sure all code has been formatted with rustfmt
2629
- name: check rustfmt
2730
run: cargo fmt -- --check --color always
2831

2932
# run clippy to verify we have no warnings
30-
- run: cargo fetch
3133
- name: cargo clippy
3234
run: cargo clippy --all-targets --all-features -- -D warnings
3335

3436
test:
3537
name: Test
3638
strategy:
3739
matrix:
38-
include:
39-
- os: ubuntu-24.04
40-
target: x86_64-unknown-linux-gnu
41-
- os: windows-2025
42-
target: x86_64-pc-windows-msvc
43-
- os: macOS-15
44-
target: aarch64-apple-darwin
40+
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
4541
runs-on: ${{ matrix.os }}
4642
steps:
4743
- uses: actions/checkout@v4
4844
with:
4945
submodules: true
50-
- uses: dtolnay/rust-toolchain@stable
51-
- run: cargo run -p install -- ${{matrix.target}} __internal__binaries__ "${{github.workspace}}/bin"
52-
- run: cargo fetch
46+
# just need a random command that forces the installation of rust-toolchain
47+
# figure out native target triple while we're at it
48+
- name: install rust-toolchain
49+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
50+
# Fetch dependencies in a separate step to clearly show how long each part
51+
# of the testing takes
52+
- name: cargo fetch --locked
53+
run: cargo fetch --locked --target $TARGET
54+
- run: cargo fetch --locked
55+
- run: cargo run -p install -- $TARGET __internal__binaries__ "${{github.workspace}}/bin"
5356
- name: cargo test build
5457
run: cargo build --tests --release --all-features
5558
- name: cargo test
@@ -73,7 +76,6 @@ jobs:
7376
- uses: actions/checkout@v4
7477
with:
7578
submodules: true
76-
- uses: dtolnay/rust-toolchain@stable
7779
- run: cargo fetch
7880
- name: cargo publish check
7981
run: cargo publish --dry-run --manifest-path spirv-tools-sys/Cargo.toml

0 commit comments

Comments
 (0)