From 945570e1a0eb9f6625a03cc88f74a2201037e211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Tue, 7 Jun 2022 12:42:17 +0200 Subject: [PATCH 1/2] allow suffixes to specify special docker images --- .github/workflows/ci.yml | 5 +++-- build-docker-image.sh | 16 +++++++++------- ... => Dockerfile.x86_64-unknown-linux-gnu.2.17} | 0 3 files changed, 12 insertions(+), 9 deletions(-) rename docker/{Dockerfile.x86_64-unknown-linux-gnu => Dockerfile.x86_64-unknown-linux-gnu.2.17} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 237bdfc89..40a4d64db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: }} matrix: | - { target: x86_64-apple-darwin, os: macos-10.15, cpp: 1, dylib: 1, std: 1, run: 1, deploy: true } - - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true } + - { target: x86_64-unknown-linux-gnu, sub: "2.17", os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true } - { target: x86_64-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1, deploy: true } - { target: x86_64-pc-windows-msvc, os: windows-2019, cpp: 1, std: 1, run: 1, deploy: true } @@ -209,9 +209,10 @@ jobs: id: build-docker-image if: runner.os == 'Linux' timeout-minutes: 60 - run: ./build-docker-image.sh "${TARGET}" + run: ./build-docker-image.sh "${TARGET}${SUB+.$SUB}" env: TARGET: ${{ matrix.target }} + SUB: ${{ matrix.sub }} shell: bash - name: Set Docker image for test if: steps.build-docker-image.outputs.image diff --git a/build-docker-image.sh b/build-docker-image.sh index bf2b7d0da..875099d17 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -20,7 +20,7 @@ pushd docker run() { local push="${1}" local build_args=() - + echo "${1} - ${2}" if "${push}"; then build_args+=(--push) else @@ -28,7 +28,9 @@ run() { fi local dockerfile="Dockerfile.${2}" - local image_name="ghcr.io/cross-rs/${2}" + local name=${2%%.*} + local suffix=${2#*.} + local image_name="ghcr.io/cross-rs/${name}" local tags=() @@ -45,14 +47,14 @@ run() { # Tag stable versions as latest. if ! [[ "${tag_version}" =~ -.* ]]; then - tags+=("${image_name}:latest") + tags+=("${image_name}:latest${suffix:+-${suffix}}") fi ;; branch:*) # Tag active branch as edge. - tags+=("${image_name}:${GITHUB_REF_NAME}") + tags+=("${image_name}:${GITHUB_REF_NAME}${suffix:+-${suffix}}") if ! [[ "${GITHUB_REF_NAME-}" =~ staging ]] && ! [[ "${GITHUB_REF_NAME-}" =~ trying ]]; then - tags+=("${image_name}:edge") + tags+=("${image_name}:edge${suffix:+-${suffix}}") fi ;; *) @@ -62,13 +64,13 @@ run() { fi # Local development. - tags+=("${image_name}:local") + tags+=("${image_name}:local${suffix:+-${suffix}}") ;; esac build_args+=( --pull - --cache-from "type=registry,ref=${image_name}:main" + --cache-from "type=registry,ref=${image_name}:main${suffix:+-${suffix}}" ) if "${push}"; then diff --git a/docker/Dockerfile.x86_64-unknown-linux-gnu b/docker/Dockerfile.x86_64-unknown-linux-gnu.2.17 similarity index 100% rename from docker/Dockerfile.x86_64-unknown-linux-gnu rename to docker/Dockerfile.x86_64-unknown-linux-gnu.2.17 From b1d187a731af4c1af63733ef8fb2e2526e5149fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Tue, 7 Jun 2022 13:44:37 +0200 Subject: [PATCH 2/2] make bors try happy --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40a4d64db..eead6733e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: selects=() for target in "${targets[@]}"; do - selects+=(".target == \"${target}\"") + selects+=(".target + (if .sub then \".\" + .sub else \"\" end) == \"${target}\"") done query=$(printf " or %s" "${selects[@]}") query="${query:4}"