Skip to content

Make having pytest mandatory only if PYTHON_TEST_FORCE is set in CMake #589

Make having pytest mandatory only if PYTHON_TEST_FORCE is set in CMake

Make having pytest mandatory only if PYTHON_TEST_FORCE is set in CMake #589

Workflow file for this run

name: Debug
on:
push:
branches:
- master
pull_request:
env:
BUILD_TYPE: Debug
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS 13 AppleClang 14 [Debug]",
os: macos-13,
cxx: "clang++"
}
- {
name: "macOS 13 GCC 12 [Debug]",
os: macos-13,
cxx: "g++-12"
}
- {
name: "Ubuntu 22.04 Clang 15 [Debug]",
os: ubuntu-22.04,
cxx: "clang++-15"
}
- {
name: "Ubuntu 22.04 GCC 12 [Debug]",
os: ubuntu-22.04,
cxx: "g++-12"
}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Get macOS Concurrency
if: runner.os == 'macOS'
run: |
echo NPROC="sysctl -n hw.ncpu" >> $GITHUB_ENV
echo "Running on $(sysctl -n hw.ncpu) threads ..."
- name: Get Linux Concurrency
if: runner.os == 'Linux'
run: |
echo NPROC="nproc" >> $GITHUB_ENV
echo "Running on $(nproc) threads ..."
- name: Set Up macOS Dependencies
if: runner.os == 'macOS'
run: |
brew install ninja gcc@12 mpfr cairo gnuplot pkg-config
python3 -m pip install --upgrade pip
pip3 install --upgrade pip
pip3 install pytest
- name: Set Up Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt install -y cmake ninja-build pkg-config clang-15 g++-12 libcairo2-dev gnuplot libmpfr-dev python3-pip python3.11-dev
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
sudo pip3 install pytest
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} -G "Ninja" -DWERROR=ON -DPYTHON_TEST_FORCE=ON
- name: Build Library and Bindings
working-directory: ${{runner.workspace}}/build
run: cmake --build . --parallel $($NPROC)
- name: Build Tests
working-directory: ${{runner.workspace}}/build
run: cmake --build . --parallel $($NPROC) --target tests
- name: Test
working-directory: ${{runner.workspace}}/build
run: ctest -j $($NPROC) --output-on-failure