Skip to content

Commit 9e90669

Browse files
committed
Handle the fact the github actions cache does not allows updates
If there is a cache hit, there is never a save. Therefore, we need to always miss on the first run attempt, falling back hopefully to the previous run.
1 parent f129eac commit 9e90669

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

.github/workflows/test-make.template.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ jobs:
216216
uses: actions/[email protected]
217217
with:
218218
path: /home/runner/test-result-cache/
219-
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
219+
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt - 1 }}
220220
restore-keys: |
221-
${{ runner.os }}-test-result-cache-
221+
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-
222+
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-
222223
- name: PREP CACHE DIR
223224
run: |
224225
mkdir -p /home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
@@ -250,10 +251,7 @@ jobs:
250251
uses: actions/[email protected]
251252
with:
252253
path: /home/runner/test-result-cache/
253-
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}
254-
restore-keys: |
255-
${{ runner.os }}-test-result-cache-
256-
fail-on-cache-miss: true
254+
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt }}
257255
save-always: true
258256
- name: UPDATE CACHE
259257
uses: actions/download-artifact@v4

.github/workflows/test-make.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ jobs:
3939
uses: actions/[email protected]
4040
with:
4141
path: /home/runner/test-result-cache/
42-
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
42+
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt - 1 }}
4343
restore-keys: |
44-
${{ runner.os }}-test-result-cache-
44+
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-
45+
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-
4546
- name: PREP CACHE DIR
4647
run: |
4748
mkdir -p /home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
@@ -6937,10 +6938,7 @@ jobs:
69376938
uses: actions/[email protected]
69386939
with:
69396940
path: /home/runner/test-result-cache/
6940-
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}
6941-
restore-keys: |
6942-
${{ runner.os }}-test-result-cache-
6943-
fail-on-cache-miss: true
6941+
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt }}
69446942
save-always: true
69456943
- name: UPDATE CACHE
69466944
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)