Skip to content

ci(cli): run E2E tests in parallel - #1726

Open
betegon wants to merge 6 commits into
mainfrom
bt/cli-e2e-parallel
Open

betegon wants to merge 6 commits into
mainfrom
bt/cli-e2e-parallel

Conversation

@betegon

@betegon betegon commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

The sentry project job ran every CLI check in sequence, with a 12m26s median. This splits it into parallel jobs:

  • CLI unit tests (n/3) run the unit suite in three Vitest shards on Node 22. CLI coverage merges their blob reports into packages/cli/coverage/lcov.info.
  • CLI E2E (Node 24) builds the workspace dependencies, generated sources, standalone binary and npm bundle once, then tests both on Node 24.
  • The sentry project job keeps lint, typecheck and the policy checks.

Also:

  • test.yml and cli-build.yml read the exact Node 20, 22 and 24 versions from .github/node-versions/.
  • The npm runtime job builds the package once instead of building its dependencies twice.
  • actions/* steps in test.yml use the latest major tags.
  • ci-projects.test.mjs no longer asserts test.yml's text or copies package.json values.
Before (main) This PR (4 runs of c2e83c0)
sentry project job 12m26s (median, all CLI checks) 1m31s–2m31s
CLI unit shards in sentry 2m28s–4m05s each, plus 31–42s coverage merge
CLI E2E in sentry 3m28s–4m45s
Test workflow 4m13s–5m36s

Workflow time is first job start to last job end.

Recompute from any run:

gh run view <run-id> -R getsentry/toolkit --json jobs --jq '.jobs[] | select(.name | test("^sentry$|^CLI")) | ((.completedAt | fromdate) - (.startedAt | fromdate)) as $s | "\($s / 60 | floor)m\($s % 60)s\t\(.name)"'

Generated by Claude Code

@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 2, 2026 10:49am UTC

Request Review

@betegon
betegon marked this pull request as ready for review October 29, 2026 19:45
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 29, 2026
- name: Build standalone CLI
run: pnpm --filter sentry run build
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should defer this step after the standalone build and use that already-built artifact for e2e tests. This should also save us time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Node 24 switch already follows the standalone build and E2E reuses the binary via SENTRY_CLI_BINARY.

also removed the duplicate standalone build from the CLI project job

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

The lines above this literally are:

- name: Build project dependencies
        run: pnpm --filter 'sentry^...' --if-present run build
      - run: pnpm --filter sentry run ci:prepare
      - name: Build standalone CLI
        run: pnpm --filter sentry run tsx script/build.ts --single

Which builds the dependencies and gets a new CLI build. We should be using the build going in for nightly which means we need to download it from a previous job as an artifact.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Measured it in #1791 (test PR) runs E2E against artifacts:

  1. CLI binary (linux-x64) builds with nightly’s Build Binary command
  2. NPM package (sentry) uploads its tarball
  3. and CLI E2E downloads both.

Three runs, each paired with a re-run of this PR’s head:

  • 5m36s → 6m07s
  • 5m00s → 6m04s
  • 4m13s → 4m48s

+43s mean, first job start to last job end. The E2E job itself gets about 1 min faster, but it now waits 1m25s–1m39s for the binary job.

On saving time: that held for the version you reviewed. At 2c1cde7 the sentry job built a binary nobody used, and E2E built it again (E2E job 6m24s). 756b806 removed that duplication. The binary is now 13s of the E2E job.

So artifacts cost about 40s per run in exchange for testing exactly what nightly builds. I’d keep this as it is; if you’d rather pay that for fidelity, I’ll bring #1791’s commit over.

@BYK BYK Nov 2, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code said - name: Build like the nightly binary which means you added another build step???

We already build the nightlies so e2e tests should just follow that instead of the smoke test.

See what Spotlight is doing: https://github.com/getsentry/spotlight/blob/main/.github/workflows/build.yml

There is no way in hell rebuilding the binary is cheaper than downloading a ready-made artifact unless the servers/network are extremely slow or we do some stupid stuff with compression and paying the cost of that. We are definitely going in the high-fidelity route.

Comment thread .github/workflows/test.yml Resolved
Comment thread scripts/ci-projects.test.mjs Resolved
Runs the CLI unit tests in three parallel shards and merges their Vitest
blob reports into one coverage report, instead of running the whole
suite inside the `sentry` project job. Stacked on #1726.

| Job | #1726 (`1b42251`, unsharded) | This PR (`1608137`) |
| --- | --- | --- |
| `Test` workflow | 10m18s | 5m48s |
| `sentry` project job | 9m57s | 1m57s |
| CLI unit tests | inside `sentry` | 2m24s / 3m48s / 3m33s (3 shards) |
| CLI coverage merge | inside `sentry` | 0m25s |
| CLI E2E (Node 24) | 4m30s | 3m30s |

Runs:
[#1726](https://github.com/getsentry/toolkit/actions/runs/41057051286),
[this
PR](https://github.com/getsentry/toolkit/actions/runs/41126676840). One
run each; workflow time is first job start to last job done. The last
job to finish was `CLI asset catalog (macOS arm64)`.

Shards install only the CLI and its workspace dependencies: 1,508 → 774
packages (`pnpm install` vs `pnpm --filter 'sentry...' install`, both
`--frozen-lockfile`), with install scripts kept. Sharing preparation
through artifacts was no faster in a [one-off
benchmark](https://github.com/getsentry/toolkit/actions/runs/41088577518)
(4m41s vs 4m37s), so each job prepares its own inputs.

Same tests and coverage scope; CodeQL is unchanged. Drops the
`ci-projects` tests that only asserted `test.yml`'s own text or ran its
bash from Node.

<details>
<summary>Recompute job times from any run</summary>

```sh
gh run view <run-id> -R getsentry/toolkit --json jobs --jq '.jobs[] | select(.name | test("^sentry$|^CLI")) | ((.completedAt | fromdate) - (.startedAt | fromdate)) as $s | "\($s / 60 | floor)m\($s % 60)s\t\(.name)"'
```

</details>


---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The job takes 3m28s-4m45s, the same range the unit shards cap at
10 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 0eb2b50d Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants