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.
This commit is contained in:
Andrey Semashev
2024-02-06 02:30:13 +03:00
parent b077925d77
commit ce20d15048

View File

@@ -636,6 +636,9 @@ jobs:
echo REF: $REF echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH echo BOOST_BRANCH: $BOOST_BRANCH
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
mkdir -p snapshot mkdir -p snapshot
cd snapshot cd snapshot
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -698,6 +701,9 @@ jobs:
echo REF: $REF echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH echo BOOST_BRANCH: $BOOST_BRANCH
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
mkdir -p snapshot mkdir -p snapshot
cd snapshot cd snapshot
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -770,6 +776,11 @@ jobs:
echo REF: $REF echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH echo BOOST_BRANCH: $BOOST_BRANCH
# Building tests on Mac OS occasionally fail with a timeout if there are too many parallel build jobs
BUILD_JOBS=$((nproc || echo 1) 2> /dev/null)
echo BUILD_JOBS: $BUILD_JOBS
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
mkdir -p snapshot mkdir -p snapshot
cd snapshot cd snapshot
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
@@ -852,7 +863,7 @@ jobs:
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%" move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
rmdir /s /q "..\snapshot" rmdir /s /q "..\snapshot"
git submodule update --init tools/boostdep git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
- name: Use library with add_subdirectory (Debug) - name: Use library with add_subdirectory (Debug)
shell: cmd shell: cmd
@@ -914,7 +925,7 @@ jobs:
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%" move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
rmdir /s /q "..\snapshot" rmdir /s /q "..\snapshot"
git submodule update --init tools/boostdep git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
- name: Configure - name: Configure
shell: cmd shell: cmd
@@ -994,7 +1005,7 @@ jobs:
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%" move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
rmdir /s /q "..\snapshot" rmdir /s /q "..\snapshot"
git submodule update --init tools/boostdep git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
- name: Configure - name: Configure
shell: cmd shell: cmd