Skip to content

Commit

Permalink
Switch posix-cmake-test to use Ninja instead of Makefiles.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lastique committed Feb 6, 2024
1 parent 45e7e1a commit ccfee3f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,9 @@ jobs:
steps:
- name: Install packages
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
run: |
Expand Down Expand Up @@ -686,7 +688,9 @@ jobs:
steps:
- name: Install packages
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
run: |
Expand Down Expand Up @@ -760,8 +764,14 @@ jobs:

steps:
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
run: |
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
run: |
Expand All @@ -776,8 +786,7 @@ jobs:
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
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)
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
echo BUILD_JOBS: $BUILD_JOBS
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
Expand Down Expand Up @@ -807,7 +816,8 @@ jobs:
run: |
cd boost-root
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
run: |
Expand Down

0 comments on commit ccfee3f

Please sign in to comment.