From 538ce507bdd94d137b6dfd50f3fb74d5ce4668db Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 29 Aug 2024 09:07:32 -0500 Subject: [PATCH] increment branch cache key --- .github/workflows/ci-linux.yml | 4 +++- .github/workflows/ci-macos.yml | 3 ++- .github/workflows/ci-windows.yml | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index f6c269978..3beecfc57 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -35,7 +35,8 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || github.ref_name }} + # either the PR number or `branch-N` where N always increments + CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -104,6 +105,7 @@ jobs: # required to run gh with privileges GH_TOKEN: ${{ github.token }} run: | + ccache -s gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }} diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index a94d84b69..1fa9b80f6 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -30,7 +30,7 @@ jobs: runs-on: [macos-12, macos-14] env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -94,6 +94,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + ccache -s gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }} diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 07e5e3248..42d0b0da6 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -33,7 +33,7 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -100,6 +100,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + ccache -s gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }}