|
42 | 42 | default: 'false' |
43 | 43 |
|
44 | 44 | jobs: |
| 45 | + changes: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + # Set job outputs to values from filter step |
| 48 | + outputs: |
| 49 | + changed: ${{ steps.filter.outputs.changed }} |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v5 |
| 52 | + # For pull requests it's not necessary to checkout the code but for the main branch it is |
| 53 | + - uses: dorny/paths-filter@v3 |
| 54 | + id: filter |
| 55 | + with: |
| 56 | + filters: | |
| 57 | + changed: |
| 58 | + - backend/** |
| 59 | + - frontend/** |
| 60 | + - .env |
| 61 | + - docker-compose*.yml |
| 62 | + - .github/workflows/playwright.yml |
45 | 63 |
|
46 | | - test: |
| 64 | + test-playwright: |
| 65 | + needs: |
| 66 | + - changes |
| 67 | + if: ${{ needs.changes.outputs.changed == 'true' }} |
47 | 68 | timeout-minutes: 60 |
48 | 69 | runs-on: ubuntu-latest |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + shardIndex: [1, 2, 3, 4] |
| 73 | + shardTotal: [4] |
| 74 | + fail-fast: false |
49 | 75 | steps: |
50 | | - - uses: actions/checkout@v4 |
51 | | - - uses: actions/setup-node@v4 |
| 76 | + - uses: actions/checkout@v5 |
| 77 | + - uses: actions/setup-node@v5 |
52 | 78 | with: |
53 | 79 | node-version: lts/* |
54 | | - - uses: actions/setup-python@v5 |
| 80 | + - uses: actions/setup-python@v6 |
55 | 81 | with: |
56 | 82 | python-version: '3.10' |
57 | 83 | - name: Setup tmate session |
58 | 84 | uses: mxschmitt/action-tmate@v3 |
59 | 85 | if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }} |
60 | 86 | with: |
61 | 87 | limit-access-to-actor: true |
62 | | - - name: Install dependencies |
63 | | - run: npm ci |
64 | | - working-directory: frontend |
65 | | - - name: Install Playwright Browsers |
66 | | - run: npx playwright install --with-deps |
| 88 | + - name: Install uv |
| 89 | + uses: astral-sh/setup-uv@v6 |
| 90 | + with: |
| 91 | + version: "0.4.15" |
| 92 | + enable-cache: true |
| 93 | + - run: uv sync |
| 94 | + working-directory: backend |
| 95 | + - run: npm ci |
67 | 96 | working-directory: frontend |
| 97 | + - run: uv run bash scripts/generate-client.sh |
| 98 | + env: |
| 99 | + VIRTUAL_ENV: backend/.venv |
68 | 100 | - run: docker compose build |
69 | 101 | - run: docker compose down -v --remove-orphans |
70 | | - - run: docker compose up -d --wait backend mailcatcher |
71 | 102 | - name: Run Playwright tests |
72 | | - run: npx playwright test --fail-on-flaky-tests --trace=retain-on-failure |
73 | | - working-directory: frontend |
| 103 | + run: docker compose run --rm playwright npx playwright test --fail-on-flaky-tests --trace=retain-on-failure --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} |
74 | 104 | - run: docker compose down -v --remove-orphans |
75 | | - - uses: actions/upload-artifact@v4 |
76 | | - if: always() |
| 105 | + - name: Upload blob report to GitHub Actions Artifacts |
| 106 | + if: ${{ !cancelled() }} |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: blob-report-${{ matrix.shardIndex }} |
| 110 | + path: frontend/blob-report |
| 111 | + include-hidden-files: true |
| 112 | + retention-days: 1 |
| 113 | + |
| 114 | + merge-playwright-reports: |
| 115 | + needs: |
| 116 | + - test-playwright |
| 117 | + - changes |
| 118 | + # Merge reports after playwright-tests, even if some shards have failed |
| 119 | + if: ${{ !cancelled() && needs.changes.outputs.changed == 'true' }} |
| 120 | + runs-on: ubuntu-latest |
| 121 | + steps: |
| 122 | + - uses: actions/checkout@v5 |
| 123 | + - uses: actions/setup-node@v5 |
| 124 | + with: |
| 125 | + node-version: 20 |
| 126 | + - name: Install dependencies |
| 127 | + run: npm ci |
| 128 | + working-directory: frontend |
| 129 | + - name: Download blob reports from GitHub Actions Artifacts |
| 130 | + uses: actions/download-artifact@v5 |
| 131 | + with: |
| 132 | + path: frontend/all-blob-reports |
| 133 | + pattern: blob-report-* |
| 134 | + merge-multiple: true |
| 135 | + - name: Merge into HTML Report |
| 136 | + run: npx playwright merge-reports --reporter html ./all-blob-reports |
| 137 | + working-directory: frontend |
| 138 | + - name: Upload HTML report |
| 139 | + uses: actions/upload-artifact@v4 |
77 | 140 | with: |
78 | | - name: playwright-report |
79 | | - path: frontend/playwright-report/ |
| 141 | + name: html-report--attempt-${{ github.run_attempt }} |
| 142 | + path: frontend/playwright-report |
80 | 143 | retention-days: 30 |
81 | 144 | include-hidden-files: true |
82 | 145 |
|
83 | 146 | # https://github.com/marketplace/actions/alls-green#why |
84 | | - e2e-alls-green: # This job does nothing and is only used for the branch protection |
| 147 | + alls-green-playwright: # This job does nothing and is only used for the branch protection |
85 | 148 | if: always() |
86 | 149 | needs: |
87 | | - - test |
| 150 | + - test-playwright |
88 | 151 | runs-on: ubuntu-latest |
89 | 152 | steps: |
90 | 153 | - name: Decide whether the needed jobs succeeded or failed |
91 | 154 | uses: re-actors/alls-green@release/v1 |
92 | 155 | with: |
93 | 156 | jobs: ${{ toJSON(needs) }} |
| 157 | + allowed-skips: test-playwright |
0 commit comments