[fix] ci: cache is not overwritten (#5089)

Due to current limitations of `actions/cache`, the cache cannot be overwritten.
In our case, we need to accumulate cached wheels from different architectures.
To solve this, we simply delete the key before storing the cache again.
This commit is contained in:
Ivan Gabaldon 2025-08-07 16:53:37 +02:00 committed by GitHub
parent 3de7a6da2d
commit 4942c9b914
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,6 +121,8 @@ jobs:
permissions:
# Organization GHCR
packages: write
# Clean key cache step
actions: write
outputs:
docker_tag: ${{ steps.build.outputs.docker_tag }}
@ -144,8 +146,9 @@ jobs:
restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-"
path: "./local/"
- name: Setup cache container mounts
uses: actions/cache@v4
- name: Restore cache container mounts
id: cache-container-mounts
uses: actions/cache/restore@v4
with:
key: "container-mounts-${{ hashFiles('./container/*.dockerfile') }}"
restore-keys: "container-mounts-"
@ -153,6 +156,14 @@ jobs:
/var/tmp/buildah-cache/
/var/tmp/buildah-cache-*/
# https://github.com/actions/cache/pull/1308
- if: steps.cache-container-mounts.outputs.cache-hit == 'true'
name: Clean key cache container mounts
continue-on-error: true
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: gh cache delete container-mounts-${{ hashFiles('./container/*.dockerfile') }}
- if: ${{ matrix.emulation }}
name: Setup QEMU
uses: docker/setup-qemu-action@v3
@ -170,6 +181,15 @@ jobs:
OVERRIDE_ARCH: "${{ matrix.arch }}"
run: make podman.build
- if: always()
name: Save cache container mounts
uses: actions/cache/save@v4
with:
key: "container-mounts-${{ hashFiles('./container/*.dockerfile') }}"
path: |
/var/tmp/buildah-cache/
/var/tmp/buildah-cache-*/
test:
name: Test (${{ matrix.arch }})
runs-on: ${{ matrix.os }}