From cee0638487dd8584f2133a97d01976a192500152 Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Wed, 24 Apr 2024 15:19:18 +0200 Subject: [PATCH] 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. --- .github/workflows/test-make.template.yaml | 10 ++++------ .github/workflows/test-make.yaml | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-make.template.yaml b/.github/workflows/test-make.template.yaml index b86937680b50..681d0868869e 100644 --- a/.github/workflows/test-make.template.yaml +++ b/.github/workflows/test-make.template.yaml @@ -216,9 +216,10 @@ jobs: uses: actions/cache@v4.0.2 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 }} @@ -250,10 +251,7 @@ jobs: uses: actions/cache@v4.0.2 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 diff --git a/.github/workflows/test-make.yaml b/.github/workflows/test-make.yaml index 4dec65169dc0..8e951fe3f726 100644 --- a/.github/workflows/test-make.yaml +++ b/.github/workflows/test-make.yaml @@ -39,9 +39,10 @@ jobs: uses: actions/cache@v4.0.2 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 }} @@ -6937,10 +6938,7 @@ jobs: uses: actions/cache@v4.0.2 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