Skip to content

C++ tests

C++ tests #45

Workflow file for this run

name: C++ tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Catch2
run: |
git clone https://github.com/catchorg/Catch2.git
cd Catch2
git checkout "v3.4.0"
mkdir build && cd build
cmake .. -DBUILD_TESTING=Off
make -j $(nproc)
sudo make install
- name: Configure for tests
if: runner.os == 'macOS'
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False -DBUILD_TESTS=True
- name: Configure for coverage
if: runner.os == 'Linux'
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DBUILD_MEX=False -DBUILD_TESTS=True
- name: Build
run: |
cmake --build build
- name: Run tests
working-directory: ./build
run: |
ctest --output-on-failure --verbose
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v5
if: runner.os == 'Linux'
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}