ci: dynamically match makejobs with cores
What changed, and why it matters
This commit changes how Bitcoin Core's continuous integration (CI) build system decides how many parallel compilation jobs to run. Previously it hard-coded 10 jobs; now it detects the number of CPU cores on the machine. There is no security-relevant change here—it's purely a build-performance tuning adjustment.
No security action needed. Treat as a routine CI infrastructure improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes a hard-coded MAKEJOBS=-j10 environment variable from .github/workflows/ci.yml and updates ci/test/00_setup_env.sh to default MAKEJOBS to the number of logical CPUs using nproc on Linux or sysctl -n hw.logicalcpu on macOS. This is an infrastructure/CI optimization for hosted runners with varying core counts.
Changed components
Bitcoin Core CI configuration (.github/workflows/ci.yml)Bitcoin Core CI setup script (ci/test/00_setup_env.sh)Inspect captured patch +1 / −2
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fd39f3e5..6876b832 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,6 @@ concurrency:
env:
CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error
CIRRUS_CACHE_HOST: http://127.0.0.1:12321/ # When using Cirrus Runners this host can be used by the docker `gha` build cache type.
- MAKEJOBS: '-j10'
REPO_USE_CIRRUS_RUNNERS: 'bitcoin/bitcoin' # Use cirrus runners and cache for this repo, instead of falling back to the slow GHA runners
defaults:
diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh
index cf8fbb00..a4293fb8 100755
--- a/ci/test/00_setup_env.sh
+++ b/ci/test/00_setup_env.sh
@@ -35,7 +35,7 @@ fi
echo "Fallback to default values in env (if not yet set)"
# The number of parallel jobs to pass down to make and test_runner.py
-export MAKEJOBS=${MAKEJOBS:--j4}
+export MAKEJOBS=${MAKEJOBS:--j$(if command -v nproc > /dev/null 2>&1; then nproc; else sysctl -n hw.logicalcpu; fi)}
# Whether to prefer BusyBox over GNU utilities
export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.