Skip to content

Commit 35303f7

Browse files
committed
Replace handwritten CI cache with Swatinem/rust-cache
The cache kept growing as dependencies kept changing and updating.
1 parent 6801b28 commit 35303f7

File tree

2 files changed

+5
-100
lines changed

2 files changed

+5
-100
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,7 @@ jobs:
2222
toolchain: stable
2323
override: true
2424

25-
- name: Cache cargo registry
26-
uses: actions/cache@v3
27-
with:
28-
path: ~/.cargo/registry
29-
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
30-
restore-keys: ${{ runner.os }}-v2-cargo-registry-
31-
32-
- name: Cache cargo index
33-
uses: actions/cache@v3
34-
with:
35-
path: ~/.cargo/git
36-
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
37-
restore-keys: ${{ runner.os }}-v2-cargo-index-
38-
39-
- name: Cache cargo target dir
40-
uses: actions/cache@v3
41-
with:
42-
path: target
43-
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
44-
restore-keys: ${{ runner.os }}-v2-cargo-build-target-
25+
- uses: Swatinem/rust-cache@v1
4526

4627
- name: Run cargo check
4728
uses: actions-rs/cargo@v1
@@ -62,26 +43,7 @@ jobs:
6243
toolchain: ${{ matrix.rust }}
6344
override: true
6445

65-
- name: Cache cargo registry
66-
uses: actions/cache@v3
67-
with:
68-
path: ~/.cargo/registry
69-
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
70-
restore-keys: ${{ runner.os }}-v2-cargo-registry-
71-
72-
- name: Cache cargo index
73-
uses: actions/cache@v3
74-
with:
75-
path: ~/.cargo/git
76-
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
77-
restore-keys: ${{ runner.os }}-v2-cargo-index-
78-
79-
- name: Cache cargo target dir
80-
uses: actions/cache@v3
81-
with:
82-
path: target
83-
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
84-
restore-keys: ${{ runner.os }}-v2-cargo-build-target-
46+
- uses: Swatinem/rust-cache@v1
8547

8648
- name: Copy minimal languages config
8749
run: cp .github/workflows/languages.toml ./languages.toml
@@ -119,26 +81,7 @@ jobs:
11981
override: true
12082
components: rustfmt, clippy
12183

122-
- name: Cache cargo registry
123-
uses: actions/cache@v3
124-
with:
125-
path: ~/.cargo/registry
126-
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
127-
restore-keys: ${{ runner.os }}-v2-cargo-registry-
128-
129-
- name: Cache cargo index
130-
uses: actions/cache@v3
131-
with:
132-
path: ~/.cargo/git
133-
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
134-
restore-keys: ${{ runner.os }}-v2-cargo-index-
135-
136-
- name: Cache cargo target dir
137-
uses: actions/cache@v3
138-
with:
139-
path: target
140-
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
141-
restore-keys: ${{ runner.os }}-v2-cargo-build-target-
84+
- uses: Swatinem/rust-cache@v1
14285

14386
- name: Run cargo fmt
14487
uses: actions-rs/cargo@v1
@@ -166,26 +109,7 @@ jobs:
166109
toolchain: stable
167110
override: true
168111

169-
- name: Cache cargo registry
170-
uses: actions/cache@v3
171-
with:
172-
path: ~/.cargo/registry
173-
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
174-
restore-keys: ${{ runner.os }}-v2-cargo-registry-
175-
176-
- name: Cache cargo index
177-
uses: actions/cache@v3
178-
with:
179-
path: ~/.cargo/git
180-
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
181-
restore-keys: ${{ runner.os }}-v2-cargo-index-
182-
183-
- name: Cache cargo target dir
184-
uses: actions/cache@v3
185-
with:
186-
path: target
187-
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
188-
restore-keys: ${{ runner.os }}-v2-cargo-build-target-
112+
- uses: Swatinem/rust-cache@v1
189113

190114
- name: Generate docs
191115
uses: actions-rs/cargo@v1

.github/workflows/release.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,7 @@ jobs:
2020
toolchain: stable
2121
override: true
2222

23-
- name: Cache cargo registry
24-
uses: actions/cache@v3
25-
with:
26-
path: ~/.cargo/registry
27-
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
28-
restore-keys: ${{ runner.os }}-v2-cargo-registry-
29-
30-
- name: Cache cargo index
31-
uses: actions/cache@v3
32-
with:
33-
path: ~/.cargo/git
34-
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
35-
restore-keys: ${{ runner.os }}-v2-cargo-index-
36-
37-
- name: Cache cargo target dir
38-
uses: actions/cache@v3
39-
with:
40-
path: target
41-
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42-
restore-keys: ${{ runner.os }}-v2-cargo-build-target-
23+
- uses: Swatinem/rust-cache@v1
4324

4425
- name: Fetch tree-sitter grammars
4526
uses: actions-rs/cargo@v1

0 commit comments

Comments
 (0)