From 2a615a644ad8a72c328817dc83eeba5ee43dee41 Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Mon, 15 Dec 2025 00:31:53 +0100 Subject: [PATCH] CI: split arm64 and amd64 jobs --- .github/workflows/main.yml | 72 +++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 447d518..af9ff16 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,19 +13,80 @@ on: env: REGISTRY: git.wylab.me IMAGE_NAME: wylab/ws14-docker-linux-server - TARGET_PLATFORM: linux-x64 WYLAB_SOURCE_REPO: https://git.wylab.me/wylab/wylab-station-14.git WYLAB_SOURCE_REF: master - BUILD_CACHE_SCOPE: ws14-docker-linux-server BUILDKIT_PROGRESS: plain jobs: - build-and-push-image: + build-arm64: runs-on: ubuntu-latest timeout-minutes: 240 permissions: contents: read packages: write + env: + TARGET_PLATFORM: linux-arm64 + BUILD_CACHE_SCOPE: ws14-docker-linux-server-arm64 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Resolve wylab commit + id: wylab + env: + PAYLOAD_COMMIT: ${{ github.event.client_payload.commit }} + run: | + set -euo pipefail + if [ -n "${PAYLOAD_COMMIT}" ]; then + COMMIT="${PAYLOAD_COMMIT}" + else + REF="${WYLAB_SOURCE_REF}" + COMMIT=$(git ls-remote "${WYLAB_SOURCE_REPO}" "${REF}" | head -n1 | cut -f1) + fi + if [ -z "${COMMIT}" ]; then + echo "Unable to resolve commit to build." >&2 + exit 1 + fi + echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME || github.actor }} + password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image (arm64) + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + platforms: linux/arm64 + cache-from: | + type=gha,scope=${{ env.BUILD_CACHE_SCOPE }} + cache-to: | + type=gha,scope=${{ env.BUILD_CACHE_SCOPE }},mode=max,compression=zstd + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:arm64 + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64 + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }}-arm64 + build-args: | + SOURCE_REPO=${{ env.WYLAB_SOURCE_REPO }} + SOURCE_REF=${{ steps.wylab.outputs.commit }} + TARGET_PLATFORM=${{ env.TARGET_PLATFORM }} + + build-amd64: + runs-on: ubuntu-latest + timeout-minutes: 240 + permissions: + contents: read + packages: write + env: + TARGET_PLATFORM: linux-x64 + BUILD_CACHE_SCOPE: ws14-docker-linux-server-amd64 steps: - name: Checkout repository uses: actions/checkout@v4 @@ -63,7 +124,7 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME || github.actor }} password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build and push Docker image (amd64) uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: context: . @@ -77,6 +138,9 @@ jobs: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:amd64 + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }}-amd64 build-args: | SOURCE_REPO=${{ env.WYLAB_SOURCE_REPO }} SOURCE_REF=${{ steps.wylab.outputs.commit }}