diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d50df25..2fe46d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,9 +20,11 @@ jobs: strategy: fail-fast: false matrix: - runner: - - ubuntu-24.04 - - ubuntu-24.04-arm + include: + - platform: linux/amd64 + runner: ubuntu-24.04 + - platform: linux/arm64 + runner: ubuntu-24.04-arm steps: - name: Checkout code uses: actions/checkout@v4 @@ -66,6 +68,7 @@ jobs: name: Build/push the arch-specific image uses: docker/build-push-action@v6 with: + platforms: ${{ matrix.platform }} build-args: | BUILD_TIMESTAMP=${{ github.event.repository.updated_at }} BUILD_URL=${{ steps.set_build_url.outputs.build_url }} @@ -86,7 +89,7 @@ jobs: echo "image-${RUNNER_ARCH,,}=${{ steps.get-registry.outputs.registry }}@${{ steps.build.outputs.digest }}" | tee -a "$GITHUB_OUTPUT" merge: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest needs: - build env: @@ -94,6 +97,8 @@ jobs: DOCKER_APP_IMAGE_X64: ${{ needs.build.outputs.build-image-x64 }} outputs: build-image: ${{ steps.meta.outputs.tags }} + build-image-arm: ${{ needs.build.outputs.build-image-arm }} + build-image-x64: ${{ needs.build.outputs.build-image-x64 }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -123,7 +128,7 @@ jobs: "$DOCKER_APP_IMAGE_ARM64" "$DOCKER_APP_IMAGE_X64" test: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest needs: - merge env: @@ -143,6 +148,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set ARTIFACTS_DIR + run: echo "ARTIFACTS_DIR=${RUNNER_TEMP}/artifacts" >> $GITHUB_ENV + + - name: Create the artifacts directory + run: mkdir -p "$ARTIFACTS_DIR" + - name: Run the test script env: LIT_TIND_API_KEY: ${{ secrets.LIT_TIND_API_KEY }} @@ -151,17 +162,38 @@ jobs: docker compose up --detach --wait docker compose exec app bin/test + - name: Copy out artifacts + if: ${{ always() }} + run: | + docker compose cp app:/opt/app/artifacts "${ARTIFACTS_DIR}/" + docker compose logs | tee "${ARTIFACTS_DIR}/docker-services.log" + docker compose config | tee "${ARTIFACTS_DIR}/docker-compose.merged.yml" + docker events --json --since $TEST_START --until `date +%s` | tee "${ARTIFACTS_DIR}/docker-events.json" + + - name: Upload test report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: avplayer Test Report (${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}) + path: ${{ env.ARTIFACTS_DIR }} + if-no-files-found: error + push: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest needs: - merge - test env: DOCKER_APP_IMAGE: ${{ needs.merge.outputs.build-image }} + DOCKER_APP_IMAGE_ARM64: ${{ needs.merge.outputs.build-image-arm }} + DOCKER_APP_IMAGE_X64: ${{ needs.merge.outputs.build-image-x64 }} steps: - name: Checkout code uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -181,6 +213,5 @@ jobs: - name: Retag and push the image run: | - docker pull "$DOCKER_APP_IMAGE" - echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$DOCKER_APP_IMAGE" - docker push --all-tags "$(echo "$DOCKER_APP_IMAGE" | cut -f1 -d:)" + docker buildx imagetools create \ + $(jq -cr '.tags | map("--tag " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $DOCKER_APP_IMAGE_ARM64 $DOCKER_APP_IMAGE_X64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb194b0..b9a9c62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,9 +17,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -41,7 +38,7 @@ jobs: env: BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }} run: | - docker pull "$BASE_IMAGE" + docker manifest inspect "$BASE_IMAGE" - name: Produce release tags id: tag-meta @@ -59,5 +56,6 @@ jobs: env: BASE_IMAGE: ${{ steps.get-base-image.outputs.tags }} run: | - echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$BASE_IMAGE" - docker push --all-tags "$(echo "$BASE_IMAGE" | cut -f1 -d:)" + docker buildx imagetools create \ + $(jq -cr '.tags | map("--tag " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + "$(echo "$BASE_IMAGE" | cut -f1 -d:)"