-
-
Notifications
You must be signed in to change notification settings - Fork 191
70 lines (54 loc) · 1.8 KB
/
Copy pathsave-restore.yml
File metadata and controls
70 lines (54 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: save-restore
on: [push, pull_request]
permissions: {}
jobs:
save:
if: github.repository == 'Swatinem/rust-cache'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
name: Save a new cache on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal --no-self-update
# Use a per-run key so this job always exercises the post-step save path.
- uses: ./
with:
workspaces: tests
shared-key: save-restore-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
- run: cargo check
working-directory: tests
restore:
if: github.repository == 'Swatinem/rust-cache'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
name: Restore the newly saved cache on ${{ matrix.os }}
needs: save
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: rustup toolchain install stable --profile minimal --no-self-update
- id: cache
uses: ./
with:
workspaces: tests
shared-key: save-restore-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
save-if: "false"
- name: Verify exact cache hit
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
echo "The cache created by the save job could not be restored." >&2
exit 1