|
| 1 | +name: Playwright Tests |
| 2 | +on: [workflow_dispatch, workflow_call] |
| 3 | +jobs: |
| 4 | + e2e_tests: |
| 5 | + timeout-minutes: 60 |
| 6 | + runs-on: ubuntu-latest |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + # Make sure to require each shard in GitHub! |
| 11 | + shardIndex: [1, 2, 3, 4] |
| 12 | + shardTotal: [4] |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - uses: actions/setup-node@v4 |
| 17 | + with: |
| 18 | + node-version: lts/* |
| 19 | + |
| 20 | + - name: Install dependencies |
| 21 | + run: npm ci |
| 22 | + |
| 23 | + - name: Install Playwright browsers |
| 24 | + run: npx playwright install --with-deps |
| 25 | + |
| 26 | + - name: Start MongoDB |
| 27 | + uses: supercharge/mongodb-github-action@1.12.0 |
| 28 | + with: |
| 29 | + mongodb-version: "8.0" |
| 30 | + |
| 31 | + - name: Run Playwright tests |
| 32 | + run: npx cross-env NODE_ENV=test playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} |
| 33 | + |
| 34 | + - name: Upload blob report to GitHub Actions Artifacts |
| 35 | + if: ${{ !cancelled() }} |
| 36 | + uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: blob-report-${{ matrix.shardIndex }} |
| 39 | + path: blob-report |
| 40 | + retention-days: 1 |
| 41 | + |
| 42 | + merge_reports: |
| 43 | + # Merge reports after playwright-tests, even if some shards have failed |
| 44 | + if: ${{ !cancelled() }} |
| 45 | + needs: [e2e_tests] |
| 46 | + |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + - uses: actions/setup-node@v4 |
| 51 | + with: |
| 52 | + node-version: lts/* |
| 53 | + - name: Install dependencies |
| 54 | + run: npm ci |
| 55 | + |
| 56 | + - name: Download blob reports from GitHub Actions Artifacts |
| 57 | + uses: actions/download-artifact@v4 |
| 58 | + with: |
| 59 | + path: all-blob-reports |
| 60 | + pattern: blob-report-* |
| 61 | + merge-multiple: true |
| 62 | + |
| 63 | + - name: Merge into HTML Report |
| 64 | + run: npx playwright merge-reports --reporter html ./all-blob-reports |
| 65 | + |
| 66 | + - name: Upload HTML report |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: html-report--attempt-${{ github.run_attempt }} |
| 70 | + path: playwright-report |
| 71 | + retention-days: 14 |
0 commit comments