From e2925f9723c7222645806f2abe3e0538c8f8addd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Mon, 30 Mar 2026 13:42:57 +0100 Subject: [PATCH] ci: extract shared build job from E2E test shards (#498) --- .github/workflows/e2e-tests.yml | 82 +++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index b003d9a990..f958d7995d 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -28,14 +28,10 @@ permissions: contents: read jobs: - e2e: - name: E2E Shard ${{ matrix.shard }}/10 + build: + name: Build runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + timeout-minutes: 10 steps: - name: Checkout code @@ -61,14 +57,80 @@ jobs: working-directory: apps run: pnpm install --frozen-lockfile + - name: Build backend and web + run: make build-backend build-web + + - name: Upload backend build + uses: actions/upload-artifact@v4 + with: + name: e2e-backend-build + path: apps/backend/bin/ + retention-days: 1 + + # Tar the .next directory to preserve pnpm symlinks in the standalone build. + # upload-artifact dereferences symlinks which breaks the Node.js module resolution. + - name: Package web build + run: tar -cf apps/web/next-build.tar -C apps/web .next + + - name: Upload web build + uses: actions/upload-artifact@v4 + with: + name: e2e-web-build + path: apps/web/next-build.tar + retention-days: 1 + + e2e: + name: E2E Shard ${{ matrix.shard }}/10 + needs: build + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: "9" + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "24" + + - name: Install dependencies + working-directory: apps + run: pnpm install --frozen-lockfile + - name: Install Playwright browsers working-directory: apps/web run: npx playwright install chromium --with-deps - - name: Build backend and web - run: make build-backend build-web + - name: Download backend build + uses: actions/download-artifact@v4 + with: + name: e2e-backend-build + path: apps/backend/bin/ - - name: Run E2E tests (shard ${{ matrix.shard }}/4) + - name: Make backend binaries executable + run: chmod +x apps/backend/bin/* + + - name: Download web build + uses: actions/download-artifact@v4 + with: + name: e2e-web-build + path: apps/web/ + + - name: Extract web build + working-directory: apps/web + run: tar -xf next-build.tar && rm next-build.tar + + - name: Run E2E tests (shard ${{ matrix.shard }}/10) working-directory: apps/web run: npx playwright test --config e2e/playwright.config.ts --shard=${{ matrix.shard }}/10