Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage calculation #547

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ruff
tox
coverage
Loading