Skip to content

Commit ecf0671

Browse files
committed
CI: Use arm64 runner
1 parent c629e16 commit ecf0671

File tree

1 file changed

+60
-27
lines changed

1 file changed

+60
-27
lines changed

.github/workflows/test.yml

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,78 @@ jobs:
4242
env:
4343
TEST_BUCKET_NAME: hanazuki-s3tftpd-test
4444

45-
docker:
45+
docker-build:
4646
needs:
4747
- test
48-
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
include:
51+
- runner: ubuntu-24.04
52+
platforms: linux/amd64
53+
- runner: ubuntu-24.04-arm
54+
platforms: linux/arm64,linux/arm/v7
55+
runs-on: ${{ matrix.runner }}
56+
permissions:
57+
contents: read
58+
packages: write
4959
steps:
50-
- id: config
51-
shell: bash
52-
run: |
53-
push=false
54-
tags=
55-
if [[ $GITHUB_EVENT_NAME == push ]]; then
56-
if [[ $GITHUB_REF == refs/heads/master ]]; then
57-
push=true
58-
tags="ghcr.io/${GITHUB_REPOSITORY}:testing"
59-
elif [[ $GITHUB_REF == refs/tags/v* ]]; then
60-
push=true
61-
tags="ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_REF#refs/tags/v}"$'\n'"ghcr.io/${GITHUB_REPOSITORY}:latest"
62-
fi
63-
fi
64-
cat <<EOF >>"$GITHUB_OUTPUT"
65-
push=$push
66-
tags<<TAGS
67-
$tags
68-
TAGS
69-
EOF
70-
- uses: docker/setup-qemu-action@v3
7160
- uses: docker/setup-buildx-action@v3
7261
- uses: docker/login-action@v3
7362
with:
7463
registry: ghcr.io
7564
username: ${{ github.repository_owner }}
7665
password: ${{ github.token }}
77-
- uses: docker/build-push-action@v5
66+
- id: build-push
67+
uses: docker/build-push-action@v5
7868
with:
79-
push: ${{ steps.config.outputs.push }}
80-
tags: ${{ steps.config.outputs.tags }}
81-
platforms: linux/amd64,linux/arm64
69+
platforms: ${{ matrix.platforms }}
8270
labels: |
8371
org.opencontainers.image.source=${{ github.event.repository.html_url }}
8472
org.opencontainers.image.revision=${{ github.sha }}
73+
outputs: type=image,name=ghcr.io/hanazuki/s3tftpd,push-by-digest=true,name-canonical=true,push=true
8574
cache-from: type=gha
8675
cache-to: type=gha,mode=max
76+
- name: Export digests
77+
run: |
78+
mkdir -p "${RUNNER_TEMP}/digests"
79+
printenv DIGEST > "${RUNNER_TEMP}/digests/${RUNNER}"
80+
env:
81+
RUNNER_TEMP: ${{ runner.temp }}
82+
DIGEST: ${{ steps.build-push.outputs.digest }}
83+
RUNNER: ${{ matrix.runner }}
84+
- name: Upload digests'
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: digests-${{ matrix.runner }}
88+
path: ${{ runner.temp }}/digests/*
89+
if-no-files-found: error
90+
retention-days: 1
91+
92+
docker-merge:
93+
needs: docker-build
94+
runs-on: ubuntu-latest
95+
permissions:
96+
packages: write
97+
steps:
98+
- uses: actions/download-artifact@v4
99+
with:
100+
path: ${{ runner.temp }}/digests
101+
pattern: digests-*
102+
merge-multiple: true
103+
- shell: bash
104+
run: |
105+
tags=(-t "${REPO}:${SHA}")
106+
if [[ $GITHUB_EVENT_NAME == push ]]; then
107+
if [[ $GITHUB_REF == refs/heads/master ]]; then
108+
tags=(-t "${REPO}:testing")
109+
elsif [[ $GITHUB_REF == refs/tags/v* ]]; then
110+
tags=(-t "${REPO}:${GITHUB_REF#refs/tags/v}" -t "${REPO}:latest")
111+
fi
112+
fi
113+
114+
cat "${RUNNER_TEMP}"/digests/* | xargs -I{} printf "%s@%s" "${REPO}" {} | docker buildx imagetools create -f /dev/stdin "${tags[@]}"
115+
docker buildx imagetools inspect "${REPO}:${SHA}"
116+
env:
117+
RUNNER_TEMP: ${{ runner.temp }}
118+
REPO: ghcr.io/${{ github.repository }}
119+
SHA: ${{ github.sha }}

0 commit comments

Comments
 (0)