ci: use twice the CPU count on both providers
GitHub Actions sets JOBS to ten regardless of runner size, while
GitLab CI uses the detected CPU count. Use twice the CPU count for
Make and prove on both providers, doubling GitLab's job count.
Five GitHub Actions attempts per policy, with the long tests enabled,
gave these sums of per-job median successful build/test-step times
(minutes; four or five samples per job) [1-3]:
Fixed 10 CPU count 2x CPU count
Linux Make 278.9 273.9 259.9
macOS Make 94.5 119.1 99.8
Windows Make 102.2 103.8 100.8
Workflow overhead is excluded; Windows runner images varied.
Use twice the CPU count to scale concurrency with runner size while
avoiding the larger macOS slowdown observed with one job per CPU.
Compared with ten jobs, this trades a lower Linux total for a higher
macOS total.
Keep GitLab's Linux and Windows CPU queries. On macOS, use the native
sysctl command on both providers so CPU detection does not depend on
GNU coreutils.
Link: https://github.com/tamird/git/actions/runs/36070869894/attempts/1 [1]
Link: https://github.com/tamird/git/actions/runs/36070867524/attempts/1 [2]
Link: https://github.com/tamird/git/actions/runs/36070867647/attempts/1 [3]
Assisted-by: LLM
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
1 parent
bb5979706a
commit
4f956cf43a
1 file changed
+13
-4
@@ -226,7 +226,6 @@ then
|
||||
cache_dir="$HOME/none"
|
||||
|
||||
GIT_TEST_OPTS="--github-workflow-markup"
|
||||
JOBS=10
|
||||
|
||||
distro=$(echo "$CI_JOB_IMAGE" | tr : -)
|
||||
elif test true = "$GITLAB_CI"
|
||||
@@ -242,7 +241,6 @@ then
|
||||
case "$OS,$CI_JOB_IMAGE" in
|
||||
Windows_NT,*)
|
||||
CI_OS_NAME=windows
|
||||
JOBS=$NUMBER_OF_PROCESSORS
|
||||
;;
|
||||
*,macos-*)
|
||||
# GitLab CI has Python installed via multiple package managers,
|
||||
@@ -252,11 +250,9 @@ then
|
||||
export PATH="$(brew --prefix)/bin:$PATH"
|
||||
|
||||
CI_OS_NAME=osx
|
||||
JOBS=$(nproc)
|
||||
;;
|
||||
*,almalinux:*|*,alpine:*|*,debian:*|*,fedora:*|*,ubuntu:*|*,i386/ubuntu:*)
|
||||
CI_OS_NAME=linux
|
||||
JOBS=$(nproc)
|
||||
;;
|
||||
*)
|
||||
echo "Could not identify OS image" >&2
|
||||
@@ -283,6 +279,19 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$CI_OS_NAME" in
|
||||
windows|windows_nt)
|
||||
JOBS=$NUMBER_OF_PROCESSORS
|
||||
;;
|
||||
osx)
|
||||
JOBS=$(sysctl -n hw.logicalcpu)
|
||||
;;
|
||||
*)
|
||||
JOBS=$(nproc)
|
||||
;;
|
||||
esac
|
||||
JOBS=$((2 * JOBS))
|
||||
|
||||
MAKEFLAGS="$MAKEFLAGS --jobs=$JOBS"
|
||||
GIT_PROVE_OPTS="--timer --jobs $JOBS"
|
||||
|
||||
|
||||
Reference in new issue
Block a user