diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a35c32743..fb8a735fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,19 @@ jobs: # Fake a TTY shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' run: "python -m tox" + coverage: + name: "Upload coverage" + runs-on: "ubuntu-latest" + needs: tests + steps: + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: . + env_vars: OS,PYTHON + fail_ci_if_error: true + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + verbose: true diff --git a/tox.ini b/tox.ini index 80d30619f..773b1fd88 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,17 @@ [tox] envlist = {py38,py310,py311}-tests,py39-tests-{pytz2018.7,pytz_latest} skip_missing_interpreters = True +work_dir = {env:TOX_WORK_DIR:.tox} [testenv] ignore_errors = True passenv = LANG CI - TRAVIS - TRAVIS_BRANCH - TRAVIS_BUILD_ID - TRAVIS_COMMIT - TRAVIS_JOB_ID - TRAVIS_JOB_NUMBER - TRAVIS_PULL_REQUEST - TRAVIS_REPO_SLUG +set_env = + COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} deps = + coverage pytest freezegun !py36: vdirsyncer @@ -26,7 +22,11 @@ deps = hypothesis commands = - py.test {posargs} + coverage run -m pytest {posargs} + sh -c "coverage combine -q .tox/.coverage.* && coverage xml || true && coverage report" +allowlist_externals = + coverage + sh [gh-actions] python =