Skip to content

CMake on multiple platforms #127

CMake on multiple platforms

CMake on multiple platforms #127

name: CMake on multiple platforms
on:
push:
branches: ["development"]
pull_request:
branches: ["development"]
workflow_dispatch:
release:
types:
- prereleased
- released
schedule:
# 5AM every Monday, to catch breaks due to changes in dependencies
- cron: "0 5 * * 1"
jobs:
build-nix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
build_shared_libs: [ON, OFF]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Install Conan
run: pip install conan
- name: Configure Conan
run: |
conan profile detect
- name: Install SWIG (macOS)
if: matrix.os == 'macos-latest'
run: brew install swig
- name: Install dependencies
run: |
conan install . --build=missing -s build_type=Release
conan install . --build=missing -s build_type=Debug
# Usage of cmake workflow feature prevents passing options via -D thereby
# creating a lot of duplicated code in the CMakePresets.txt. For this
# reason, we use the cmake --preset command.
- name: Configure CMake
run: >
cmake --preset ${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'test' }}
- name: Build
run: cmake --build --preset ${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'test' }}
- name: Test
run: ctest --preset ${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'test' }}
- name: Package
if: ${{ matrix.build_type == 'Release' && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') }}
run: |
cpack --preset ${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'test' }}
# Packages are put in the current working directory to prevent path
# incompatibilities between Windows and Linux/Mac
- name: Upload tarballs
uses: actions/upload-artifact@v4
if: ${{ matrix.build_type == 'Release' && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') }}
with:
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'static' }}.tar.gz
path: |
soar-*.tar.gz
- name: Upload Debian
uses: actions/upload-artifact@v4
if: ${{ matrix.build_type == 'Release' && (matrix.os == 'ubuntu-latest') && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') }}
with:
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.build_shared_libs == 'ON' && 'shared' || 'static' }}.deb
path: |
soar-*.deb