- All playbooks
- Build once and share the output with test shards
Build once and share the output with test shards
Separate the build producer from test consumers and hand the same verified artifact to each shard.
How companies used this technique
Read what each company changed and follow the original sources.
Build once, test on every shard
Codex builds one nextest archive per platform, uploads it, and has four test shards download it and run their slice of the same binaries. For Windows ARM64 the archive builds on an x64 host while the tests still run on ARM64.
Built once on x64, tested on native ARM64 shards Source
- Use it when
- Multiple matrix legs or shards compile the same code before running tests.
- Before applying it
- Reused artifacts must match the commit, target and toolchain. Artifact transfer can outweigh the build time saved on small jobs.
Build once and hand the artifact to every shard
Stripe React Native separated platform app builds from its end-to-end shards, and each shard downloads the matching built app. On GitHub Actions the same handoff uses build artifacts scoped to the run, platform and configuration.
The full suite went from about 25 to about 14 minutes, together with the move to another CI system. Source
- Use it when
- Every test shard repeats the same expensive compilation.
- Before applying it
- The handoff pays off when transfer costs less than the repeated build. Consume only artifacts from the same commit and a compatible platform.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed