Switch posix-cmake-test to use Ninja instead of Makefiles.

This is yet another workaround for hanging posix-cmake-test on Mac OS.
This enables parallel builds again, but uses Ninja build system instead
of Makefiles. Enabling parallel builds speeds up the build process and
releases Mac OS builders for other jobs sooner.

Additionally, fix incorrect apt invocations in CMake-related jobs. apt
is supposed to be used in interactive shells, and in scripts apt-get is
recommended. Also, apt-get update is needed before apt install, and
matrix.install must be transformed to a space-separated list. Also added
retries on network errors.
This commit is contained in:
Andrey Semashev 2024-02-06 11:29:12 +03:00
parent 45e7e1a91a
commit ccfee3f638

View File

@ -621,7 +621,9 @@ jobs:
steps: steps:
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
run: sudo apt install ${{matrix.install}} run: |
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y ${{join(matrix.install, ' ')}}
- name: Setup Boost - name: Setup Boost
run: | run: |
@ -686,7 +688,9 @@ jobs:
steps: steps:
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
run: sudo apt install ${{matrix.install}} run: |
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y ${{join(matrix.install, ' ')}}
- name: Setup Boost - name: Setup Boost
run: | run: |
@ -760,8 +764,14 @@ jobs:
steps: steps:
- name: Install packages - name: Install packages
if: matrix.install run: |
run: sudo apt install ${{matrix.install}} if [ -f "/etc/debian_version" ]
then
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ninja-build ${{join(matrix.install, ' ')}}
else
brew install ninja ${{join(matrix.install, ' ')}}
fi
- name: Setup Boost - name: Setup Boost
run: | run: |
@ -776,8 +786,7 @@ 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 || sysctl -n hw.ncpu) 2> /dev/null)
BUILD_JOBS=$((nproc || echo 1) 2> /dev/null)
echo BUILD_JOBS: $BUILD_JOBS echo BUILD_JOBS: $BUILD_JOBS
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
@ -807,7 +816,8 @@ jobs:
run: | run: |
cd boost-root cd boost-root
mkdir __build__ && cd __build__ mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. # Building tests on Mac OS using makefiles sometimes blocks until timeout, if multiple parallel build jobs are used. Use Ninja instead.
cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
- name: Build tests - name: Build tests
run: | run: |