Wink Pings

CI in under 1 minute, saving 200 hours every week

How do you do 1-minute CI? An engineer listed a checklist: switch to Bun, select tests by diff, shard by historical time. The comments also include a more systematic operating guide.

Pontus Abrahamsson got CI down to under 1 minute. His list of changes wasn't long, but it saves more than 200 hours of waiting every week.

image

CI (continuous integration) is the set of automated checks that runs after every code commit: tests, type checks, builds. When it gets slow, you can wait ten minutes or even longer. Pontus's approach was to switch all the tools to the Bun family, then make the whole process parallelize more intelligently.

Checklist:

  • Vitest -> bun test
  • tsc -> bun check
  • oxlint -> bun lint
  • oxfmt -> bun fmt
  • Fill shards based on historical test times
  • For PRs, run only tests reachable by the diff
  • Build the app only once per backend process
  • Run lint, typecheck, build, and tests all in parallel

The item 'For PRs, run only tests reachable by the diff' uses Bun's built-in --changed import analysis. If you change a utility function, CI won't run the entire test suite; it runs only the tests that might be affected. Sharding also doesn't split evenly by count. It looks at how long each test took in the past and assigns tests to workers by duration so they finish at roughly the same time.

Someone in the comments asked: How do you implement sharding by historical time? What library do you use for test selection? Pontus answered: sharding balances using past test runtimes, and PR test selection uses Bun's built-in --changed.

A user named Quentin Cody offered a more systematic approach. He first set three rules:

  1. The full test suite still has to run, but only before merge; filtering during the PR stage is only for fast feedback and must not become a way to miss failures.
  2. Never hide failures. No retries, no timeouts, no skips. If a check needs retries, that means there's a bug; find it.
  3. Never reduce checks. Lint rules and required checks can only increase, not decrease.

Then he gave a time budget: wait <5 seconds, setup <15 seconds, slowest task <35 seconds, lint <1 second, format <1 second, typecheck <5 seconds, each test shard <30 seconds. First pull the most recent 150 CI runs, break out each task's wait, setup, and run time, and fix the biggest bucket first.

On tools, he recommends replacing npm, yarn, pnpm, Prettier, ESLint, oxlint, Vitest, and Jest all with Bun. For sharding, prioritize buying CPU cores; don't rush to split tasks more finely. Each shard gets its own database, and test files that take more than 20 seconds need to be split further.

The most controversial idea is 'delete tests based on evidence': record whether each failure over two weeks was 'caught a regression' or 'only detected a change,' and delete the latter. But you cannot delete tests related to authorization, privacy, migrations, or concurrency. He put it directly: if a test is only proving that 'the code changed,' it isn't proving that 'the code is correct.'

A user posted a video in a reply:

Another reply posted an image:

image

The comments also had some sarcastic remarks. Someone said: 'Rewrite the entire pipeline in Bun, then call it optimization.' Pontus replied: 'thank you bun.' Someone else said: 'Want it to run in 1 millisecond? Delete the test folder and enjoy the tickets.'

The most counterintuitive part of this whole case is that the first step in optimizing CI usually starts with subtraction. Delete duplicate checks, delete tests that only detect changes, delete unnecessary serial waits. CI is slow, often because the process is stuffed with too many unnecessary things.

Quentin also had one last line: 'If a tool only exists in canary, pin that canary version.' This sounds very technical, but it captures the mindset well: for speed, you can accept instability, but every step must be measured.

发布时间: 2026-11-21 00:46