Skip to content

Commit 3f339e9

Browse files
committed
ci: dynamically match makejobs with cores
Previously jobs were running on a large multi-core server where 10 jobs as default made sense (or may even have been on the low side). Using hosted runners with fixed (and lower) numbers of vCPUs we should adapt compilation to match the number of cpus we have dynamically. This is cross-platform compatible with macos and linux only.
1 parent 4393ffd commit 3f339e9

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ concurrency:
2020
env:
2121
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
2222
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.
23-
MAKEJOBS: '-j10'
2423
REPO_USE_CIRRUS_RUNNERS: 'bitcoin/bitcoin' # Use cirrus runners and cache for this repo, instead of falling back to the slow GHA runners
2524

2625
defaults:

ci/test/00_setup_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fi
3535

3636
echo "Fallback to default values in env (if not yet set)"
3737
# The number of parallel jobs to pass down to make and test_runner.py
38-
export MAKEJOBS=${MAKEJOBS:--j4}
38+
export MAKEJOBS=${MAKEJOBS:--j$(if command -v nproc > /dev/null 2>&1; then nproc; else sysctl -n hw.logicalcpu; fi)}
3939
# Whether to prefer BusyBox over GNU utilities
4040
export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
4141

0 commit comments

Comments
 (0)