Skip to content

Testing and releases

github-actions[bot] edited this page Nov 23, 2026 · 7 revisions

Testing and releases

Local checks

python -m pre_commit run --all-files
python -m pytest -n 2 -q --durations=10 --cov=smd_reports --cov-branch --cov-report=term-missing --cov-report=xml --cov-report=html
python -m mkdocs build --strict
python -m build
python -m twine check --strict dist/*
python scripts/check_installation.py

Tests cover JSON validation, scalar type preservation, dynamic column and grid layouts, localization, image loading, sanitized Markdown, standalone HTML, PDF content and pagination, and command-line behavior. SVG regressions cover static CSS, editor metadata, embedded WOFF2 fonts, encoded resource references, malformed fonts and vector PDF output. Coverage measures the entire package, including branches, with an enforced 75% minimum. HTML and XML reports are written to .artifacts/coverage/.

CI runs on pull requests into dev and master, without duplicate push/tag runs. It runs core checks on Python 3.10, 3.12 and 3.14, and PDF checks on Python 3.12 with WeasyPrint 70.0. It also runs pre-commit, builds documentation and distributions, and checks fresh wheel/source installations.

An optional regression reads external SVG artwork without copying it into the repository:

SMD_REPORTS_REFERENCE_SVG=/path/to/accreditation.svg python -m pytest tests/test_svg.py -q

This checks JSON loading, unchanged embedded artwork, HTML and real vector PDF output. The regular tests use synthetic artwork and bundled fonts, with no institutional marks.

Use -n 2 for two test workers, or omit it when debugging a single process. The --durations=10 summary identifies slow setup and test calls. Example inputs are loaded once per worker; each test receives an independent copy. PDF generation and comparisons still execute for each test.

Report previews

python examples/reports.py --previews --pdf --output examples/rendered
python scripts/visual_review.py examples/rendered

These commands regenerate the previews from every example JSON input, render PDF pages as images, and record page sizes, image hashes and rendering versions under .artifacts/. Use --baseline PATH to compare with an existing capture. Inspect wrapping, page breaks, headers and footers when a rendering change affects the previews.

Browser layout checks

Install Playwright in a development environment and provide a local Chromium executable to run the optional browser regressions:

python -m pip install playwright
SMD_REPORTS_CHROMIUM=/path/to/chromium python -m pytest tests/test_screen_layout.py -q

These checks use synthetic standalone HTML at mobile and desktop widths. They verify cell borders, equal widths, compact single-row lists, full-width multi-row panels, text fit, scrollbar-free matrices and compact description text. They are skipped when Chromium is not configured and do not download a browser.

Release preparation

Feature PRs target dev. Release PRs promote dev to master with a merge commit. Update the package version and changelog, run checks and review the generated examples. The package version is defined once in src/smd_reports/__init__.py.

Release PRs into master must increase the version beyond the exact PR base version and any release tags already reachable from that base. Versions use Python packaging ordering, so 0.1.10 is newer than 0.1.9. Ordinary PRs into dev do not require a version increase. These checks run inside the required branch-flow job; the maintainer review exception does not bypass them.

CHANGELOG.md must contain exactly one entry matching the package version, with a heading such as ## 0.1.1 or ## [0.1.1] - 2026-11-08. Include release changes beneath that heading. Empty sections, placeholder-only notes, comments and code examples do not count as release notes. Keep work in progress under ## Unreleased until preparing a release.

Before opening a release PR, check the candidate locally:

python scripts/check_release.py --base-ref origin/master

Publishing repeats changelog validation and checks the version against previous release tags on master, excluding the candidate's own tag. The first release is allowed when no previous package version or release tags exist.

The publishing workflow is manual. Pushing a branch, merging a PR or adding a tag does not publish a distribution. See publishing setup for account configuration and release commands.

Clone this wiki locally