Skip to content

build: 🔨 build coverage report and badge #56

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

Merged
merged 1 commit into from
Apr 22, 2025
Merged
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ htmlcov/
.nox/
.coverage
.coverage.*
coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
Expand Down
22 changes: 20 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,29 @@ run-all: install-deps format-python check-python test-python check-commits build

# Install Python package dependencies
install-deps:
uv sync
uv sync --all-extras --dev

# Run the Python tests
test-python:
uv run pytest
# - A short traceback (tb) mode to make it easier to view
# - Use the `src/` package (importlib)
# - Use code coverage on the `src/` package
# - If tests fail, do not generate coverage report
# - Create the coverage report in XML (for badge), terminal, and HTML
# - Trigger failure if below 90% code coverage
uv run pytest \
--tb=short \
--import-mode=importlib \
--cov=src \
--no-cov-on-fail \
--cov-report=term \
--cov-report=xml \
--cov-report=html \
--cov-fail-under=90
# Make the badge from the coverage report
uv run genbadge coverage \
-i coverage.xml \
-o htmlcov/coverage.svg

# Check Python code with the linter for any errors that need manual attention
check-python:
Expand Down