From 6d9163d4418fb41f659c5a11587e6d6a0856b7e2 Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Sat, 6 Jun 2026 01:46:52 +0900 Subject: [PATCH] ci: shard checkly unit and e2e tests into 2 vitest shards Windows test runs (unit and e2e) had grown slow again. Split the checkly test suites into two vitest shards each, run in parallel across the os matrix, while leaving create-checkly unsharded. The test job is now matrixed by package via a `target` dimension so a single definition covers both packages. The `--shard` flag is forwarded without a `--` separator: pnpm inserts a `--` when forwarding args after one, which makes vitest treat `--shard` as a test-name filter and silently run the full suite on every shard. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/test.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 523785232..5cca0c328 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest-x64] - name: test - ${{ matrix.os }} + # checkly is sharded into two; create-checkly runs unsharded (empty + # shard). `id` is a filesystem-safe label since the shard string + # contains a '/', which is invalid in artifact names. + target: + - { package: checkly, shard: 1/2, id: 1 } + - { package: checkly, shard: 2/2, id: 2 } + - { package: create-checkly, shard: '', id: all } + name: test - ${{ matrix.target.package }} - ${{ matrix.os }} - ${{ matrix.target.shard || matrix.target.id }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -51,11 +58,18 @@ jobs: cache: "pnpm" - run: pnpm install --frozen-lockfile - run: pnpm run prepack - - run: pnpm run test + # The --shard flag is forwarded to the package's vitest invocation. It + # must NOT be passed after a `--` separator: a pnpm-inserted `--` makes + # vitest treat `--shard` as a test-name filter and silently run the full + # suite on every shard instead of partitioning it. create-checkly runs + # unsharded, so the flag is omitted there. + - run: "pnpm --filter ${{ matrix.target.package }} run test ${{ matrix.target.shard && format('--shard={0}', matrix.target.shard) || '' }}" - name: Save LLM rules as an artifact + # Only the checkly package produces the AI-context bundle. + if: matrix.target.package == 'checkly' uses: actions/upload-artifact@v4 with: - name: llm-rules-test-${{ matrix.os }} + name: llm-rules-test-${{ matrix.os }}-${{ matrix.target.id }} if-no-files-found: error path: packages/cli/dist/ai-context/* retention-days: 1 @@ -67,7 +81,11 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest-x64] - name: e2e - checkly - ${{ matrix.os }} + # Same shape as the test job's target matrix, restricted to checkly. + target: + - { package: checkly, shard: 1/2, id: 1 } + - { package: checkly, shard: 2/2, id: 2 } + name: e2e - ${{ matrix.target.package }} - ${{ matrix.os }} - ${{ matrix.target.shard }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -80,7 +98,8 @@ jobs: cache: "pnpm" - run: pnpm install --frozen-lockfile - run: pnpm run prepack - - run: pnpm --filter checkly run test:e2e + # See the test job: --shard must not be passed after a `--` separator. + - run: pnpm --filter ${{ matrix.target.package }} run test:e2e --shard=${{ matrix.target.shard }} env: CHECKLY_ACCOUNT_NAME: ${{ secrets.E2E_CHECKLY_ACCOUNT_NAME }} CHECKLY_ACCOUNT_ID: ${{ secrets.E2E_CHECKLY_ACCOUNT_ID }}