Skip to content

Commit

Permalink
Add codecov (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Feb 9, 2024
1 parent d5aae5b commit 2240c0a
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Reference: https://docs.codecov.com/docs/codecovyml-reference
coverage:
status:
project:
default:
threshold: 0.2%

comment:
# Only comment when coverage changes
require_changes: true
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ jobs:

- name: Run Tests
run: tox
env:
MODULE: ${{ matrix.module }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: ${{ matrix.python-version }}
verbose: true
89 changes: 87 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]

[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
'^\s*\.\.\.\s*$',
'^\s*pass\s*$',
'^\s*raise NotImplementedError\s*$',
]

[tool.coverage.run]
branch = true
relative_files = true
source = ["virtual_library_card", "virtuallibrarycard"]

[tool.isort]
profile = "black"

Expand Down Expand Up @@ -60,9 +73,14 @@ tox-gh-actions = "^3.0"
[tool.poetry.group.dev.dependencies]
parameterized = "^0.9"
pytest = "^7.2.2"
pytest-cov = "^4.0.0"
pytest-django = "^4.5.2"

[tool.pytest.ini_options]
addopts = [
"--cov",
"--cov-report=xml",
]
DJANGO_SETTINGS_MODULE = "virtual_library_card.settings.dev"

[tool.tomlsort]
Expand Down
10 changes: 10 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ setenv =
docker: VLC_DEV_DB_HOST=localhost
docker: VLC_DEV_DB_PORT=9010
docker: VLC_DEV_AWS_S3_ENDPOINT_URL=http://localhost:9011
COVERAGE_FILE = .coverage.{envname}
allowlist_externals =
poetry

[testenv:report]
skip_install = true
commands =
coverage combine
coverage html
allowlist_externals =
poetry
coverage

[docker:db-vlc]
image = postgres:12
environment =
Expand Down

0 comments on commit 2240c0a

Please sign in to comment.