diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ffb96145..ae2129e5 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -125,13 +125,42 @@ jobs: run: | sphinx-build -b html docs docs/_build + coverage: + runs-on: ubuntu-latest + needs: test + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: 3.13 + - name: Install dependencies + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install coverage + - name: Run coverage + run: | + source .venv/bin/activate + export DJANGO_SETTINGS_MODULE="test_settings" + export PYTHONPATH=.".:$PYTHONPATH" + python -m coverage run --source=waffle `which django-admin` test waffle + coverage report -m + coverage html + coverage xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + release-production: # Only upload if a tag is pushed (otherwise just build & check) if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') runs-on: ubuntu-latest - needs: [test, lint, i18n, docs] + needs: [test, lint, i18n, docs, coverage] steps: - uses: actions/checkout@v4 diff --git a/README.rst b/README.rst index d4e18c6a..f5a4e78f 100644 --- a/README.rst +++ b/README.rst @@ -18,7 +18,9 @@ a number of ways. .. image:: https://img.shields.io/readthedocs/waffle :target: https://app.readthedocs.org/projects/waffle :alt: Read the Docs - +.. image:: https://codecov.io/gh/jazzband/django-waffle/branch/master/graph/badge.svg + :target: https://codecov.io/gh/jazzband/django-waffle + :alt: Codecov :Code: https://github.com/jazzband/django-waffle :License: BSD; see LICENSE file diff --git a/requirements/test.txt b/requirements/test.txt index 0b86f4f4..f9b8c7ef 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,2 +1,3 @@ ruff tox +coverage