From d06b0633d3e8af760fa0a7d287d9ff4a6cee36d4 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Tue, 10 Feb 2026 13:21:05 +0100 Subject: [PATCH] add sharding for e2e tests in CI --- .github/workflows/playwright.yml | 47 ++++++++++++++++++++++++++++---- playwright.config.ts | 2 +- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 98432491..c7b19cd1 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -6,6 +6,11 @@ jobs: test: runs-on: ubuntu-latest timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + shardIndex: [1, 2, 3, 4] + shardTotal: [4] services: mailpit: @@ -67,16 +72,48 @@ jobs: run: npx playwright install --with-deps - name: "Run Playwright tests" - run: npx playwright test + run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} env: PLAYWRIGHT_BASE_URL: 'http://127.0.0.1:8000' MAILPIT_BASE_URL: 'http://localhost:8025' - - name: "Upload test results" + - name: "Upload blob report" uses: actions/upload-artifact@v4 if: always() with: - name: test-results - path: test-results/ - retention-days: 30 + name: blob-report-${{ matrix.shardIndex }} + path: blob-report/ + retention-days: 7 + merge-reports: + if: always() + needs: [test] + runs-on: ubuntu-latest + steps: + - name: "Checkout code" + uses: actions/checkout@v4 + + - name: "Setup node" + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: "Install dependencies" + run: npm ci + + - name: "Download blob reports" + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: blob-report-* + merge-multiple: true + + - name: "Merge reports" + run: npx playwright merge-reports --reporter html ./all-blob-reports + + - name: "Upload merged HTML report" + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/playwright.config.ts b/playwright.config.ts index f588a60a..36d7381a 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ /* Run tests in parallel */ workers: 4, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: process.env.CI ? 'line' : 'html', + reporter: process.env.CI ? 'blob' : 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */