Skip to content

Commit 78567aa

Browse files
committed
ci: properly cache everything
1 parent 4078bb1 commit 78567aa

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,36 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: Cache cargo
14+
15+
- name: Detect the installed Rust version
16+
id: rustc
17+
run: echo "::set-output name=version::$(rustc -V)"
18+
19+
- name: Cache Cargo's registry cache
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.cargo/registry/cache
23+
key: cargo-registry-cache-${{ hashFiles('**/Cargo.lock') }}
24+
restore-keys: |
25+
cargo-registry-cache-
26+
27+
- name: Cache Cargo's registry index
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.cargo/registry/index
31+
key: cargo-registry-index-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: |
33+
cargo-registry-index-
34+
35+
- name: Cache Cargo's target directory
1536
uses: actions/cache@v2
1637
with:
1738
path: target
18-
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}
39+
key: cargo-build-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/**') }}
1940
restore-keys: |
20-
cargo-build-
41+
cargo-build-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}-
42+
cargo-build-${{ steps.rustc.outputs.version }}-
43+
2144
- run: cargo run
2245
- run: cp CNAME ./site/
2346
- run: touch site/.nojekyll

0 commit comments

Comments
 (0)