A local-first personal finance app
[AI] CI: Support parallel e2e shards locally with per-shard port (#8456)
Stephen Brown IId36e564e6c22
diff --git a/.actrc b/.actrcnew file mode 100644index 0000000000..73d744a7ac--- /dev/null+++ b/.actrc@@ -0,0 +1,2 @@+-P depot-ubuntu-latest=catthehacker/ubuntu:act-latest+-P depot-ubuntu-latest-4=catthehacker/ubuntu:act-latestdiff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.ymlindex fd3b3f9938..8710aaf3be 100644--- a/.github/workflows/e2e-test.yml+++ b/.github/workflows/e2e-test.yml@@ -57,7 +57,7 @@ jobs:overwrite: truefunctional:- name: Functional (shard ${{ matrix.shard }}/3)+ name: Functional (shard ${{ matrix.shard }}/${{ vars.E2E_SHARD_TOTAL || '3' }})runs-on: depot-ubuntu-latest-4needs: build-webstrategy:@@ -83,10 +83,16 @@ jobs:with:name: desktop-client-buildpath: packages/desktop-client/build/+ - name: Set E2E port+ if: ${{ matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}+ run: echo "E2E_PORT=$((3000 + ${{ matrix.shard }}))" >> "$GITHUB_ENV"- name: Run E2E Tests- run: yarn e2e --shard=${{ matrix.shard }}/3+ if: ${{ matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}+ env:+ SHARD_TOTAL: ${{ vars.E2E_SHARD_TOTAL || '3' }}+ run: yarn e2e --shard=${{ matrix.shard }}/$SHARD_TOTAL- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- if: failure()+ if: ${{ failure() && matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}with:name: desktop-client-test-results-shard-${{ matrix.shard }}path: packages/desktop-client/test-results/@@ -94,7 +100,7 @@ jobs:overwrite: true- name: Upload E2E JUnit reportuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- if: ${{ !cancelled() }}+ if: ${{ !cancelled() && matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}with:name: e2e-junit-${{ matrix.shard }}path: packages/desktop-client/test-results/junit.xml@@ -162,7 +168,7 @@ jobs:path: packages/desktop-electron/e2e/test-results/junit.xmlvrt:- name: Visual regression (shard ${{ matrix.shard }}/3)+ name: Visual regression (shard ${{ matrix.shard }}/${{ vars.E2E_SHARD_TOTAL || '3' }})runs-on: depot-ubuntu-latestneeds: build-webstrategy:@@ -188,10 +194,16 @@ jobs:with:name: desktop-client-buildpath: packages/desktop-client/build/+ - name: Set E2E port+ if: ${{ matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}+ run: echo "E2E_PORT=$((3000 + ${{ matrix.shard }}))" >> "$GITHUB_ENV"- name: Run VRT Tests- run: yarn vrt --shard=${{ matrix.shard }}/3+ if: ${{ matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}+ env:+ SHARD_TOTAL: ${{ vars.E2E_SHARD_TOTAL || '3' }}+ run: yarn vrt --shard=${{ matrix.shard }}/$SHARD_TOTAL- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- if: always()+ if: ${{ always() && matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}with:name: vrt-blob-report-${{ matrix.shard }}path: packages/desktop-client/blob-report/@@ -199,7 +211,7 @@ jobs:overwrite: true- name: Upload VRT JUnit reportuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- if: ${{ !cancelled() }}+ if: ${{ !cancelled() && matrix.shard <= fromJson(vars.E2E_SHARD_TOTAL || '3') }}with:name: vrt-junit-${{ matrix.shard }}path: packages/desktop-client/test-results/junit.xmldiff --git a/packages/desktop-client/playwright.config.ts b/packages/desktop-client/playwright.config.tsindex a2366fe646..b48b6db452 100644--- a/packages/desktop-client/playwright.config.ts+++ b/packages/desktop-client/playwright.config.ts@@ -2,11 +2,13 @@ import path from 'node:path';import { defineConfig } from '@playwright/test';+const e2ePort = Number(process.env.E2E_PORT) || 3001;+export default defineConfig({timeout: 60000, // 60 secondsretries: 1,fullyParallel: true,- workers: process.env.CI ? 4 : undefined,+ workers: Number(process.env.E2E_WORKERS) || (process.env.CI ? 4 : undefined),testDir: 'e2e/',reporter: process.env.CI? [['blob'], ['list'], ['junit', { outputFile: 'test-results/junit.xml' }]]@@ -15,7 +17,7 @@ export default defineConfig({userAgent: 'playwright',screenshot: 'only-on-failure',browserName: 'chromium',- baseURL: process.env.E2E_START_URL ?? 'http://localhost:3001',+ baseURL: process.env.E2E_START_URL ?? `http://localhost:${e2ePort}`,trace: 'on-first-retry',ignoreHTTPSErrors: true,},@@ -39,9 +41,9 @@ export default defineConfig({: {cwd: path.join(__dirname, '..', '..'),command: process.env.E2E_USE_BUILD- ? 'node packages/desktop-client/bin/serve-build.mjs'+ ? `PORT=${e2ePort} node packages/desktop-client/bin/serve-build.mjs`: 'yarn start',- url: 'http://localhost:3001',+ url: `http://localhost:${e2ePort}`,reuseExistingServer: !process.env.CI,stdout: 'ignore',stderr: 'pipe',diff --git a/upcoming-release-notes/ci-e2e-shard-guard.md b/upcoming-release-notes/ci-e2e-shard-guard.mdnew file mode 100644index 0000000000..ae87ac287f--- /dev/null+++ b/upcoming-release-notes/ci-e2e-shard-guard.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [StephenBrown2]+---++E2E test fixes for easier local runs