Skip to content

Commit 3d03fe7

Browse files
committed
add codecov to GH Actions
Signed-off-by: Marques Johansson <[email protected]>
1 parent 4f307ff commit 3d03fe7

File tree

5 files changed

+64
-13
lines changed

5 files changed

+64
-13
lines changed

.coveragerc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[run]
2+
branch = True
3+
source = packet
4+
5+
[report]
6+
exclude_lines =
7+
pragma: no cover
8+
def __repr__
9+
if .debug:
10+
raise NotImplementedError
11+
if __name__ == .__main__.:
12+
ignore_errors = True
13+
omit =
14+
.tox/*
15+
test/*
16+
setup.py
17+

.github/workflows/test.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
python-version:
13-
- 3.8
13+
- '3.10'
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -34,15 +34,33 @@ jobs:
3434
- 3.7
3535
- 3.8
3636
- 3.9
37+
- '3.10'
3738

3839
steps:
3940
- uses: actions/checkout@v2
4041
- name: Set up Python ${{ matrix.python-version }}
4142
uses: actions/setup-python@v2
4243
with:
4344
python-version: ${{ matrix.python-version }}
44-
- id: test
45+
- name: Install Dependencies
4546
run: |
4647
python -m pip install --upgrade setuptools pip wheel
4748
pip install tox tox-gh-actions
49+
- name: Test with tox
50+
run: |
4851
tox
52+
find . # TODO: remove this
53+
# - name: Upload coverage.xml
54+
# if: ${{ matrix.python-version == '3.10' }}
55+
# uses: actions/upload-artifact@v2
56+
# with:
57+
# name: tox-gh-actions-coverage
58+
# path: coverage.xml
59+
# if-no-files-found: error
60+
- uses: codecov/codecov-action@v2
61+
if: ${{ matrix.python-version == '3.10' }}
62+
with:
63+
flags: unittests # optional
64+
name: codecov-umbrella # optional
65+
fail_ci_if_error: true # optional (default = false)
66+
verbose: true # optional (default = false)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ htmlcov/
4545
.cache
4646
nosetests.xml
4747
coverage.xml
48+
unittest_*.xml
4849
*,cover
4950
.hypothesis/
5051

test/.coveragerc

Lines changed: 0 additions & 8 deletions
This file was deleted.

tox.ini

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,48 @@
22

33
[tox]
44

5-
envlist = py27,py36,py37,py38,py39
5+
envlist = py27,py36,py37,py38,py39,py310
66
skip_missing_interpreters=True
77

8+
[tool:pytest]
9+
testpaths = test
10+
# addopts =
11+
812
[gh-actions]
913
python =
1014
2.7: py27
1115
3.6: py36
1216
3.7: py37
13-
3.8: py38, mypy
17+
3.8: py38
1418
3.9: py39
19+
3.10: py310, mypy
1520

1621
[testenv]
22+
usedevelop=True
1723
setenv =
1824
PACKET_AUTH_TOKEN = {env:PACKET_AUTH_TOKEN:}
1925

2026
deps =
2127
pytest
28+
coverage
2229
pytest-cov
2330
requests_mock
2431

2532
commands=
26-
py.test -v --cov {envsitepackagesdir}/packet --cov-report=term-missing test
33+
py.test --cov-append --cov-report=term-missing --cov packet --cov-report xml:{envdir}/../../coverage.xml --junitxml=unittest_{envname}.xml {posargs:-vv}
34+
35+
depends =
36+
{py39}: clean
37+
report: py39
38+
39+
[testenv:report]
40+
deps = coverage
41+
skip_install = true
42+
commands =
43+
coverage report
44+
coverage xml:coverage.xml
45+
46+
[testenv:clean]
47+
deps = coverage
48+
skip_install = true
49+
commands = coverage erase

0 commit comments

Comments
 (0)