| 1 | name: End-to-end |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | pull_request: |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | |
| 11 | concurrency: |
| 12 | group: e2e-${{ github.ref }} |
| 13 | cancel-in-progress: true |
| 14 | |
| 15 | jobs: |
| 16 | # The suite in two parallel shards of about the same length: the git, pull request |
| 17 | # and Actions file on its own, and every other test/e2e/*.test.mjs file (so a new |
| 18 | # file runs without editing this). Only the second shard needs a browser (passkeys). |
| 19 | e2e: |
| 20 | name: End-to-end (${{ matrix.name }}) |
| 21 | runs-on: ubuntu-latest |
| 22 | timeout-minutes: 20 |
| 23 | strategy: |
| 24 | fail-fast: false |
| 25 | matrix: |
| 26 | include: |
| 27 | - name: git, PRs, Actions |
| 28 | shard: core |
| 29 | - name: agent reviews, tasks, Today |
| 30 | shard: agents |
| 31 | - name: security |
| 32 | shard: security |
| 33 | - name: passkeys, registry, email |
| 34 | shard: rest |
| 35 | steps: |
| 36 | - uses: actions/checkout@v4 |
| 37 | - uses: pnpm/action-setup@v4 |
| 38 | - uses: actions/setup-node@v4 |
| 39 | with: |
| 40 | node-version: 22 |
| 41 | cache: pnpm |
| 42 | - run: pnpm install --frozen-lockfile |
| 43 | - run: pnpm -r --if-present build |
| 44 | - if: matrix.shard == 'rest' |
| 45 | run: pnpm --filter @diffinery/app exec playwright install --with-deps chromium |
| 46 | - name: Run the shard's tests |
| 47 | working-directory: apps/diffinery |
| 48 | run: | |
| 49 | # Shards of similar length; a new test file runs in "rest" unless it's added to another. |
| 50 | core='/e2e\.test\.mjs$' |
| 51 | agents='/(agentic|review|tasks)\.test\.mjs$' |
| 52 | security='/security\.test\.mjs$' |
| 53 | case "${{ matrix.shard }}" in |
| 54 | core) files=$(ls test/e2e/*.test.mjs | grep -E "$core") ;; |
| 55 | agents) files=$(ls test/e2e/*.test.mjs | grep -E "$agents") ;; |
| 56 | security) files=$(ls test/e2e/*.test.mjs | grep -E "$security") ;; |
| 57 | *) files=$(ls test/e2e/*.test.mjs | grep -vE "$core|$agents|$security") ;; |
| 58 | esac |
| 59 | echo "$files" |
| 60 | node --test --test-concurrency=1 --test-timeout=600000 $files |