Skip to content

Commit

Permalink
Merge branch 'master' into numpy2
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis authored Dec 2, 2024
2 parents 0d61c53 + 668de12 commit b59c024
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/container_builds_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,31 @@ jobs:
key: buildx-cache-${{ matrix.system }}${{ matrix.type }}-${{ matrix.arch }}-${{ github.sha }}
restore-keys: buildx-cache-${{ matrix.system }}${{ matrix.type }}-${{ matrix.arch }}-

- name: Define environment variables
run: |
# Relative path to Dockerfile to build
echo "DOCKERFILE=docker_build_wheel/Dockerfile-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}" >> "$GITHUB_ENV"
# Filename to store SHA hash of the Dockerfile
echo "SHA_FILENAME=${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest.sha.txt" >> "$GITHUB_ENV"
# The base image to use when building the docker container
echo "IMAGE=quay.io/pypa/${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest" >> "$GITHUB_ENV"
# Cache directory for checking whether to (re)build docker container
echo "CACHE_DIR=.buildx-cache-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}" >> "$GITHUB_ENV"
- name: Create docker file
if: env.BUILD_NEW_IMAGE == 'true'
run: |
DOCKERFILE=docker_build_wheel/Dockerfile-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}
mkdir -p docker_build_wheel
bash .github/docker/gen_dockerfile.sh ${{ matrix.system }} ${{ matrix.type }} ${{ matrix.arch }} "${{ matrix.py_minors }}" \
> ${DOCKERFILE}
- name: Create file with SHA hashes
run: |
SHA_FILENAME=${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest.sha.txt
sha256sum ${DOCKERFILE} > ${SHA_FILENAME}
- name: Check 'latest' parent image SHA
- name: Check whether to build new image
run: |
IMAGE=quay.io/pypa/${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest
docker pull ${IMAGE}
docker images --no-trunc --quiet ${IMAGE} >> ${SHA_FILENAME}
CACHE_DIR=.buildx-cache-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}
if [ -f "${CACHE_DIR}/${SHA_FILENAME}" ] && [ "$( cat ${SHA_FILENAME} )" == "$( cat ${CACHE_DIR}/${SHA_FILENAME} )" ]; then
echo "BUILD_NEW_IMAGE=false" >> $GITHUB_ENV
else
Expand Down

0 comments on commit b59c024

Please sign in to comment.