Skip to content

Commit c1aa106

Browse files
authored
fix multiplatform builds and ensure test artifacts are copied out (#25)
* fix multiplatform builds ref BerkeleyLibrary/gha-testing#3 * copy out build artifacts
1 parent dd61e3d commit c1aa106

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ jobs:
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
@@ -66,6 +68,7 @@ jobs:
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

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
1919

20-
- name: Set up QEMU
21-
uses: docker/setup-qemu-action@v3
22-
2320
- name: Set up Docker Buildx
2421
uses: docker/setup-buildx-action@v3
2522

@@ -41,7 +38,7 @@ jobs:
4138
env:
4239
BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }}
4340
run: |
44-
docker pull "$BASE_IMAGE"
41+
docker manifest inspect "$BASE_IMAGE"
4542
4643
- name: Produce release tags
4744
id: tag-meta
@@ -59,5 +56,6 @@ jobs:
5956
env:
6057
BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }}
6158
run: |
62-
echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$BASE_IMAGE"
63-
docker push --all-tags "$(echo "$BASE_IMAGE" | cut -f1 -d:)"
59+
docker buildx imagetools create \
60+
$(jq -cr '.tags | map("--tag " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
61+
"$(echo "$BASE_IMAGE" | cut -f1 -d:)"

0 commit comments

Comments
 (0)