Skip to content

Commit

Permalink
feat: add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Dec 8, 2023
1 parent 4dd0773 commit c0f9688
Show file tree
Hide file tree
Showing 4 changed files with 764 additions and 5 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: steps.formatter.outputs.checks-failed > 0
run: echo "Some files failed the formatting checks!" && exit 1

lint:
lint-and-coverage:
needs: formatting
runs-on: ubuntu-latest
steps:
Expand All @@ -45,6 +45,9 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1

- name: Create Conan build
run: |
conan profile detect --force
Expand All @@ -64,9 +67,15 @@ jobs:
tidy-checks: '' # force the use of .clang-tidy
database: 'build'

# - name: Fail?
# if: steps.linter.outputs.checks-failed > 0
# run: echo "Some files failed the linting checks!" && exit 1
- name: Run Tests and Generate Coverage Data
run: |
ctest --test-dir build
lcov -c -d build -o coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test:
name: Build on ${{ matrix.os }} (shared=${{ matrix.options.shared }})
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if (SKBUILD)
endif ()

if (NOT BUILD_TESTING STREQUAL OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(CodeCoverage)
append_coverage_compiler_flags()
enable_testing()
endif ()

Expand Down
Loading

0 comments on commit c0f9688

Please sign in to comment.