Skip to content

Commit

Permalink
Add codecov integration
Browse files Browse the repository at this point in the history
  • Loading branch information
unmade committed Apr 5, 2020
1 parent 3a7ad5a commit 1328059
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ branch = true
source =
audiomatch
tests
parallel = true

[report]
precision = 2
fail_under = 100
show_missing = true
omit = *tests/data*
12 changes: 12 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ jobs:
- name: Test
run: |
tox -e py
- name: Generate coverage report
run: |
tox -e coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pip-wheel-metadata
dist

.coverage
.coverage.*
*coverage*
!.coveragerc

__pycache__
.pytest_cache
Expand Down
2 changes: 0 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[pytest]
addopts = --cov --cov-fail-under=0

markers =
slow: marks test as slow to run
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ basepython = python3

[testenv]
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
usedevelop = false
Expand All @@ -25,3 +26,16 @@ deps =
pre-commit
commands =
pre-commit run --all-files {posargs}

[testenv:coverage]
skip_install = True
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage
deps =
coverage
commands =
coverage combine
coverage report --fail-under=100
coverage xml -o {toxinidir}/coverage.xml
depends =
{py38}

0 comments on commit 1328059

Please sign in to comment.