Skip to content

Commit 4285d06

Browse files
authored
Use Codecov to report coverage (#154)
* Use Codecov to report coverage * fix coverage calculation
1 parent ad56b5d commit 4285d06

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

.github/workflows/pipeline.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,32 @@ jobs:
194194
run: |
195195
pip install . --no-deps --no-build-isolation
196196
python -m unittest discover tests
197+
198+
coverage:
199+
runs-on: ubuntu-latest
200+
steps:
201+
- uses: actions/checkout@v4
202+
- name: Setup environment
203+
shell: bash -l {0}
204+
run: |
205+
echo -e "channels:\n - conda-forge\n" > .condarc
206+
sed '/- python/d' binder/environment.yml > environment.yml
207+
echo '- coverage' >> environment.yml
208+
- name: Setup Mambaforge
209+
uses: conda-incubator/setup-miniconda@v3
210+
with:
211+
python-version: '3.12'
212+
miniforge-version: latest
213+
condarc-file: .condarc
214+
environment-file: environment.yml
215+
- name: Test
216+
shell: bash -l {0}
217+
timeout-minutes: 30
218+
run: |
219+
pip install . --no-deps --no-build-isolation
220+
coverage run
221+
coverage xml
222+
- name: Upload coverage reports to Codecov
223+
uses: codecov/codecov-action@v5
224+
with:
225+
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Python Workflow Definition
22
[![Pipeline](https://github.com/pythonworkflow/python-workflow-definition/actions/workflows/pipeline.yml/badge.svg)](https://github.com/pythonworkflow/python-workflow-definition/actions/workflows/pipeline.yml)
3+
[![codecov](https://codecov.io/github/pythonworkflow/python-workflow-definition/graph/badge.svg?token=3JXD1GN8LG)](https://codecov.io/github/pythonworkflow/python-workflow-definition)
34
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pythonworkflow/python-workflow-definition/HEAD)
45
[![DOI](https://zenodo.org/badge/945869529.svg)](https://doi.org/10.5281/zenodo.15516179)
56

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ plot = [
3535
"networkx>=2.8.8,<=3.5",
3636
"ipython>=7.33.0,<=9.8.0",
3737
]
38+
39+
[tool.coverage.run]
40+
source = ["python_workflow_definition"]
41+
command_line = "-m unittest discover tests"

0 commit comments

Comments
 (0)