ci: cap CARGO_BUILD_JOBS at nproc/2 in both build workflows #30

Merged
David merged 1 commit from fix/cargo-build-jobs-nproc-half into main 2026-05-29 02:45:16 +02:00
Owner

Problem

Both build-binary.yml and build-binary-windows.yml set CARGO_BUILD_JOBS to full nproc ((sys cpu | length)), so the 32-CPU runner builds with CARGO_BUILD_JOBS=32 and oversubscribes the host. The Linux workflow's "one build per runner" comment was the stated assumption behind using the full host; that assumption does not hold for the runner fleet.

Fix

Cap at nproc / 2, matching the dynamic formula in governance CI.md -> "Concurrency cap" ((sys cpu | length) / 2 | into int). On the 32-CPU runner that yields CARGO_BUILD_JOBS=16; it scales with whatever host the job lands on. Concurrency across jobs is managed at the runner level, not in the workflow, so the cap is unconditional rather than keyed on how many builds happen to share a host.

The Dockerfile default (ARG CARGO_BUILD_JOBS=2) is unchanged, per governance, so ad-hoc local builds stay conservative.

Notes

Workflow-only change; no Rust code touched. Independent of the open Windows OpenSSL PR (different lines).

## Problem Both `build-binary.yml` and `build-binary-windows.yml` set `CARGO_BUILD_JOBS` to full `nproc` (`(sys cpu | length)`), so the 32-CPU runner builds with `CARGO_BUILD_JOBS=32` and oversubscribes the host. The Linux workflow's "one build per runner" comment was the stated assumption behind using the full host; that assumption does not hold for the runner fleet. ## Fix Cap at `nproc / 2`, matching the dynamic formula in governance `CI.md` -> "Concurrency cap" (`(sys cpu | length) / 2 | into int`). On the 32-CPU runner that yields `CARGO_BUILD_JOBS=16`; it scales with whatever host the job lands on. Concurrency across jobs is managed at the runner level, not in the workflow, so the cap is unconditional rather than keyed on how many builds happen to share a host. The Dockerfile default (`ARG CARGO_BUILD_JOBS=2`) is unchanged, per governance, so ad-hoc local builds stay conservative. ## Notes Workflow-only change; no Rust code touched. Independent of the open Windows OpenSSL PR (different lines).
ci: cap CARGO_BUILD_JOBS at nproc/2 in both build workflows
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 37s
Create release / Create release from merged PR (pull_request) Has been skipped
75c886ddc6
Both build workflows set CARGO_BUILD_JOBS to full nproc, so the 32-CPU runner built with CARGO_BUILD_JOBS=32 and oversubscribed. Governance CI.md "Concurrency cap" computes the value dynamically; cap at nproc/2 (16 on the 32-CPU runner) so a build never claims the whole host. Concurrency across jobs is managed at the runner level, not in the workflow. Drops the stale "one build per runner" comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
David merged commit 0e8a825ac5 into main 2026-05-29 02:45:16 +02:00
David deleted branch fix/cargo-build-jobs-nproc-half 2026-05-29 02:45:16 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/forgejo-cli!30
No description provided.