Skip to content

Commit

Permalink
Add Codecov coverage upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormheg committed Oct 5, 2023
1 parent 4ec84bf commit 7e10b37
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,25 @@ 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 }}
if: ${{ matrix.toxenv == 'py' }}
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 }})
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/build
/dist
/wagtail_ab_testing.egg-info
/.coverage
/.coverage*
/htmlcov
/.tox
/venv
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 7e10b37

Please sign in to comment.