[cmake] update for coverage test #3
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: C++ CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.25' | |
- name: Install dependencies | |
run: sudo apt-get install -y lcov | |
- name: Build | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. | |
cmake --build . | |
- name: Run tests | |
run: | | |
cd build | |
ctest --output-on-failure | |
- name: Capture coverage | |
run: | | |
cd build | |
lcov --capture --directory . --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' '*/build/*' --output-file coverage.info | |
lcov --list coverage.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/coverage.info |