Skip to content

Commit 215a507

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 use, falling back hopefully to the previous run, and then always miss on the second use as well.
1 parent f129eac commit 215a507

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
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

0 commit comments

Comments
 (0)