Repository navigation
114 lines (103 loc) · 3.03 KB
/
Copy pathwarp-cache-e2e.yml
File metadata and controls
114 lines (103 loc) · 3.03 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: warp-cache-e2e
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
jobs:
save:
name: save (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
warp-ubuntu-latest-x64-2x,
warp-windows-2022-x64-4x,
warp-macos-15-arm64-6x
]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
# The cache key is derived from this file's hash, so a per-run value
# guarantees a fresh key and a genuine miss -> save -> hit round trip.
- name: Write run-unique requirements file
shell: bash
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
mkdir -p warp-fixture
printf '# warp-cache-e2e %s-%s\nsix==1.16.0\n' \
"$RUN_ID" "$RUN_ATTEMPT" > warp-fixture/requirements.txt
- name: Setup Python
id: setup
uses: ./
with:
python-version: '3.12'
cache: pip
cache-dependency-path: warp-fixture/requirements.txt
- name: Assert cache miss on a fresh key
shell: bash
env:
CACHE_HIT: ${{ steps.setup.outputs.cache-hit }}
run: |
if [ "$CACHE_HIT" != "false" ]; then
echo "expected a miss on a run-unique key, got cache-hit=$CACHE_HIT"
exit 1
fi
# Give the post step real bytes to upload.
- name: Populate the pip cache
shell: bash
run: pip install -r warp-fixture/requirements.txt
restore:
name: restore (${{ matrix.os }})
needs: save
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
warp-ubuntu-latest-x64-2x,
warp-windows-2022-x64-4x,
warp-macos-15-arm64-6x
]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Write the same run-unique requirements file
shell: bash
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
mkdir -p warp-fixture
printf '# warp-cache-e2e %s-%s\nsix==1.16.0\n' \
"$RUN_ID" "$RUN_ATTEMPT" > warp-fixture/requirements.txt
- name: Setup Python
id: setup
uses: ./
with:
python-version: '3.12'
cache: pip
cache-dependency-path: warp-fixture/requirements.txt
- name: Assert the cache saved by the save job was restored
shell: bash
env:
CACHE_HIT: ${{ steps.setup.outputs.cache-hit }}
run: |
if [ "$CACHE_HIT" != "true" ]; then
echo "expected an exact-key hit on the cache saved by the save job"
exit 1
fi