From 3d03fe7b4b14b2c31e12b5154452a10d98c96789 Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Wed, 5 Jan 2022 16:22:46 -0500 Subject: [PATCH 1/3] add codecov to GH Actions Signed-off-by: Marques Johansson --- .coveragerc | 17 +++++++++++++++++ .github/workflows/test.yml | 22 ++++++++++++++++++++-- .gitignore | 1 + test/.coveragerc | 8 -------- tox.ini | 29 ++++++++++++++++++++++++++--- 5 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 .coveragerc delete mode 100644 test/.coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..8977d2e --- /dev/null +++ b/.coveragerc @@ -0,0 +1,17 @@ +[run] +branch = True +source = packet + +[report] +exclude_lines = + pragma: no cover + def __repr__ + if .debug: + raise NotImplementedError + if __name__ == .__main__.: +ignore_errors = True +omit = + .tox/* + test/* + setup.py + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9250db..4b8031a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: - - 3.8 + - '3.10' steps: - uses: actions/checkout@v2 @@ -34,6 +34,7 @@ jobs: - 3.7 - 3.8 - 3.9 + - '3.10' steps: - uses: actions/checkout@v2 @@ -41,8 +42,25 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - id: test + - name: Install Dependencies run: | python -m pip install --upgrade setuptools pip wheel pip install tox tox-gh-actions + - name: Test with tox + run: | tox + find . # TODO: remove this + # - name: Upload coverage.xml + # if: ${{ matrix.python-version == '3.10' }} + # uses: actions/upload-artifact@v2 + # with: + # name: tox-gh-actions-coverage + # path: coverage.xml + # if-no-files-found: error + - uses: codecov/codecov-action@v2 + if: ${{ matrix.python-version == '3.10' }} + with: + flags: unittests # optional + name: codecov-umbrella # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) diff --git a/.gitignore b/.gitignore index 2d55625..06651ca 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ htmlcov/ .cache nosetests.xml coverage.xml +unittest_*.xml *,cover .hypothesis/ diff --git a/test/.coveragerc b/test/.coveragerc deleted file mode 100644 index 8fcbd7e..0000000 --- a/test/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: LGPL-3.0-only - -[report] -omit = - */.local/* - -include= - *packet* diff --git a/tox.ini b/tox.ini index c667ef2..7fcbdcc 100644 --- a/tox.ini +++ b/tox.ini @@ -2,25 +2,48 @@ [tox] -envlist = py27,py36,py37,py38,py39 +envlist = py27,py36,py37,py38,py39,py310 skip_missing_interpreters=True +[tool:pytest] +testpaths = test +# addopts = + [gh-actions] python = 2.7: py27 3.6: py36 3.7: py37 - 3.8: py38, mypy + 3.8: py38 3.9: py39 + 3.10: py310, mypy [testenv] +usedevelop=True setenv = PACKET_AUTH_TOKEN = {env:PACKET_AUTH_TOKEN:} deps = pytest + coverage pytest-cov requests_mock commands= - py.test -v --cov {envsitepackagesdir}/packet --cov-report=term-missing test + py.test --cov-append --cov-report=term-missing --cov packet --cov-report xml:{envdir}/../../coverage.xml --junitxml=unittest_{envname}.xml {posargs:-vv} + +depends = + {py39}: clean + report: py39 + +[testenv:report] +deps = coverage +skip_install = true +commands = + coverage report + coverage xml:coverage.xml + +[testenv:clean] +deps = coverage +skip_install = true +commands = coverage erase From 871a0ff432d1e7d1f297b4ebe897580b47eec718 Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Wed, 5 Jan 2022 18:06:24 -0500 Subject: [PATCH 2/3] remove 3.6 and 3.7 testing from GH Action (added 3.10) Signed-off-by: Marques Johansson --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b8031a..2bb99b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,8 +30,6 @@ jobs: matrix: python-version: - 2.7 - - 3.6 - - 3.7 - 3.8 - 3.9 - '3.10' From 953b86d50bb827274f81107a7b0201d287ef3cbd Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Thu, 6 Jan 2022 12:54:39 -0500 Subject: [PATCH 3/3] remove py36,37 from tox environments Signed-off-by: Marques Johansson --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 7fcbdcc..e9f3c7e 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ [tox] -envlist = py27,py36,py37,py38,py39,py310 +envlist = py27,py38,py39,py310 skip_missing_interpreters=True [tool:pytest] @@ -12,8 +12,6 @@ testpaths = test [gh-actions] python = 2.7: py27 - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 3.10: py310, mypy