Skip to content

Commit bc2580c

Browse files
committed
Enabled coverage in python bindings
1 parent cbd1e42 commit bc2580c

3 files changed

Lines changed: 41 additions & 3 deletions

File tree

.github/workflows/ci-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
check-path: "${{ matrix.path }}"
3737
unit-tests:
3838
name: "Build ${{ matrix.build_type }} with ${{ matrix.cxx }}"
39+
needs: [ "codespell-check" , "format-check" ]
3940
runs-on: ubuntu-22.04
4041
strategy:
4142
matrix:
@@ -126,7 +127,7 @@ jobs:
126127

127128
upload-to-codecov:
128129
name: "Codecov report upload"
129-
needs: [ "unit-tests" , "codespell-check" , "format-check" ]
130+
needs: [ "unit-tests" ]
130131
runs-on: ubuntu-22.04
131132
steps:
132133
- uses: actions/checkout@v4

.github/workflows/python-bindings.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,49 @@ jobs:
4848
run: |
4949
python -m pip install --upgrade pip
5050
python -m pip install -r build-requirements.txt
51-
python -m build
51+
52+
python -m build \
53+
-Ccmake.define.ENABLE_COVERAGE=ON \
54+
-Ccmake.build-type=Debug \
55+
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
56+
5257
pip install dist/*.whl
5358
5459
# Run unit tests
5560
- name: "Run Python tests"
5661
run: |
5762
python -m pip install -r test-requirements.txt
5863
pytest -v tests/python/test_*
64+
65+
- name: "Generate coverage report"
66+
if: ${{ startsWith(matrix.on, 'ubuntu-') }}
67+
run: |
68+
pip install --upgrade gcovr
69+
gcovr \
70+
--exclude-throw-branches \
71+
--xml coverage.xml \
72+
--gcov-executable "${{ startsWith(matrix.cxx, 'clang-') && format('llvm-cov-{0} gcov', env.CXX_VERSION) || format('gcov-{0}', env.CXX_VERSION) }}" \
73+
.
74+
75+
- name: "Upload coverage report"
76+
if: ${{ startsWith(matrix.on, 'ubuntu-') }}
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: ${{ format('{0}-{0}-tests', matrix.on, matrix.python) }}
80+
path: ./coverage.xml
81+
retention-days: 1
82+
if-no-files-found: error
83+
84+
upload-to-codecov:
85+
name: "Codecov report upload"
86+
needs: [ "python-tests" ]
87+
runs-on: ubuntu-22.04
88+
steps:
89+
- uses: actions/checkout@v4
90+
- name: "Download artifacts"
91+
uses: actions/download-artifact@v4
92+
- name: "Upload coverage to Codecov"
93+
uses: codecov/codecov-action@v4
94+
with:
95+
fail_ci_if_error: true
96+
token: ${{ secrets.CODECOV_TOKEN }}

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Documentation = "https://capio.hpc4ai.it/docs/coord-language/"
2424
Repository = "https://github.com/High-Performance-IO/CAPIO-CL"
2525
Issues = "https://github.com/High-Performance-IO/CAPIO-CL/issues"
2626

27-
2827
[tool.scikit-build.metadata.version]
2928
provider = "scikit_build_core.metadata.regex"
3029
input = "CMakeLists.txt"

0 commit comments

Comments
 (0)