Skip to content

CMake build

CMake build #16

Workflow file for this run

name: "CMake build"
on:
push:
pull_request:
schedule:
- cron: "27 2 * * 2"
workflow_call:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain:
- linux-gcc
- macos-clang
- windows-msvc
# - windows-mingw
configuration:
- Debug
python-version:
- 3.13
include:
- toolchain: linux-gcc
os: ubuntu-latest
compiler: gcc
- toolchain: macos-clang
os: macos-latest
compiler: clang
- toolchain: windows-msvc
os: windows-latest
compiler: msvc
# - toolchain: windows-mingw
# os: windows-latest
# compiler: mingw
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 5
- name: Setup python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install python packages
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
fi
pip install --disable-pip-version-check --user "conan>=2.12.0,<3"
- name: Cache conan folder
uses: actions/cache@v4
with:
path: ~/.conan2
key: ${{ runner.os }}-conan2-${{ hashFiles('conanfile.txt', 'conanfile.py', 'conan.lock') }}
restore-keys: |
${{ runner.os }}-conan2-
- name: Configure (${{ matrix.configuration }})
run: |
if [ "${{ matrix.toolchain }}" == "windows-msvc" ]; then
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider
elif [ "${{ matrix.toolchain }}" == "windows-mingw" ]; then
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -G "MinGW Makefiles"
else
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
fi
- name: Build with ${{ matrix.compiler }}
run: |
if [ "${{ matrix.toolchain }}" == "windows-msvc" ]; then
cmake --build build --config ${{ matrix.configuration }}
else
cmake --build build -- -j8
fi
- name: Test
run: |
ctest --no-tests=error --test-dir build --build-config ${{ matrix.configuration }} --parallel 8