From 8287426deb241f9f444e44dbe8f6f1b2da1922ac Mon Sep 17 00:00:00 2001 From: Tomohiro NAKAMURA Date: Mon, 3 May 2021 08:01:48 +0900 Subject: [PATCH] Add codecov #44 --- .github/actions/test-it/action.yml | 8 +++++--- .github/workflows/test.yml | 12 ++++++++++++ setup.py | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/actions/test-it/action.yml b/.github/actions/test-it/action.yml index db8efba..a5e0a62 100644 --- a/.github/actions/test-it/action.yml +++ b/.github/actions/test-it/action.yml @@ -37,11 +37,13 @@ runs: shell: bash - name: Test with pytest - run: | - "$HOME/.venv${{inputs.python-version}}/bin/python" -m py.test -m "not linter" + run: |- + "$HOME/.venv${{inputs.python-version}}/bin/python" -m py.test -m "not linter" \ + --cov=./ \ + --cov-report="xml:_reports/coverage-${{inputs.python_version}}.xml" shell: bash - name: Output req.txt for cache - run: | + run: |- "$HOME/.venv${{inputs.python-version}}/bin/python" -m pip freeze > requirements.txt shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c647e72..2673bf2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,3 +41,15 @@ jobs: - uses: ./.github/actions/test-it with: python-version: ${{ matrix.python-version }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: _reports/ + flags: unittests + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: true + path_to_write_report: ./coverage/codecov_report.txt + verbose: true diff --git a/setup.py b/setup.py index 632798c..be15829 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def _read(fname): ], license="GPLv3", extras_require={ - "dev": ["pytest"], + "dev": ["pytest", "pytest-cov"], 'dev:python_version>="3.6"': ["flake8", "black", "isort[pyproject]", "pylint"], "release": ["twine"], },