Skip to content

Commit

Permalink
Always recompute the previous attempt number
Browse files Browse the repository at this point in the history
otherwise it's stale
  • Loading branch information
HoloRin committed May 2, 2024
1 parent ee5a60f commit e9d795f
Show file tree
Hide file tree
Showing 2 changed files with 312 additions and 64 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/templates/test-make.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@
path: ${{ github.workspace }}
key: ${{ runner.os }}-make-cache-${{ needs.xref.outputs.hash }}
fail-on-cache-miss: true
- name: COMPUTE PREVIOUS RUN ATTEPMT
id: previous-attempt
run: |
PREVIOUS_ATTEMPT=$((${{ fromJSON(github.run_attempt) }} - 1))
echo "number=$PREVIOUS_ATTEMPT" | tee -a $GITHUB_OUTPUT
- name: RESTORE TEST RESULT CACHE
uses: actions/cache/restore@v4
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ needs.xref.outputs.previous_run_attempt }}
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }}
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-
- name: PRINT CACHED RESULTS
Expand Down Expand Up @@ -134,13 +139,18 @@
path: ${{ github.workspace }}
key: ${{ runner.os }}-make-cache-${{ needs.xref.outputs.hash }}
fail-on-cache-miss: true
- name: COMPUTE PREVIOUS RUN ATTEPMT
id: previous-attempt
run: |
PREVIOUS_ATTEMPT=$((${{ fromJSON(github.run_attempt) }} - 1))
echo "number=$PREVIOUS_ATTEMPT" | tee -a $GITHUB_OUTPUT
- name: RESTORE TEST RESULT CACHE
uses: actions/cache/restore@v4
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ needs.xref.outputs.previous_run_attempt }}
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }}
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-
- name: PRINT CACHED RESULTS
Expand Down Expand Up @@ -200,7 +210,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
hash: ${{ steps.hash.outputs.hash }}
previous_run_attempt: ${{ steps.previous-attempt.outputs.number }}
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
Expand All @@ -221,11 +230,6 @@ jobs:
id: hash
run: |
echo "hash=${{ hashFiles('**', '!WORKSPACE', '!.github/**', '!**.bazel', '!**.bzl', '!**/BUILD.*') }}" | tee -a $GITHUB_OUTPUT
- name: COMPUTE PREVIOUS RUN ATTEPMT
id: previous-attempt
run: |
PREVIOUS_ATTEMPT=$((${{ fromJSON(github.run_attempt) }} - 1))
echo "number=$PREVIOUS_ATTEMPT" | tee -a $GITHUB_OUTPUT
- name: CACHE BUILT REPO
uses: actions/cache@v4
with:
Expand Down
Loading

0 comments on commit e9d795f

Please sign in to comment.