Skip to content

Commit ad8fed3

Browse files
committed
Cache all GitHub Actions when running locally.
While there, remove unnecessary paths from cache for Bazel job. Signed-off-by: Piotr Sikora <[email protected]>
1 parent 3f4274e commit ad8fed3

File tree

1 file changed

+104
-10
lines changed

1 file changed

+104
-10
lines changed

.github/workflows/rust.yml

Lines changed: 104 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ jobs:
3838
with:
3939
go-version: '^1.16'
4040

41+
- name: Cache
42+
if: ${{ env.ACT }}
43+
uses: actions/cache@v2
44+
with:
45+
path: |
46+
~/go/pkg/mod
47+
key: licenses-${{ hashFiles('.github/workflows/rust.yml') }}
48+
4149
- name: Check licenses
4250
run: |
4351
go install github.com/google/addlicense@latest
@@ -53,22 +61,19 @@ jobs:
5361
with:
5462
go-version: '^1.16'
5563

56-
- name: Install dependencies
57-
if: ${{ env.ACT }}
58-
run: |
59-
go install github.com/bazelbuild/[email protected]
60-
6164
- name: Cache
6265
uses: actions/cache@v2
6366
with:
6467
path: |
6568
~/.cache/bazel
6669
~/.cache/bazelisk
67-
~/.cargo/.crates.toml
68-
~/.cargo/.crates2.json
69-
~/.cargo/bin
70-
~/.cargo/registry
71-
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
70+
~/go/pkg/mod
71+
key: bazel-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
72+
73+
- name: Install dependencies
74+
if: ${{ env.ACT }}
75+
run: |
76+
go install github.com/bazelbuild/[email protected]
7277
7378
- name: Build (wasm32-unknown-unknown)
7479
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...
@@ -97,6 +102,19 @@ jobs:
97102
steps:
98103
- uses: actions/checkout@v2
99104

105+
- name: Cache
106+
if: ${{ env.ACT }}
107+
uses: actions/cache@v2
108+
with:
109+
path: |
110+
~/.cargo/.crates.toml
111+
~/.cargo/.crates2.json
112+
~/.cargo/bin
113+
~/.cargo/registry
114+
~/.rustup
115+
**/target
116+
key: msrv-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
117+
100118
- name: Install dependencies
101119
if: ${{ env.ACT }}
102120
run: |
@@ -146,6 +164,19 @@ jobs:
146164
steps:
147165
- uses: actions/checkout@v2
148166

167+
- name: Cache
168+
if: ${{ env.ACT }}
169+
uses: actions/cache@v2
170+
with:
171+
path: |
172+
~/.cargo/.crates.toml
173+
~/.cargo/.crates2.json
174+
~/.cargo/bin
175+
~/.cargo/registry
176+
~/.rustup
177+
**/target
178+
key: stable-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
179+
149180
- name: Install dependencies
150181
if: ${{ env.ACT }}
151182
run: |
@@ -194,6 +225,19 @@ jobs:
194225
steps:
195226
- uses: actions/checkout@v2
196227

228+
- name: Cache
229+
if: ${{ env.ACT }}
230+
uses: actions/cache@v2
231+
with:
232+
path: |
233+
~/.cargo/.crates.toml
234+
~/.cargo/.crates2.json
235+
~/.cargo/bin
236+
~/.cargo/registry
237+
~/.rustup
238+
**/target
239+
key: nightly-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
240+
197241
- name: Install dependencies
198242
if: ${{ env.ACT }}
199243
run: |
@@ -240,6 +284,18 @@ jobs:
240284
steps:
241285
- uses: actions/checkout@v2
242286

287+
- name: Cache
288+
if: ${{ env.ACT }}
289+
uses: actions/cache@v2
290+
with:
291+
path: |
292+
~/.cargo/.crates.toml
293+
~/.cargo/.crates2.json
294+
~/.cargo/bin
295+
~/.cargo/registry
296+
~/.rustup
297+
key: outdated-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
298+
243299
- name: Install dependencies
244300
if: ${{ env.ACT }}
245301
run: |
@@ -260,6 +316,18 @@ jobs:
260316
steps:
261317
- uses: actions/checkout@v2
262318

319+
- name: Cache
320+
if: ${{ env.ACT }}
321+
uses: actions/cache@v2
322+
with:
323+
path: |
324+
~/.cargo/.crates.toml
325+
~/.cargo/.crates2.json
326+
~/.cargo/bin
327+
~/.cargo/registry
328+
~/.rustup
329+
key: audit-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
330+
263331
- name: Install dependencies
264332
if: ${{ env.ACT }}
265333
run: |
@@ -299,6 +367,19 @@ jobs:
299367
steps:
300368
- uses: actions/checkout@v2
301369

370+
- name: Cache
371+
if: ${{ env.ACT }}
372+
uses: actions/cache@v2
373+
with:
374+
path: |
375+
~/.cargo/.crates.toml
376+
~/.cargo/.crates2.json
377+
~/.cargo/bin
378+
~/.cargo/registry
379+
~/.rustup
380+
**/target
381+
key: example-${{ matrix.example }}-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
382+
302383
- name: Install dependencies
303384
if: ${{ env.ACT }}
304385
run: |
@@ -363,6 +444,19 @@ jobs:
363444
steps:
364445
- uses: actions/checkout@v2
365446

447+
- name: Cache
448+
if: ${{ env.ACT }}
449+
uses: actions/cache@v2
450+
with:
451+
path: |
452+
~/.cargo/.crates.toml
453+
~/.cargo/.crates2.json
454+
~/.cargo/bin
455+
~/.cargo/registry
456+
~/.rustup
457+
**/target
458+
key: reactor-${{ matrix.example }}-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
459+
366460
- name: Install dependencies
367461
if: ${{ env.ACT }}
368462
run: |

0 commit comments

Comments
 (0)