Generate and upload code coverage
This commit is contained in:
parent
d5fffcae05
commit
18f3bd2408
21
.github/workflows/test.yaml
vendored
21
.github/workflows/test.yaml
vendored
@ -4,11 +4,13 @@ on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.10"]
|
||||
include:
|
||||
- python-version: "3.9"
|
||||
use_coverage: 'coverage'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -31,5 +33,18 @@ jobs:
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Install Tox and any other packages
|
||||
run: pip install tox
|
||||
- name: Run Tox
|
||||
|
||||
- name: Test without coverage
|
||||
if: "! matrix.use_coverage"
|
||||
run: tox -e py # Run tox using the version of Python in `PATH`
|
||||
|
||||
- name: Test with coverage
|
||||
if: "matrix.use_coverage"
|
||||
run: tox -e py-coverage
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
if: "matrix.use_coverage"
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
|
||||
6
codecov.yml
Normal file
6
codecov.yml
Normal file
@ -0,0 +1,6 @@
|
||||
# reference: https://docs.codecov.io/docs/codecovyml-reference
|
||||
coverage:
|
||||
status:
|
||||
patch: true
|
||||
project: false
|
||||
comment: false
|
||||
@ -9,7 +9,6 @@ mock>=2.0.0
|
||||
sphinx>=1.4 # BSD
|
||||
recommonmark
|
||||
sphinx_markdown_tables
|
||||
codecov>=1.4.0
|
||||
pycodestyle
|
||||
autopep8
|
||||
isort
|
||||
|
||||
14
tox.ini
14
tox.ini
@ -11,8 +11,11 @@ deps = -r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
commands =
|
||||
python -V
|
||||
!functional: pytest -vvv -s --ignore=kubernetes/e2e_test
|
||||
!functional: pytest -vvv -s {env:_TOX_COVERAGE_RUN:} --ignore=kubernetes/e2e_test
|
||||
functional: {toxinidir}/scripts/kube-init.sh pytest -vvv -s []
|
||||
coverage: python -m coverage xml
|
||||
setenv =
|
||||
coverage: _TOX_COVERAGE_RUN=--cov=kubernetes/watch --cov=kubernetes/config
|
||||
|
||||
[testenv:docs]
|
||||
commands =
|
||||
@ -21,12 +24,3 @@ commands =
|
||||
[testenv:update-pycodestyle]
|
||||
commands =
|
||||
{toxinidir}/scripts/update-pycodestyle.sh
|
||||
|
||||
[testenv:coverage]
|
||||
commands =
|
||||
python -V
|
||||
pytest --cov=kubernetes/watch --cov=kubernetes/config kubernetes/watch kubernetes/config
|
||||
|
||||
[testenv:codecov]
|
||||
commands =
|
||||
codecov
|
||||
|
||||
Loading…
Reference in New Issue
Block a user