Replace broken pipelines with Github workflows #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C++ build and test | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | |
fail-fast: false | |
# Set up a matrix to run the following 3 configurations: | |
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator> | |
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator> | |
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator> | |
# | |
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
build_type: [Release, Debug] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Boost (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
id: boost | |
shell: bash | |
run: | | |
DEPS_DIR="${{ github.workspace }}/deps" | |
BOOST_LIBRARIES="chrono,system,test" | |
BOOST_VERSION="1.70.0" | |
BOOST_URL="https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//\./_}.tar.gz" | |
BOOST_DIR="${DEPS_DIR}/boost" | |
echo "Downloading Boost ${BOOST_VERSION} from ${BOOST_URL}" | |
mkdir -p ${BOOST_DIR} && cd ${BOOST_DIR} | |
wget -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR} || exit 1 | |
./bootstrap.sh --with-libraries=${BOOST_LIBRARIES} && ./b2 | |
export BOOST_ROOT=${BOOST_DIR} | |
echo "boost-root-dir=$BOOST_ROOT" >> "$GITHUB_OUTPUT" | |
- name: Install Boost (MacOs) | |
if: matrix.os == 'macos-latest' | |
id: boost-macos | |
shell: bash | |
run: | | |
brew install boost | |
export BOOST_ROOT=$(brew --prefix boost) | |
echo "boost-root-dir=$BOOST_ROOT" >> "$GITHUB_OUTPUT" | |
- name: Set build directory | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: > | |
export BOOST_ROOT="${{ steps.boost.outputs.boost-root-dir }}" && echo "$BOOST_ROOT" && cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-S ${{ github.workspace }} | |
- name: Configure CMake (Windows) | |
if: matrix.os == 'windows-latest' | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-S ${{ github.workspace }} | |
- name: Configure CMake (MacOs) | |
if: matrix.os == 'macos-latest' | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_PREFIX_PATH="/opt/homebrew/opt/boost" -DBOOST_ROOT="/opt/homebrew/opt/boost" -DBoost_NO_BOOST_CMAKE=ON | |
-DBOOST_LIBRARYDIR="/opt/homebrew/opt/boost/lib" -DBoost_USE_STATIC_LIBS=OFF | |
-DBoost_USE_STATIC_RUNTIME=OFF -S ${{ github.workspace }} | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
run: ctest --build-config ${{ matrix.build_type }} |