Skip to content

Commit

Permalink
Code coverage (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kokorin authored Jul 31, 2024
1 parent 26ad2d7 commit 6fac6df
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
types:
- released
env:
PIP_CACHE_DIR: .cache/pip
HATCH_CACHE_DIR: .cache/hatch
UV_CACHE_DIR: .cache/uv

HATCH_INDEX_USER: __token__
HATCH_INDEX_REPO: main
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
- main
- release/**
env:
PIP_CACHE_DIR: .cache/pip
PRE_COMMIT_HOME: .cache/pre-commit
HATCH_CACHE_DIR: .cache/hatch

HATCH_INDEX_USER: __token__
HATCH_INDEX_REPO: test
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_TOKEN }}
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ on:
- opened
- reopened
- synchronize
env:
PIP_CACHE_DIR: .cache/pip
PRE_COMMIT_HOME: .cache/pre-commit
HATCH_CACHE_DIR: .cache/hatch
UV_CACHE_DIR: .cache/uv
jobs:
test:
strategy:
Expand All @@ -39,3 +34,18 @@ 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 --cover
- uses: codecov/[email protected]
with:
verbose: true
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DBT-PUMPKIN

[![codecov](https://codecov.io/github/kokorin/dbt-pumpkin/graph/badge.svg?token=EKGRIWEIMZ)](https://codecov.io/github/kokorin/dbt-pumpkin)

`dbt-pumpkin` is a command-line tool which helps to manage [DBT](https://docs.getdbt.com/docs/introduction) projects.

Inspired by [dbt-osmosis](https://z3z1ma.github.io/dbt-osmosis/)
Expand Down
18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ source = "versioningit"

[tool.hatch.build]
exclude = [
"/.cache",
"/.github",
"/tests",
"/.pre-commit-config.yaml",
Expand All @@ -49,12 +48,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,16 +72,15 @@ 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]
method = "git"
default-tag = "v0.0.0"

[tool.ruff]
# cache directory for GH actions
extend-exclude = [".cache"]

[tool.yamlfix]
explicit_start = false
whitelines = 1
Expand Down

0 comments on commit 6fac6df

Please sign in to comment.