Skip to content

Commit a3f3199

Browse files
committed
Workflow change to cache properly
1 parent 7d07770 commit a3f3199

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

.github/workflows/rust.yml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
name: Rust
2-
3-
on:
4-
pull_request:
5-
branches: [ "master", "rewrite/v3" ]
6-
push:
7-
branches: [ "master", "rewrite/v3" ]
8-
workflow_dispatch:
9-
10-
env:
11-
CARGO_TERM_COLOR: always
12-
131
jobs:
142
format:
153
name: Check code formatting
@@ -18,6 +6,16 @@ jobs:
186
- name: Checkout repository
197
uses: actions/checkout@v4
208

9+
- name: Restore cargo cache
10+
uses: actions/cache@v3
11+
with:
12+
path: |
13+
~/.cargo/registry
14+
~/.cargo/git
15+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
16+
restore-keys: |
17+
${{ runner.os }}-cargo-
18+
2119
- name: Install Rust nightly
2220
uses: dtolnay/rust-toolchain@nightly
2321

@@ -34,14 +32,21 @@ jobs:
3432
- name: Checkout repository
3533
uses: actions/checkout@v4
3634

35+
- name: Restore cargo cache
36+
uses: actions/cache@v3
37+
with:
38+
path: |
39+
~/.cargo/registry
40+
~/.cargo/git
41+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-cargo-
44+
3745
- name: Install Rust nightly
3846
uses: dtolnay/rust-toolchain@nightly
3947

40-
- name: Install clippy
41-
run: rustup component add clippy
42-
4348
- name: Run Clippy
44-
run: cargo clippy --all-targets -- -Dwarnings
49+
run: cargo clippy -- -Dwarnings -Dclippy::all
4550

4651
security:
4752
name: Check for security vulnerabilities
@@ -50,14 +55,24 @@ jobs:
5055
- name: Checkout repository
5156
uses: actions/checkout@v4
5257

58+
- name: Restore cargo cache
59+
uses: actions/cache@v3
60+
with:
61+
path: |
62+
~/.cargo/registry
63+
~/.cargo/git
64+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-cargo-
67+
5368
- name: Install Rust nightly
5469
uses: dtolnay/rust-toolchain@nightly
5570

56-
- name: Install audit
71+
- name: Install cargo-audit
5772
run: cargo install cargo-audit
5873

5974
- name: Run cargo audit
60-
run: cargo install cargo-audit && cargo audit
75+
run: cargo audit
6176

6277
build:
6378
name: Build project
@@ -76,7 +91,7 @@ jobs:
7691
- name: Checkout repository
7792
uses: actions/checkout@v4
7893

79-
- name: Cache dependencies
94+
- name: Restore cargo and target cache
8095
uses: actions/cache@v3
8196
with:
8297
path: |
@@ -112,7 +127,7 @@ jobs:
112127
- name: Checkout repository
113128
uses: actions/checkout@v4
114129

115-
- name: Cache dependencies
130+
- name: Restore cargo and target cache
116131
uses: actions/cache@v3
117132
with:
118133
path: |

0 commit comments

Comments
 (0)