Repository navigation
ci(cli): shard unit tests and merge coverage #1727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0310bfb
8de8b8f
6daf5b4
314f082
f3b6c01
1c131fc
97591cf
1608137
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -132,9 +132,6 @@ jobs: | |||||||||||||||||||
| cache: pnpm | ||||||||||||||||||||
| - run: cp .env.example .env.local | ||||||||||||||||||||
| - run: pnpm install --frozen-lockfile | ||||||||||||||||||||
| - name: Install zsh for CLI completion regression tests | ||||||||||||||||||||
| if: matrix.name == 'sentry' | ||||||||||||||||||||
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends zsh | ||||||||||||||||||||
| - name: Build project dependencies | ||||||||||||||||||||
| env: | ||||||||||||||||||||
| PROJECT_NAME: ${{ matrix.name }} | ||||||||||||||||||||
|
|
@@ -209,6 +206,84 @@ jobs: | |||||||||||||||||||
| git diff --exit-code | ||||||||||||||||||||
| [[ -z "$(git status --porcelain --untracked-files=all)" ]] | ||||||||||||||||||||
|
|
||||||||||||||||||||
| cli-unit: | ||||||||||||||||||||
| name: CLI unit tests (${{ matrix.shard }}/${{ strategy.job-total }}) | ||||||||||||||||||||
| needs: discover-projects | ||||||||||||||||||||
| if: contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') | ||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||
| timeout-minutes: 10 | ||||||||||||||||||||
| outputs: | ||||||||||||||||||||
| shard-count: ${{ strategy.job-total }} | ||||||||||||||||||||
| strategy: | ||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||
| matrix: | ||||||||||||||||||||
| shard: [1, 2, 3] | ||||||||||||||||||||
| steps: | ||||||||||||||||||||
| - uses: actions/checkout@v7 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | ||||||||||||||||||||
| - uses: actions/setup-node@v7 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| node-version-file: .github/node-versions/22 | ||||||||||||||||||||
| cache: pnpm | ||||||||||||||||||||
| - run: pnpm --filter 'sentry...' install --frozen-lockfile | ||||||||||||||||||||
| - name: Install zsh for CLI completion regression tests | ||||||||||||||||||||
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends zsh | ||||||||||||||||||||
| - name: Build project dependencies | ||||||||||||||||||||
| run: pnpm --filter 'sentry^...' --if-present run build | ||||||||||||||||||||
| - run: pnpm --filter sentry run ci:prepare | ||||||||||||||||||||
|
Comment on lines
+233
to
+235
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this part can be cached/shared through artifacts to save time. We may even get incremental builds?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tested shared preparation: 4m41s versus 4m37s with preparation in each shard (single run).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do I not believe you now. Opus 5.5 can you get me fresh and true numbers with details please?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I'm Opus 5.5) Fresh numbers, with details. Times are first job start to last job end. Preparing in each shard, from 15 shard jobs across 5 Test runs today:
Sharing would save each shard ~47s (33–55s). A shared preparation job costs ~87s by itself, and the shards can't start until it finishes (86s plus a 9s gap in the Oct 30 benchmark). Each shard would start ~95s later and run ~47s shorter, so the unit-test path gets ~50s longer. CI time drops ~50s per run (3 × 47s saved, ~90s spent). The benchmark only tied (273s vs 277s) because the shared shards' tests happened to run 35–42s faster, which is why I didn't trust it. Same trade-off measured today for E2E: building the binary in its own job and downloading it (#1791, 3 runs, each paired with a rerun of Sharing pays off when the build runs anyway: E2E in Build now downloads the binary, npm package and generated sources in 8s instead of spending 60–76s building them. Incremental builds aren't measured yet. The dependency build (~21s) only changes with mcp-core and logger, so caching it across runs could save ~21s in every CLI job without adding a serial step. Runs: Test 41398862900 (attempts 1–4) and 41506512741, benchmark 41088577518, #1791 Test 41427272588 (attempts 1–3), Build 41506512602. Generated by Claude Code |
||||||||||||||||||||
| - name: Test CLI shard | ||||||||||||||||||||
| env: | ||||||||||||||||||||
| SHARD: ${{ matrix.shard }} | ||||||||||||||||||||
| SHARD_COUNT: ${{ strategy.job-total }} | ||||||||||||||||||||
| run: pnpm --filter sentry run ci:test:unit --shard="$SHARD/$SHARD_COUNT" --reporter=default --reporter=blob --outputFile.blob="coverage/shard-$SHARD.json" | ||||||||||||||||||||
| - uses: actions/upload-artifact@v7 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| name: cli-unit-coverage-${{ matrix.shard }} | ||||||||||||||||||||
| path: packages/cli/coverage/shard-${{ matrix.shard }}.json | ||||||||||||||||||||
| if-no-files-found: error | ||||||||||||||||||||
| overwrite: true | ||||||||||||||||||||
| retention-days: 7 | ||||||||||||||||||||
| - name: Check generated files | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
| git diff --exit-code | ||||||||||||||||||||
| [[ -z "$(git status --porcelain --untracked-files=all)" ]] | ||||||||||||||||||||
|
|
||||||||||||||||||||
| cli-coverage: | ||||||||||||||||||||
| name: CLI coverage | ||||||||||||||||||||
| needs: [discover-projects, cli-unit] | ||||||||||||||||||||
| if: contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') | ||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||
| timeout-minutes: 10 | ||||||||||||||||||||
| steps: | ||||||||||||||||||||
| - uses: actions/checkout@v7 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | ||||||||||||||||||||
| - uses: actions/setup-node@v7 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| node-version-file: .github/node-versions/22 | ||||||||||||||||||||
| cache: pnpm | ||||||||||||||||||||
| - run: pnpm --filter sentry install --frozen-lockfile --ignore-scripts | ||||||||||||||||||||
| - uses: actions/download-artifact@v8 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| pattern: cli-unit-coverage-* | ||||||||||||||||||||
| path: ${{ runner.temp }}/cli-unit-reports | ||||||||||||||||||||
| merge-multiple: true | ||||||||||||||||||||
| - name: Require every shard report | ||||||||||||||||||||
| env: | ||||||||||||||||||||
| SHARD_COUNT: ${{ needs.cli-unit.outputs.shard-count }} | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
| test "$SHARD_COUNT" -gt 0 | ||||||||||||||||||||
| for ((shard = 1; shard <= SHARD_COUNT; shard++)); do | ||||||||||||||||||||
| test -s "$RUNNER_TEMP/cli-unit-reports/shard-$shard.json" | ||||||||||||||||||||
| done | ||||||||||||||||||||
| - name: Merge CLI coverage | ||||||||||||||||||||
| run: pnpm --filter sentry exec vitest --merge-reports="$RUNNER_TEMP/cli-unit-reports" --coverage | ||||||||||||||||||||
| - name: Verify coverage | ||||||||||||||||||||
| run: test -s packages/cli/coverage/lcov.info | ||||||||||||||||||||
|
|
||||||||||||||||||||
| cli-e2e: | ||||||||||||||||||||
| name: CLI E2E (Node 24) | ||||||||||||||||||||
| needs: discover-projects | ||||||||||||||||||||
|
|
@@ -322,6 +397,8 @@ jobs: | |||||||||||||||||||
| project, | ||||||||||||||||||||
| npm-runtime, | ||||||||||||||||||||
| cli-asset-catalog, | ||||||||||||||||||||
| cli-unit, | ||||||||||||||||||||
| cli-coverage, | ||||||||||||||||||||
| cli-e2e, | ||||||||||||||||||||
| ] | ||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||
|
|
@@ -337,24 +414,28 @@ jobs: | |||||||||||||||||||
| RUNTIME_COUNT: ${{ needs.discover-projects.outputs.runtime-count }} | ||||||||||||||||||||
| ASSET_CATALOG_RESULT: ${{ needs.cli-asset-catalog.result }} | ||||||||||||||||||||
| ASSET_CATALOG_SELECTED: ${{ contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') }} | ||||||||||||||||||||
| CLI_UNIT_RESULT: ${{ needs.cli-unit.result }} | ||||||||||||||||||||
| CLI_COVERAGE_RESULT: ${{ needs.cli-coverage.result }} | ||||||||||||||||||||
| CLI_E2E_RESULT: ${{ needs.cli-e2e.result }} | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
| [[ "$DISCOVER_RESULT" == success ]] | ||||||||||||||||||||
| [[ "$INSTALL_RESULT" == success ]] | ||||||||||||||||||||
| [[ "$QUALITY_RESULT" == success ]] | ||||||||||||||||||||
| test "$DISCOVER_RESULT" = success | ||||||||||||||||||||
| test "$INSTALL_RESULT" = success | ||||||||||||||||||||
| test "$QUALITY_RESULT" = success | ||||||||||||||||||||
| expected=success | ||||||||||||||||||||
| if [[ "$PROJECT_COUNT" == 0 ]]; then | ||||||||||||||||||||
| expected=skipped | ||||||||||||||||||||
| fi | ||||||||||||||||||||
| [[ "$PROJECT_RESULT" == "$expected" ]] | ||||||||||||||||||||
| test "$PROJECT_RESULT" = "$expected" | ||||||||||||||||||||
| expected=success | ||||||||||||||||||||
| if [[ "$RUNTIME_COUNT" == 0 ]]; then | ||||||||||||||||||||
| expected=skipped | ||||||||||||||||||||
| fi | ||||||||||||||||||||
| [[ "$RUNTIME_RESULT" == "$expected" ]] | ||||||||||||||||||||
| test "$RUNTIME_RESULT" = "$expected" | ||||||||||||||||||||
| expected=success | ||||||||||||||||||||
| if [[ "$ASSET_CATALOG_SELECTED" == false ]]; then | ||||||||||||||||||||
| expected=skipped | ||||||||||||||||||||
| fi | ||||||||||||||||||||
| test "$ASSET_CATALOG_RESULT" = "$expected" | ||||||||||||||||||||
| test "$CLI_UNIT_RESULT" = "$expected" | ||||||||||||||||||||
| test "$CLI_COVERAGE_RESULT" = "$expected" | ||||||||||||||||||||
| test "$CLI_E2E_RESULT" = "$expected" | ||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.