Merge pull request #271 from SABS-R3-Epidemiology/rccreswell-patch-1 #1646
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: CPP Coverage Report | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-20.04 | |
env: | |
CC: gcc-10 | |
CXX: g++-10 | |
steps: | |
- name: checkout repo & submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: install tools | |
run: sudo apt install lcov | |
- name: make build directory | |
run: mkdir build_dir | |
- name: run unit tests with coverage | |
run: | | |
cmake ../cEpiabm/. -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON | |
cmake --build . --parallel $(nproc) --target unit_tests | |
ctest -j2 --output-on-failure | |
working-directory: build_dir | |
- name: upload coverage results | |
run: | | |
lcov --directory . --capture --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' '*/test/*' '*/examples/*' '*/src/configuration/json.hpp' --output-file coverage.info | |
lcov --list coverage.info | |
bash <(curl https://codecov.io/bash) -f coverage.info | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
working-directory: build_dir |