Skip to content

build: limit concurrency of workspace scripts to CPU cores - #47

Merged
dangreen merged 2 commits into
mainfrom
build/workspace-scripts-concurrency
Oct 6, 2026
Merged

dangreen merged 2 commits into
mainfrom
build/workspace-scripts-concurrency

Conversation

@dangreen

@dangreen dangreen commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Why

The root scripts run through pnpm -r --parallel, which disregards the concurrency limit together with the topological order and starts the script in every selected package at once, however many cores the machine has.

What

  • The root scripts run through pnpm -r --no-sort instead. Packages still run without the topological order, as before, but no more of them run at once than workspaceConcurrency allows.
  • pnpm-workspace.yaml sets workspaceConcurrency: 0, which pnpm reads as the number of CPU cores. Without it the limit would be the default of pnpm, min(4, cores).

Notes

  • workspaceConcurrency is a setting of the workspace rather than a flag of these scripts, so the other recursive commands of pnpm follow it too. On a runner with 4 vCPUs it equals the default.
  • Checked on a mock of the workspace with pnpm 11.9.0, 12.6.0 and 12.9.1: every form of the root scripts selects the same packages with --no-sort as with --parallel, and no more scripts run at once than there are cores. In this repository pnpm config get workspaceConcurrency reads the setting back. The scripts themselves run in CI.
  • CI installed the latest pnpm 11, now 11.28.4, and its frozen install rejects the lockfile written by 11.9.0 with "linkDirectory" in the lockfile (true) doesn't match "publishConfig.linkDirectory" in package.json (false). main fails the same way. The second commit pins pnpm/action-setup to 11.9.0, the version of .tool-versions, as simple-release pins 11.11.0.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 37476535826

Coverage remained the same at 93.859%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 889
Covered Lines: 842
Line Coverage: 94.71%
Relevant Branches: 658
Covered Branches: 610
Branch Coverage: 92.71%
Branches in Coverage %: Yes
Coverage Strength: 79445.87 hits per line

💛 - Coveralls

@dangreen
dangreen merged commit 24127ca into main Oct 6, 2026
7 checks passed
@dangreen
dangreen deleted the build/workspace-scripts-concurrency branch October 6, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants