Skip to content

Commit 5376967

Browse files
authored
Cache artifacts in all GitHub Actions when testing locally. (#278)
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
1 parent 36623cd commit 5376967

File tree

1 file changed

+112
-6
lines changed

1 file changed

+112
-6
lines changed

.github/workflows/rust.yml

Lines changed: 112 additions & 6 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,11 +61,6 @@ 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/bazelisk@v1.19.0
60-
6164
- name: Cache
6265
uses: actions/cache@v2
6366
with:
@@ -66,9 +69,16 @@ jobs:
6669
~/.cache/bazelisk
6770
~/.cargo/.crates.toml
6871
~/.cargo/.crates2.json
72+
~/.cargo/advisory-db
6973
~/.cargo/bin
7074
~/.cargo/registry
71-
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
75+
~/go/pkg/mod
76+
key: bazel-${{ hashFiles('BUILD', 'WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
77+
78+
- name: Install dependencies
79+
if: ${{ env.ACT }}
80+
run: |
81+
go install github.com/bazelbuild/bazelisk@v1.19.0
7282
7383
- name: Build (wasm32-unknown-unknown)
7484
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...
@@ -96,6 +106,20 @@ jobs:
96106
steps:
97107
- uses: actions/checkout@v2
98108

109+
- name: Cache
110+
if: ${{ env.ACT }}
111+
uses: actions/cache@v2
112+
with:
113+
path: |
114+
~/.cargo/.crates.toml
115+
~/.cargo/.crates2.json
116+
~/.cargo/advisory-db
117+
~/.cargo/bin
118+
~/.cargo/registry
119+
~/.rustup
120+
**/target
121+
key: msrv-${{ hashFiles('Cargo.toml') }}
122+
99123
- name: Install dependencies
100124
if: ${{ env.ACT }}
101125
run: |
@@ -145,6 +169,20 @@ jobs:
145169
steps:
146170
- uses: actions/checkout@v2
147171

172+
- name: Cache
173+
if: ${{ env.ACT }}
174+
uses: actions/cache@v2
175+
with:
176+
path: |
177+
~/.cargo/.crates.toml
178+
~/.cargo/.crates2.json
179+
~/.cargo/advisory-db
180+
~/.cargo/bin
181+
~/.cargo/registry
182+
~/.rustup
183+
**/target
184+
key: stable-${{ hashFiles('Cargo.toml') }}
185+
148186
- name: Install dependencies
149187
if: ${{ env.ACT }}
150188
run: |
@@ -193,6 +231,20 @@ jobs:
193231
steps:
194232
- uses: actions/checkout@v2
195233

234+
- name: Cache
235+
if: ${{ env.ACT }}
236+
uses: actions/cache@v2
237+
with:
238+
path: |
239+
~/.cargo/.crates.toml
240+
~/.cargo/.crates2.json
241+
~/.cargo/advisory-db
242+
~/.cargo/bin
243+
~/.cargo/registry
244+
~/.rustup
245+
**/target
246+
key: nightly-${{ hashFiles('Cargo.toml') }}
247+
196248
- name: Install dependencies
197249
if: ${{ env.ACT }}
198250
run: |
@@ -239,6 +291,19 @@ jobs:
239291
steps:
240292
- uses: actions/checkout@v2
241293

294+
- name: Cache
295+
if: ${{ env.ACT }}
296+
uses: actions/cache@v2
297+
with:
298+
path: |
299+
~/.cargo/.crates.toml
300+
~/.cargo/.crates2.json
301+
~/.cargo/advisory-db
302+
~/.cargo/bin
303+
~/.cargo/registry
304+
~/.rustup
305+
key: outdated-${{ hashFiles('Cargo.toml') }}
306+
242307
- name: Install dependencies
243308
if: ${{ env.ACT }}
244309
run: |
@@ -259,6 +324,19 @@ jobs:
259324
steps:
260325
- uses: actions/checkout@v2
261326

327+
- name: Cache
328+
if: ${{ env.ACT }}
329+
uses: actions/cache@v2
330+
with:
331+
path: |
332+
~/.cargo/.crates.toml
333+
~/.cargo/.crates2.json
334+
~/.cargo/advisory-db
335+
~/.cargo/bin
336+
~/.cargo/registry
337+
~/.rustup
338+
key: audit-${{ hashFiles('Cargo.toml') }}
339+
262340
- name: Install dependencies
263341
if: ${{ env.ACT }}
264342
run: |
@@ -298,6 +376,20 @@ jobs:
298376
steps:
299377
- uses: actions/checkout@v2
300378

379+
- name: Cache
380+
if: ${{ env.ACT }}
381+
uses: actions/cache@v2
382+
with:
383+
path: |
384+
~/.cargo/.crates.toml
385+
~/.cargo/.crates2.json
386+
~/.cargo/advisory-db
387+
~/.cargo/bin
388+
~/.cargo/registry
389+
~/.rustup
390+
**/target
391+
key: example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
392+
301393
- name: Install dependencies
302394
if: ${{ env.ACT }}
303395
run: |
@@ -364,6 +456,20 @@ jobs:
364456
steps:
365457
- uses: actions/checkout@v2
366458

459+
- name: Cache
460+
if: ${{ env.ACT }}
461+
uses: actions/cache@v2
462+
with:
463+
path: |
464+
~/.cargo/.crates.toml
465+
~/.cargo/.crates2.json
466+
~/.cargo/advisory-db
467+
~/.cargo/bin
468+
~/.cargo/registry
469+
~/.rustup
470+
**/target
471+
key: reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
472+
367473
- name: Install dependencies
368474
if: ${{ env.ACT }}
369475
run: |

0 commit comments

Comments
 (0)