Skip to content

Commit

Permalink
Add coverage testing to ci pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
borchehq committed Aug 22, 2024
1 parent 8bd66eb commit 3233a89
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,35 @@ jobs:
- uses: actions/checkout@v4

- name: Set up CMake
run: sudo apt-get install cmake
run: sudo apt-get install cmake lcov

- name: Configure with CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
- name: Build
run: cmake --build build

- name: Run Tests
run: ctest --test-dir build

- name: Capture Coverage Info
run: |
cd build
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # Remove coverage for system files
lcov --list coverage.info # Optional: Display coverage info
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true



0 comments on commit 3233a89

Please sign in to comment.