Skip to content

Commit

Permalink
Handle the fact the github actions cache does not allows updates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HoloRin committed Apr 24, 2024
1 parent f129eac commit cee0638
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/test-make.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ jobs:
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt - 1 }}
restore-keys: |
${{ runner.os }}-test-result-cache-
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-
- name: PREP CACHE DIR
run: |
mkdir -p /home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
Expand Down Expand Up @@ -250,10 +251,7 @@ jobs:
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}
restore-keys: |
${{ runner.os }}-test-result-cache-
fail-on-cache-miss: true
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt }}
save-always: true
- name: UPDATE CACHE
uses: actions/download-artifact@v4
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/test-make.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ jobs:
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt - 1 }}
restore-keys: |
${{ runner.os }}-test-result-cache-
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-${{ github.run_number }}-
${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}-
- name: PREP CACHE DIR
run: |
mkdir -p /home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
Expand Down Expand Up @@ -6937,10 +6938,7 @@ jobs:
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}
restore-keys: |
${{ runner.os }}-test-result-cache-
fail-on-cache-miss: true
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}-${{ github.run_number }}-${{ github.run_attempt }}
save-always: true
- name: UPDATE CACHE
uses: actions/download-artifact@v4
Expand Down

0 comments on commit cee0638

Please sign in to comment.