Skip to content

Commit

Permalink
Code coverage
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
kokorin committed Jul 31, 2024
1 parent 26ad2d7 commit acf387e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ jobs:
- run: pre-commit run --from-ref origin/main --to-ref HEAD
- run: hatch fmt --check
- run: hatch test --all

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- run: pip install hatch
- run: hatch test --coverage
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ __pycache__
/.idea
/dist

#coverage reports
/.coverage
/coverage.xml

#auto-generated
/dbt_pumpkin/version.py
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ EXPECTED_PYTHON_VERSION = "3.12"
EXPECTED_DBT_VERSION = "1.8"

[tool.hatch.envs.hatch-test]
dependencies = [
"pytest",
extra-dependencies = [
"dbt-core~={matrix:dbt}.0",
"dbt-duckdb~={matrix:dbt}.0"
]

[tool.hatch.envs.hatch-test.scripts]
# To change cov-report script we have to re-define all other scripts too
run = "pytest{env:HATCH_TEST_ARGS:} {args}" # default
run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" # default
cov-combine = "coverage combine" # default
cov-report = ["coverage report", "coverage xml"] # xml added

[tool.hatch.envs.hatch-test.env-vars]
EXPECTED_PYTHON_VERSION = "{matrix:python}"
EXPECTED_DBT_VERSION = "{matrix:dbt}"
Expand All @@ -67,6 +73,9 @@ dbt = ["1.5", "1.6", "1.7", "1.8"]
python = ["3.12"]
dbt = ["1.7", "1.8"]

[tool.coverage.report]
include = ["dbt_pumpkin/**"]

[tool.versioningit]

[tool.versioningit.vcs]
Expand Down

0 comments on commit acf387e

Please sign in to comment.