Add coverage workflow #2
Workflow file for this run
This file contains 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: Coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install LCov and dependencies | |
run: | | |
sudo apt-get update -q | |
sudo apt-get install -q -y lcov libhdf5-dev libboost-all-dev | |
git clone https://github.com/catchorg/Catch2.git | |
cd Catch2 | |
git checkout "v3.5.3" | |
cmake -Bbuild -H. -DBUILD_TESTING=OFF | |
sudo cmake --build build/ --target install | |
- name: Configure | |
run: cmake --preset=ci-coverage | |
- name: Build | |
run: cmake --build build/coverage -j 2 | |
- name: Test | |
working-directory: build/coverage | |
run: ctest --output-on-failure --no-tests=error -j 2 | |
- name: Process coverage info | |
run: cmake --build build/coverage -t coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: build/coverage/coverage.info | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |