[ci] Speed up package tests by enabling parallel execution#13601
Merged
Conversation
Remove --concurrency=1 from the packages test CI command, letting Turbo parallelize package test suites across available cores. Package tests are well-isolated and safe to run in parallel: - Wrangler: in-process tests with MSW mocks, runInTempDir(), mocked ports - Miniflare: forks pool with maxWorkers=1, port 0, package-local .tmp/ - vitest-pool-workers: private Verdaccio on random port, isolated temp dirs - All other packages: lightweight unit tests with no shared resources Validated locally: 4 consecutive runs with unlimited concurrency, all 34/34 tasks passing with zero retries. Execution time drops from ~9.5min (serial) to ~2min (parallel).
|
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
Contributor
|
UnknownError: ProviderInitError |
Contributor
|
@petebacondarwin Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
workers-devprod
approved these changes
Apr 19, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
petebacondarwin
added a commit
that referenced
this pull request
Apr 20, 2026
Follow-up to #13596 and #13601 which removed --concurrency=1 entirely. Unlimited concurrency caused CPU starvation on 4-vCPU CI runners when 20+ workerd-spawning fixtures or 3+ heavyweight package suites ran simultaneously, leading to test timeouts. Changes: - Cap fixture concurrency at 4 (was unlimited, previously 1) - Cap package concurrency at 3 (was unlimited, previously 1) - Add testTimeout: 50_000 to 6 vitest configs that were using Vitest's default 5000ms instead of the repo standard 50s from vitest.shared.ts: workers-shared/asset-worker, workers-shared/router-worker, vite-plugin-cloudflare, edge-preview-authenticated-proxy, kv-asset-handler, pages-shared - Increase start-worker-node-test timeout from 15s to 50s The timeout fixes address pre-existing fragility - these configs never extended vitest.shared.ts and relied on Vitest's 5s default, which is insufficient under any CPU load.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes no specific issue — CI performance improvement. Companion to #13596 (which does the same for fixture tests).
The
packages-and-toolsCI job runs all package test suites serially (--concurrency=1), taking ~9.5 min on Linux and ~20 min on Windows. The three heaviest packages dominate:Since these run sequentially today, the total is the sum. With parallel execution, the total is bounded by the slowest package (wrangler).
Why Parallel Execution Is Safe
All packages are well-isolated:
runWrangler(cmd)callsmain()directly with MSW for API mocking,runInTempDir()for filesystem isolation, mockedget-port(no real ports). Pool:forks(each test file is its own process).pool: "forks",maxWorkers: 1(sequential internally),server.listen(0)for random ports,.tmp/local to package root.getPort(), workerd on random ports, temp dirs inos.tmpdir()with unique prefixes.No shared ports, sockets, temp directories, dev registry usage, or environment variables between packages.
Change
Remove
--concurrency=1from the packages test Turbo command, letting Turbo parallelize based on the dependency graph and available CPU cores.Validation
Ran package tests locally 4 times with unlimited concurrency. All runs passed with zero retries:
Expected CI improvement:
Risks & Fallback
The main risk is resource pressure on CI runners (4 vCPUs, 16GB RAM) when wrangler (forks pool, 233 test files) runs alongside miniflare (workerd processes). If this causes OOM or increased flakiness, we can set
--concurrency=3as a middle ground.