diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5641018..f07e6a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,13 @@ 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 @@ -26,5 +29,21 @@ jobs: - 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 +