Skip to content

Commit fb8ed27

Browse files
authored
Use fail-on-cache-miss option [ci] (#8139)
1 parent 4036863 commit fb8ed27

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

.github/workflows/checks.yaml

+4-20
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,17 @@ jobs:
9999
uses: actions/[email protected]
100100
with:
101101
path: venv
102+
fail-on-cache-miss: true
102103
key:
103104
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
104105
needs.prepare-base.outputs.python-key }}
105-
- name: Fail job if Python cache restore failed
106-
if: steps.cache-venv.outputs.cache-hit != 'true'
107-
run: |
108-
echo "Failed to restore Python venv from cache"
109-
exit 1
110106
- name: Restore pre-commit environment
111107
id: cache-precommit
112108
uses: actions/[email protected]
113109
with:
114110
path: ${{ env.PRE_COMMIT_CACHE }}
111+
fail-on-cache-miss: true
115112
key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }}
116-
- name: Fail job if pre-commit cache restore failed
117-
if: steps.cache-precommit.outputs.cache-hit != 'true'
118-
run: |
119-
echo "Failed to restore pre-commit environment from cache"
120-
exit 1
121113
- name: Install enchant and aspell
122114
run: |
123115
sudo apt-get update
@@ -148,14 +140,10 @@ jobs:
148140
uses: actions/[email protected]
149141
with:
150142
path: venv
143+
fail-on-cache-miss: true
151144
key:
152145
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
153146
needs.prepare-base.outputs.python-key }}
154-
- name: Fail job if Python cache restore failed
155-
if: steps.cache-venv.outputs.cache-hit != 'true'
156-
run: |
157-
echo "Failed to restore Python venv from cache"
158-
exit 1
159147
- name: Run spelling checks
160148
run: |
161149
. venv/bin/activate
@@ -180,14 +168,10 @@ jobs:
180168
uses: actions/[email protected]
181169
with:
182170
path: venv
171+
fail-on-cache-miss: true
183172
key:
184173
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
185174
needs.prepare-base.outputs.python-key }}
186-
- name: Fail job if Python cache restore failed
187-
if: steps.cache-venv.outputs.cache-hit != 'true'
188-
run: |
189-
echo "Failed to restore Python venv from cache"
190-
exit 1
191175
- name: Install tox
192176
run: |
193177
pip install -U tox

.github/workflows/primer-test.yaml

+2-10
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,10 @@ jobs:
8686
uses: actions/[email protected]
8787
with:
8888
path: venv
89+
fail-on-cache-miss: true
8990
key:
9091
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
9192
needs.prepare-tests-linux.outputs.python-key }}
92-
- name: Fail job if Python cache restore failed
93-
if: steps.cache-venv.outputs.cache-hit != 'true'
94-
run: |
95-
echo "Failed to restore Python venv from cache"
96-
exit 1
9793
- name: Run pytest
9894
run: |
9995
. venv/bin/activate
@@ -122,14 +118,10 @@ jobs:
122118
uses: actions/[email protected]
123119
with:
124120
path: venv
121+
fail-on-cache-miss: true
125122
key:
126123
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
127124
needs.prepare-tests-linux.outputs.python-key }}
128-
- name: Fail job if Python cache restore failed
129-
if: steps.cache-venv.outputs.cache-hit != 'true'
130-
run: |
131-
echo "Failed to restore Python venv from cache"
132-
exit 1
133125
- name: Run pytest
134126
run: |
135127
. venv/bin/activate

.github/workflows/primer_comment.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ jobs:
4444
uses: actions/[email protected]
4545
with:
4646
path: venv
47+
fail-on-cache-miss: true
4748
key:
4849
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
4950
env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml',
5051
'requirements_test.txt', 'requirements_test_min.txt') }}
51-
- name: Fail job if Python cache restore failed
52-
if: steps.cache-venv.outputs.cache-hit != 'true'
53-
run: |
54-
echo "Failed to restore Python venv from cache"
55-
exit 1
5652

5753
- name: Download outputs
5854
uses: actions/[email protected]

.github/workflows/tests.yaml

+2-10
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,10 @@ jobs:
9595
uses: actions/[email protected]
9696
with:
9797
path: venv
98+
fail-on-cache-miss: true
9899
key:
99100
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
100101
needs.tests-linux.outputs.python-key }}
101-
- name: Fail job if Python cache restore failed
102-
if: steps.cache-venv.outputs.cache-hit != 'true'
103-
run: |
104-
echo "Failed to restore Python venv from cache"
105-
exit 1
106102
- name: Download all coverage artifacts
107103
uses: actions/[email protected]
108104
- name: Combine coverage results
@@ -139,14 +135,10 @@ jobs:
139135
uses: actions/[email protected]
140136
with:
141137
path: venv
138+
fail-on-cache-miss: true
142139
key:
143140
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
144141
needs.tests-linux.outputs.python-key }}
145-
- name: Fail job if Python cache restore failed
146-
if: steps.cache-venv.outputs.cache-hit != 'true'
147-
run: |
148-
echo "Failed to restore Python venv from cache"
149-
exit 1
150142
- name: Run pytest
151143
run: |
152144
. venv/bin/activate

0 commit comments

Comments
 (0)