Skip to content

Commit

Permalink
MAINT: Add codecov support
Browse files Browse the repository at this point in the history
  • Loading branch information
richardotis committed Jan 14, 2024
1 parent 6334592 commit 24bd815
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,27 @@ jobs:
- run: python -m pip install dist/*.whl
- run: python -m pip install pytest
- run: python -m pip list
- run: python -m pytest -v --pyargs kawin
# pytest:
# - The `--import-mode=append` and `--pyargs pycalphad` flags test the installed package over the local one
# - The `--cov` flag is required to turn on coverage
- run: pytest -v --import-mode=append --cov --cov-config=pyproject.toml --pyargs kawin
- run: coverage xml
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: coverage.xml

Upload-Coverage:
runs-on: ubuntu-latest
needs: [Tests]
steps:
# The source code _must_ be checked out for coverage to be processed at Codecov.
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-*
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,18 @@ requires = [
]

build-backend = "setuptools.build_meta"

[tool.coverage.paths]
# The first path is the path to the modules to report coverage against.
# All following paths are patterns to match against the collected data.
# Any matches will be combined with the first path for coverage.
source = [
"./kawin",
"*/lib/*/site-packages/kawin", # allows testing against site-packages for a local virtual environment
]

[tool.coverage.run]
# Only consider coverage for these packages:
source_pkgs = [
"kawin"
]

0 comments on commit 24bd815

Please sign in to comment.