Skip to content

Commit 27dce87

Browse files
committed
Add CI run to gather code coverage
1 parent f4edb51 commit 27dce87

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,50 @@ jobs:
4747
run: |
4848
pytest -v
4949
50+
coverage:
51+
name: 'Test coverage'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout source
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Create micromamba environment
60+
uses: mamba-org/setup-micromamba@main
61+
with:
62+
environment-file: dev-environment.yml
63+
cache-environment: true
64+
create-args: lcov
65+
66+
- name: Configure CMake
67+
run: |
68+
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-g -O0 --coverage"
69+
70+
- name: Build with CMake
71+
working-directory: build
72+
run: cmake --build . --parallel 8
73+
74+
- name: Run tests
75+
run: |
76+
pytest -v
77+
78+
- name: Collect C++ coverage
79+
run: |
80+
lcov --version
81+
lcov --output-file coverage.lcov --directory . --capture
82+
lcov --output-file coverage.lcov --extract coverage.lcov '*/git2cpp/src/*'
83+
genhtml coverage.lcov --output-directory outdir
84+
85+
- name: Upload artifact containing coverage report
86+
uses: actions/upload-artifact@v6
87+
with:
88+
name: coverage_report
89+
path: outdir
90+
91+
#- name: Upload coverage to codecov
92+
# uses: codecov/codecov-action@v5
93+
# with:
94+
# files: coverage.lcov
95+
# token: ${{ secrets.CODECOV_TOKEN }}
96+
# verbose: true

0 commit comments

Comments
 (0)