From 7e10b3791c97469a45d73b29f1d59c6e7226cbc1 Mon Sep 17 00:00:00 2001 From: "Storm B. Heg" Date: Thu, 5 Oct 2023 16:41:19 +0200 Subject: [PATCH] Add Codecov coverage upload --- .github/workflows/test.yml | 11 ++++++++++- .gitignore | 2 +- tox.ini | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01d5988..1880985 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,7 +71,7 @@ jobs: python-version: ${{ matrix.python }} - name: Install dependencies run: | - python -m pip install tox + python -m pip install tox coverage # This step runs only for jobs NOT in the include matrix - name: Run tox targets for Python ${{ matrix.python }} @@ -79,8 +79,17 @@ jobs: run: | # Run only the tox environments that match the Python version tox run -f py$(echo ${{ matrix.python }} | tr -d .) + coverage combine + coverage report + # Codecov does not support the .coverage file generated by coverage, so we convert it to xml + coverage xml env: DATABASE_URL: postgres://postgres:postgres@localhost/wagtail_ab_testing + - name: Upload coverage reports to Codecov + if: ${{ matrix.toxenv == 'py' }} + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # This step runs only for jobs in the include matrix and covers linting - name: Run tox targets for Python ${{ matrix.python }} (${{ matrix.toxenv }}) diff --git a/.gitignore b/.gitignore index 1c2653c..efc90b2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ /build /dist /wagtail_ab_testing.egg-info -/.coverage +/.coverage* /htmlcov /.tox /venv diff --git a/tox.ini b/tox.ini index fa96b00..70e35ca 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ exclude = migrations,node_modules [testenv] install_command = pip install -e ".[testing]" -U {opts} {packages} -commands = coverage run testmanage.py test --deprecation all --noinput +commands = coverage run -p testmanage.py test --deprecation all --noinput basepython = py38: python3.8 @@ -47,7 +47,7 @@ commands=flake8 wagtail_ab_testing [testenv:wagtailmain] basepython=python3.11 -commands = coverage run testmanage.py test --deprecation all --noinput +commands = coverage run -p testmanage.py test --deprecation all --noinput deps= coverage wagtailmain: git+https://github.com/wagtail/wagtail.git \ No newline at end of file