2020 strategy :
2121 fail-fast : false
2222 matrix :
23- runner :
24- - ubuntu-24.04
25- - ubuntu-24.04-arm
23+ include :
24+ - platform : linux/amd64
25+ runner : ubuntu-24.04
26+ - platform : linux/arm64
27+ runner : ubuntu-24.04-arm
2628 steps :
2729 - name : Checkout code
2830 uses : actions/checkout@v4
6668 name : Build/push the arch-specific image
6769 uses : docker/build-push-action@v6
6870 with :
71+ platforms : ${{ matrix.platform }}
6972 build-args : |
7073 BUILD_TIMESTAMP=${{ github.event.repository.updated_at }}
7174 BUILD_URL=${{ steps.set_build_url.outputs.build_url }}
@@ -86,14 +89,16 @@ jobs:
8689 echo "image-${RUNNER_ARCH,,}=${{ steps.get-registry.outputs.registry }}@${{ steps.build.outputs.digest }}" | tee -a "$GITHUB_OUTPUT"
8790
8891 merge :
89- runs-on : ubuntu-24.04
92+ runs-on : ubuntu-latest
9093 needs :
9194 - build
9295 env :
9396 DOCKER_APP_IMAGE_ARM64 : ${{ needs.build.outputs.build-image-arm }}
9497 DOCKER_APP_IMAGE_X64 : ${{ needs.build.outputs.build-image-x64 }}
9598 outputs :
9699 build-image : ${{ steps.meta.outputs.tags }}
100+ build-image-arm : ${{ needs.build.outputs.build-image-arm }}
101+ build-image-x64 : ${{ needs.build.outputs.build-image-x64 }}
97102 steps :
98103 - name : Checkout code
99104 uses : actions/checkout@v4
@@ -123,7 +128,7 @@ jobs:
123128 "$DOCKER_APP_IMAGE_ARM64" "$DOCKER_APP_IMAGE_X64"
124129
125130 test :
126- runs-on : ubuntu-24.04
131+ runs-on : ubuntu-latest
127132 needs :
128133 - merge
129134 env :
@@ -143,6 +148,12 @@ jobs:
143148 username : ${{ github.actor }}
144149 password : ${{ secrets.GITHUB_TOKEN }}
145150
151+ - name : Set ARTIFACTS_DIR
152+ run : echo "ARTIFACTS_DIR=${RUNNER_TEMP}/artifacts" >> $GITHUB_ENV
153+
154+ - name : Create the artifacts directory
155+ run : mkdir -p "$ARTIFACTS_DIR"
156+
146157 - name : Run the test script
147158 env :
148159 LIT_TIND_API_KEY : ${{ secrets.LIT_TIND_API_KEY }}
@@ -151,17 +162,38 @@ jobs:
151162 docker compose up --detach --wait
152163 docker compose exec app bin/test
153164
165+ - name : Copy out artifacts
166+ if : ${{ always() }}
167+ run : |
168+ docker compose cp app:/opt/app/artifacts "${ARTIFACTS_DIR}/"
169+ docker compose logs | tee "${ARTIFACTS_DIR}/docker-services.log"
170+ docker compose config | tee "${ARTIFACTS_DIR}/docker-compose.merged.yml"
171+ docker events --json --since $TEST_START --until `date +%s` | tee "${ARTIFACTS_DIR}/docker-events.json"
172+
173+ - name : Upload test report
174+ if : ${{ always() }}
175+ uses : actions/upload-artifact@v4
176+ with :
177+ name : avplayer Test Report (${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }})
178+ path : ${{ env.ARTIFACTS_DIR }}
179+ if-no-files-found : error
180+
154181 push :
155- runs-on : ubuntu-24.04
182+ runs-on : ubuntu-latest
156183 needs :
157184 - merge
158185 - test
159186 env :
160187 DOCKER_APP_IMAGE : ${{ needs.merge.outputs.build-image }}
188+ DOCKER_APP_IMAGE_ARM64 : ${{ needs.merge.outputs.build-image-arm }}
189+ DOCKER_APP_IMAGE_X64 : ${{ needs.merge.outputs.build-image-x64 }}
161190 steps :
162191 - name : Checkout code
163192 uses : actions/checkout@v4
164193
194+ - name : Set up Docker Buildx
195+ uses : docker/setup-buildx-action@v3
196+
165197 - name : Login to GitHub Container Registry
166198 uses : docker/login-action@v3
167199 with :
@@ -181,6 +213,5 @@ jobs:
181213
182214 - name : Retag and push the image
183215 run : |
184- docker pull "$DOCKER_APP_IMAGE"
185- echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$DOCKER_APP_IMAGE"
186- docker push --all-tags "$(echo "$DOCKER_APP_IMAGE" | cut -f1 -d:)"
216+ docker buildx imagetools create \
217+ $(jq -cr '.tags | map("--tag " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $DOCKER_APP_IMAGE_ARM64 $DOCKER_APP_IMAGE_X64
0 commit comments