Skip to content

Commit ce20d15

Browse files
committed
Fix posix-cmake-test failures on Mac OS.
Properly set BUILD_JOBS environment variable in CMake-related jobs as it is used in build and run steps. Without the variable being set, -j without a number means "no limit on the number of jobs", which may hit system resource limits and cause the job to fail. Also, Mac OS seem to sometimes hang on too many parallel build jobs, even if BUILD_JOBS is specified correctly. So disable parallel builds for now. Additionally, use GIT_FETCH_JOBS universally.
1 parent b077925 commit ce20d15

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ jobs:
636636
echo REF: $REF
637637
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
638638
echo BOOST_BRANCH: $BOOST_BRANCH
639+
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
640+
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
641+
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
639642
mkdir -p snapshot
640643
cd snapshot
641644
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -698,6 +701,9 @@ jobs:
698701
echo REF: $REF
699702
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
700703
echo BOOST_BRANCH: $BOOST_BRANCH
704+
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
705+
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
706+
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
701707
mkdir -p snapshot
702708
cd snapshot
703709
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -770,6 +776,11 @@ jobs:
770776
echo REF: $REF
771777
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
772778
echo BOOST_BRANCH: $BOOST_BRANCH
779+
# Building tests on Mac OS occasionally fail with a timeout if there are too many parallel build jobs
780+
BUILD_JOBS=$((nproc || echo 1) 2> /dev/null)
781+
echo BUILD_JOBS: $BUILD_JOBS
782+
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
783+
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
773784
mkdir -p snapshot
774785
cd snapshot
775786
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -852,7 +863,7 @@ jobs:
852863
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
853864
rmdir /s /q "..\snapshot"
854865
git submodule update --init tools/boostdep
855-
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
866+
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
856867
857868
- name: Use library with add_subdirectory (Debug)
858869
shell: cmd
@@ -914,7 +925,7 @@ jobs:
914925
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
915926
rmdir /s /q "..\snapshot"
916927
git submodule update --init tools/boostdep
917-
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
928+
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
918929
919930
- name: Configure
920931
shell: cmd
@@ -994,7 +1005,7 @@ jobs:
9941005
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
9951006
rmdir /s /q "..\snapshot"
9961007
git submodule update --init tools/boostdep
997-
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
1008+
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
9981009
9991010
- name: Configure
10001011
shell: cmd

0 commit comments

Comments
 (0)