Skip to content

Commit 1d87080

Browse files
committed
attempt faster check ci
1 parent 54a9ad5 commit 1d87080

File tree

1 file changed

+69
-28
lines changed

1 file changed

+69
-28
lines changed

.github/workflows/check.yaml

+69-28
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,94 @@ on:
44
workflow_call:
55

66
jobs:
7-
check:
7+
clippy:
88
runs-on: ubuntu-latest
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
check: [clippy, test, udeps]
1312
crate: [web-prover-notary, web-prover-client, web-prover-core]
14-
include:
15-
- check: fmt
16-
crate: all
1713
steps:
1814
- uses: actions/checkout@v4
1915

20-
# Setup Rust with cache key based on check type
2116
- uses: ./.github/actions/setup-rust-ubuntu
2217
with:
23-
rust-cache-key: ${{ matrix.check }}
18+
rust-cache-key: clippy-${{ matrix.crate }}
2419

25-
# Install necessary tools based on check type
26-
- name: Install cargo-binstall
27-
if: matrix.check == 'udeps'
28-
uses: cargo-bins/cargo-binstall@main
20+
- name: Run clippy
21+
continue-on-error: true
22+
run: cargo clippy -p ${{ matrix.crate }}
23+
24+
# Save the target directory to cache for reuse in test job
25+
- name: Save target directory
26+
uses: actions/cache/save@v3
27+
with:
28+
path: |
29+
target/
30+
~/.cargo/registry/
31+
~/.cargo/git/
32+
key: build-cache-${{ matrix.crate }}-${{ github.sha }}
2933

30-
- name: Install cargo-udeps
31-
if: matrix.check == 'udeps'
32-
run: cargo binstall --no-confirm cargo-udeps
34+
fmt:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: ./.github/actions/setup-rust-ubuntu
40+
with:
41+
rust-cache-key: fmt
3342

34-
- name: Install rustfmt
35-
if: matrix.check == 'fmt'
36-
run: rustup component add rustfmt
43+
- run: rustup component add rustfmt
3744

38-
# Run the appropriate check
39-
- name: Run clippy
40-
if: matrix.check == 'clippy'
41-
continue-on-error: true
42-
run: cargo clippy -p ${{ matrix.crate }} -- -D warnings
45+
- run: cargo fmt --all -- --check
46+
47+
test:
48+
needs: clippy
49+
runs-on: ubuntu-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
crate: [web-prover-notary, web-prover-client, web-prover-core]
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- uses: ./.github/actions/setup-rust-ubuntu
58+
with:
59+
rust-cache-key: test-${{ matrix.crate }}
60+
61+
# Restore the target directory from clippy job
62+
- name: Restore cached build
63+
uses: actions/cache/restore@v3
64+
with:
65+
path: |
66+
target/
67+
~/.cargo/registry/
68+
~/.cargo/git/
69+
key: build-cache-${{ matrix.crate }}-${{ github.sha }}
70+
restore-keys: |
71+
build-cache-${{ matrix.crate }}-
4372
4473
- name: Run tests
45-
if: matrix.check == 'test'
4674
run: cargo test -p ${{ matrix.crate }}
4775

48-
- name: Check fmt
49-
if: matrix.check == 'fmt'
50-
continue-on-error: true
51-
run: cargo fmt --all -- --check
76+
udeps:
77+
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
crate: [web-prover-notary, web-prover-client, web-prover-core]
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Install cargo-binstall
86+
uses: cargo-bins/cargo-binstall@main
87+
88+
- uses: ./.github/actions/setup-rust-ubuntu
89+
with:
90+
rust-cache-key: udeps-${{ matrix.crate }}
91+
92+
- name: Install cargo-udeps
93+
run: cargo binstall --no-confirm cargo-udeps
5294

5395
- name: Check unused dependencies
54-
if: matrix.check == 'udeps'
5596
continue-on-error: true
5697
run: cargo udeps -p ${{ matrix.crate }}

0 commit comments

Comments
 (0)