Switch to gcov for code coverage upload #32
This file contains hidden or 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++ 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: Install coverage tools | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt update | |
| sudo apt install lcov | |
| sudo apt install pipx | |
| pipx install gcovr | |
| - 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 }} |