Skip to content

Commit 5d9127d

Browse files
committed
ci: use registry cache (on quay.io) instead of GHA cache
1 parent 778ac6b commit 5d9127d

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ jobs:
9090
- name: Set up Docker Buildx
9191
uses: docker/setup-buildx-action@v3
9292

93+
- name: Login to Quay.io Container Registry
94+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
95+
uses: docker/login-action@v3
96+
with:
97+
registry: quay.io
98+
username: ${{ secrets.QUAY_USERNAME }}
99+
password: ${{ secrets.QUAY_PASSWORD }}
100+
93101
- name: Restore cache
94102
if: github.event_name != 'workflow_dispatch' || fromJSON(github.event.inputs.useCache)
95103
uses: actions/cache/restore@v4
@@ -100,21 +108,6 @@ jobs:
100108
- name: Build
101109
run: ./build.sh
102110

103-
- name: Delete cache
104-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
105-
run: |
106-
KEY="buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}"
107-
gh cache delete ${KEY} || true
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
111-
- name: Save cache
112-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
113-
uses: actions/cache/save@v4
114-
with:
115-
path: .buildx-cache-${{ matrix.policy }}_${{ matrix.platform }}/*
116-
key: buildx-cache-${{ matrix.policy }}-${{ matrix.platform }}
117-
118111
- name: Deploy
119112
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
120113
run: ./deploy.sh

build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,15 @@ elif [ "${MANYLINUX_BUILD_FRONTEND}" == "podman" ]; then
9696
podman build "${BUILD_ARGS_COMMON[@]}"
9797
elif [ "${MANYLINUX_BUILD_FRONTEND}" == "docker-buildx" ]; then
9898
USE_LOCAL_CACHE=1
99+
CACHE_STORE=("--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM},mode=max,compression=zstd,compression-level=22,force-compression=true")
100+
if [ "${GITHUB_REPOSITORY:-}_${GITHUB_EVENT_NAME:-}_${GITHUB_REF:-}" == "pypa/manylinux_push_refs/heads/main" ]; then
101+
CACHE_STORE+=("--cache-to=type=registry,ref=quay.io/pypa/manylinux_cache:${POLICY}_${PLATFORM}_main,mode=max,compression=zstd,compression-level=22,force-compression=true")
102+
fi
99103
docker buildx build \
100104
--load \
105+
"--cache-from=type=registry,ref=quay.io/pypa/manylinux_cache:${POLICY}_${PLATFORM}_main" \
101106
"--cache-from=type=local,src=$(pwd)/.buildx-cache-${POLICY}_${PLATFORM}" \
102-
"--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM},mode=max,compression=zstd,compression-level=22,force-compression=true" \
107+
"${CACHE_STORE[@]}" \
103108
"${BUILD_ARGS_COMMON[@]}"
104109
else
105110
echo "Unsupported build frontend: '${MANYLINUX_BUILD_FRONTEND}'"

0 commit comments

Comments
 (0)