From f6d89f03b226e0f529bcd3979758a084c291a9dc Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Aug 2026 13:24:11 +0200 Subject: [PATCH] ci: build and publish amd64 preview independently of e2e The amd64 digest build moves to its own job that runs right after the fast gate, so the homarr-test image ships even while (or if) e2e is still running or fails. The container job is now e2e-only with its own docker cache scope. --- .github/workflows/ci.yml | 104 +++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c6c6a32b..23992359b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,9 +115,6 @@ jobs: timeout-minutes: 30 permissions: contents: read - packages: write - outputs: - digest: ${{ steps.preview-build.outputs.digest }} steps: - uses: actions/checkout@v7 if: "!env.ACT" @@ -148,8 +145,8 @@ jobs: org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.ref.name=pr-${{ github.event.pull_request.number || inputs.pr_number || 'none' }} - cache-from: type=gha,scope=homarr-linux-amd64 - cache-to: type=gha,scope=homarr-linux-amd64,mode=max + cache-from: type=gha,scope=homarr-e2e + cache-to: type=gha,scope=homarr-e2e,mode=max secrets: | TURBO_API=${{ secrets.TURBO_API }} TURBO_TEAM=${{ secrets.TURBO_TEAM }} @@ -173,46 +170,6 @@ jobs: DOCKER_BUILDKIT=1 docker build --platform linux/amd64 \ --tag homarr-ci --tag homarr-e2e "${secret_args[@]}" . - - name: Log in to GHCR for preview publication - if: | - !env.ACT && - ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'push' && github.ref == 'refs/heads/release/v2') || - (github.event_name == 'workflow_dispatch' && inputs.operation == 'publish') - ) - uses: docker/login-action@v4 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push amd64 preview image by digest - id: preview-build - if: | - !env.ACT && - ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'push' && github.ref == 'refs/heads/release/v2') || - (github.event_name == 'workflow_dispatch' && inputs.operation == 'publish') - ) - uses: docker/build-push-action@v7 - with: - context: . - network: host - platforms: linux/amd64 - outputs: type=image,"name=${{ env.PREVIEW_IMAGE }}",push-by-digest=true,name-canonical=true,push=true - cache-from: type=gha,scope=homarr-linux-amd64 - secrets: | - TURBO_API=${{ secrets.TURBO_API }} - TURBO_TEAM=${{ secrets.TURBO_TEAM }} - TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} - TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} - - - name: Show Act publication result - if: env.ACT - run: echo "Act validated the publication path; external GHCR writes are disabled locally." - - name: Cache Playwright browsers if: "!env.ACT" id: playwright-cache @@ -243,6 +200,58 @@ jobs: path: e2e/test-results/ retention-days: 7 + preview-amd64: + name: Build amd64 preview image + needs: fast-gate + if: | + ( + (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'push' && github.ref == 'refs/heads/release/v2') || + (github.event_name == 'workflow_dispatch' && inputs.operation == 'publish') + ) + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + packages: write + outputs: + digest: ${{ steps.preview-build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + if: "!env.ACT" + with: + persist-credentials: false + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }} + + - name: Log in to GHCR + if: "!env.ACT" + uses: docker/login-action@v4 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + if: "!env.ACT" + uses: docker/setup-buildx-action@v4 + + - name: Build and push amd64 preview image by digest + id: preview-build + if: "!env.ACT" + uses: docker/build-push-action@v7 + with: + context: . + network: host + platforms: linux/amd64 + outputs: type=image,"name=${{ env.PREVIEW_IMAGE }}",push-by-digest=true,name-canonical=true,push=true + cache-from: type=gha,scope=homarr-linux-amd64 + cache-to: type=gha,scope=homarr-linux-amd64,mode=max + secrets: | + TURBO_API=${{ secrets.TURBO_API }} + TURBO_TEAM=${{ secrets.TURBO_TEAM }} + TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} + TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} + preview-arm64: name: Build arm64 preview image needs: fast-gate @@ -297,9 +306,8 @@ jobs: publish-preview: name: Publish multi-platform preview image - needs: [container, preview-arm64] + needs: [preview-amd64, preview-arm64] if: | - always() && ( (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.ref == 'refs/heads/release/v2') || @@ -349,7 +357,7 @@ jobs: - name: Publish preview manifest if: "!env.ACT" env: - AMD64_DIGEST: ${{ needs.container.outputs.digest }} + AMD64_DIGEST: ${{ needs.preview-amd64.outputs.digest }} ARM64_DIGEST: ${{ needs.preview-arm64.outputs.digest }} run: | docker buildx imagetools create -t "${PREVIEW_IMAGE}:${PREVIEW_TAG}" \