| 1 | name: CI |
| 2 | |
| 3 | # Deploy waits for this workflow to pass on main. The end-to-end suite is its own |
| 4 | # workflow (e2e.yml), so deploys don't wait for it too. |
| 5 | |
| 6 | on: |
| 7 | push: |
| 8 | branches: [main] |
| 9 | pull_request: |
| 10 | |
| 11 | permissions: |
| 12 | contents: read |
| 13 | |
| 14 | concurrency: |
| 15 | group: ci-${{ github.ref }} |
| 16 | cancel-in-progress: true |
| 17 | |
| 18 | jobs: |
| 19 | # Two jobs in parallel: each needs the install and build, but typecheck and the unit |
| 20 | # tests together took longer than either does alone. |
| 21 | typecheck: |
| 22 | name: Typecheck and bundle |
| 23 | runs-on: ubuntu-latest |
| 24 | timeout-minutes: 20 |
| 25 | steps: |
| 26 | - uses: actions/checkout@v4 |
| 27 | - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 |
| 28 | - uses: actions/setup-node@v4 |
| 29 | with: |
| 30 | node-version: 22 |
| 31 | cache: pnpm |
| 32 | - run: pnpm install --frozen-lockfile |
| 33 | - name: Build |
| 34 | run: pnpm -r --if-present build |
| 35 | - name: Typecheck |
| 36 | run: pnpm -r --if-present typecheck |
| 37 | - name: Bundle the Worker (dry run) |
| 38 | working-directory: apps/diffinery |
| 39 | run: pnpm exec wrangler deploy --dry-run --env dev --outdir dist |
| 40 | |
| 41 | test: |
| 42 | name: Unit tests (${{ matrix.shard }}/2) |
| 43 | runs-on: ubuntu-latest |
| 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] |
| 50 | steps: |
| 51 | - uses: actions/checkout@v4 |
| 52 | - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 |
| 53 | - uses: actions/setup-node@v4 |
| 54 | with: |
| 55 | node-version: 22 |
| 56 | cache: pnpm |
| 57 | - run: pnpm install --frozen-lockfile |
| 58 | - name: Build |
| 59 | run: pnpm -r --if-present build |
| 60 | - name: Unit tests |
| 61 | run: pnpm -r --if-present run test --shard=${{ matrix.shard }}/2 |