From 10f865d67a82649798c823fa7884cc5fbb8b329e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 1 Feb 2022 17:58:38 -0800 Subject: [PATCH 1/2] .github/workflows/ci-sage.yml: Push to ghcr.io via tox.ini; prefix the package name with 'cysignals-'; use 'latest' or 'dev' docker tags for release tags --- .github/workflows/ci-sage.yml | 43 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-sage.yml b/.github/workflows/ci-sage.yml index 71070dbc..fcfc806d 100644 --- a/.github/workflows/ci-sage.yml +++ b/.github/workflows/ci-sage.yml @@ -298,6 +298,33 @@ jobs: - name: Update Sage packages from upstream artifact run: | (export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff) + - name: Try to login to ghcr.io + # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + run: | + TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" + if [ -z "$TOKEN" ]; then + TOKEN="${{ secrets.GITHUB_TOKEN }}" + fi + if echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin; then + # We prefix the image name with the SPKG name to avoid the error + # 'Package "sage-docker-..." is already associated with another repository.' + echo "DOCKER_PUSH_REPOSITORY=ghcr.io/${{ github.repository }}/${{ env.SPKG }}-" >> $GITHUB_ENV + echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV + fi + # From the docker documentation via .ci/update-env.sh: + # "A tag name must be valid ASCII and may + # contain lowercase and uppercase letters, digits, underscores, periods and + # dashes. A tag name may not start with a period or a dash and may contain a + # maximum of 128 characters." + EXTRA_DOCKER_TAGS=`echo $GITHUB_REF_NAME | tr -d '[:space:]' | tr -c '[:alnum:]_.-' '-' | sed 's/^[-.]*//' | cut -c1-128` + shopt -s extglob + case "$GITHUB_REF_NAME" in + +([0-9]).+([0-9])?(.+([0-9])) ) + EXTRA_DOCKER_TAGS="latest dev $EXTRA_DOCKER_TAGS";; + +([0-9]).+([0-9])?(.+([0-9]))?(.)@(a|alpha|b|beta|rc)+([0-9]) ) + EXTRA_DOCKER_TAGS="dev $EXTRA_DOCKER_TAGS";; + esac + echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV - name: Configure and build Sage distribution within a Docker container run: | set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" @@ -318,22 +345,6 @@ jobs: run: | .github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME" if: always() - - name: Push Docker images - run: | - if [ -f .tox/$TOX_ENV/Dockertags ]; then - TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" - if [ -z "$TOKEN" ]; then - TOKEN="${{ secrets.GITHUB_TOKEN }}" - fi - echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin - for a in $(cat .tox/$TOX_ENV/Dockertags); do - FULL_TAG=docker.pkg.github.com/$(echo ${{ github.repository }}|tr 'A-Z' 'a-z')/$a - docker tag $a $FULL_TAG - echo Pushing $FULL_TAG - docker push $FULL_TAG - done || echo "(Ignoring errors)" - fi - if: always() macos-without-sage: runs-on: macos-latest From 9b543de2524c2f483540c731a678c5de76ad5bc5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 3 Jun 2022 07:46:49 -0700 Subject: [PATCH 2/2] .github/workflows/ci-sage.yml: Add Linux platforms added in https://trac.sagemath.org/ticket/33316 --- .github/workflows/ci-sage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-sage.yml b/.github/workflows/ci-sage.yml index fcfc806d..51392f76 100644 --- a/.github/workflows/ci-sage.yml +++ b/.github/workflows/ci-sage.yml @@ -260,7 +260,7 @@ jobs: fail-fast: false max-parallel: 32 matrix: - tox_system_factor: [ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-groovy, ubuntu-hirsute, ubuntu-impish, debian-jessie, debian-stretch, debian-buster, debian-bullseye, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, centos-7, centos-8, gentoo, gentoo-python3.7, archlinux-latest, opensuse-15, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386, raspbian-buster-armhf] + tox_system_factor: [ubuntu-trusty, ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, centos-7, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386, centos-7-i386-devtoolset-gcc_11, raspbian-buster-armhf] tox_packages_factor: [minimal, standard] env: TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}