CI: unit tests in two shards; end-to-end in three (#76)
The first main sync with everything in (a84e06b) went from push to green in 9 min 59 s. Two paths now set that time: CI, Deploy and the live test (567 s), and the end-to-end suite (529 s), whose second shard grew to 433 s of tests with the agent review and task suites. The agent suites (agentic, review, tasks) get their own shard, and the unit tests run as two vitest shards, since they were the longer of CI's two jobs (179 s). Claude-Session: https://claude.ai/code/session_01Ruyx3Qr4jYrZEpPi466deb Co-authored-by: Claude <noreply@anthropic.com>
Canberk Demirci authored · GitHub committed signed1 parent d305aa2commit fcbd993fe1540d348113fd1c63286258f2cbc281Browse files
2 files changed+17−3
modified.github/workflows/ci.yml+7−2View file
| @@ -39,9 +39,14 @@ | ||
| 39 | 39 | run: pnpm exec wrangler deploy --dry-run --env dev --outdir dist |
| 40 | 40 | |
| 41 | 41 | test: |
| 42 | - name: Unit tests | |
| 42 | + name: Unit tests (${{ matrix.shard }}/2) | |
| 43 | 43 | runs-on: ubuntu-latest |
| 44 | 44 | timeout-minutes: 20 |
| 45 | + # Two halves of every package's test files, side by side: CI is the first step of a deploy. | |
| 46 | + strategy: | |
| 47 | + fail-fast: false | |
| 48 | + matrix: | |
| 49 | + shard: [1, 2] | |
| 45 | 50 | steps: |
| 46 | 51 | - uses: actions/checkout@v4 |
| 47 | 52 | - uses: pnpm/action-setup@v4 |
| @@ -53,4 +58,4 @@ | ||
| 53 | 58 | - name: Build |
| 54 | 59 | run: pnpm -r --if-present build |
| 55 | 60 | - name: Unit tests |
| 56 | - run: pnpm -r --if-present test | |
| 61 | + run: pnpm -r --if-present run test --shard=${{ matrix.shard }}/2 |
modified.github/workflows/e2e.yml+10−1View file
| @@ -26,6 +26,8 @@ | ||
| 26 | 26 | include: |
| 27 | 27 | - name: git, PRs, Actions |
| 28 | 28 | shard: core |
| 29 | + - name: agent reviews, tasks, Today | |
| 30 | + shard: agents | |
| 29 | 31 | - name: passkeys, registry, email, security |
| 30 | 32 | shard: rest |
| 31 | 33 | steps: |
| @@ -42,6 +44,13 @@ | ||
| 42 | 44 | - name: Run the shard's tests |
| 43 | 45 | working-directory: apps/diffinery |
| 44 | 46 | run: | |
| 45 | - if [ "${{ matrix.shard }}" = core ]; then files=test/e2e/e2e.test.mjs; else files=$(ls test/e2e/*.test.mjs | grep -v '/e2e\.test\.mjs$'); fi | |
| 47 | + # Shards of similar length; a new test file runs in "rest" unless it's added to another. | |
| 48 | + core='/e2e\.test\.mjs$' | |
| 49 | + agents='/(agentic|review|tasks)\.test\.mjs$' | |
| 50 | + case "${{ matrix.shard }}" in | |
| 51 | + core) files=$(ls test/e2e/*.test.mjs | grep -E "$core") ;; | |
| 52 | + agents) files=$(ls test/e2e/*.test.mjs | grep -E "$agents") ;; | |
| 53 | + *) files=$(ls test/e2e/*.test.mjs | grep -vE "$core|$agents") ;; | |
| 54 | + esac | |
| 46 | 55 | echo "$files" |
| 47 | 56 | node --test --test-concurrency=1 --test-timeout=600000 $files |