Skip to content

ci(coverage): pytest-cov + Codecov upload + live badge in README (gate 82%)#30

Merged
codexofc merged 1 commit into
mainfrom
chore/coverage-ci
May 25, 2026
Merged

ci(coverage): pytest-cov + Codecov upload + live badge in README (gate 82%)#30
codexofc merged 1 commit into
mainfrom
chore/coverage-ci

Conversation

@codexofc
Copy link
Copy Markdown
Owner

Summary

  • pytest-cov runs on every CI invocation; coverage.xml is generated and uploaded to Codecov.
  • Local gate: --cov-fail-under=82 in pyproject.toml → CI fails if total drops below 82%.
  • Codecov gate: codecov.yml mirrors the same target with a 1-point project tolerance and 2-point patch tolerance for new PR code.
  • README badge: live Codecov badge added next to the CI workflow badge.

Current coverage

TOTAL    6126    1077    82.05%
328 passed, 2 skipped in 27.31s
Required test coverage of 82% reached. Total coverage: 82.05%

Exclusions

Excluded from coverage as legitimate façade / boilerplate:

  • src/**/__init__.py — module exports only.
  • src/presentation/cli/__main__.py — Typer/argparse wrapper; the actual logic lives in application/use_cases/ which is fully covered.

Codecov setup

For a public repo, codecov-action@v4 works without a token using OIDC trust. If the upload turns out flaky, the maintainer can add a CODECOV_TOKEN secret pulled from https://app.codecov.io/gh/codexofc/cigarspace/settings — the workflow already passes it through if present.

Follow-ups (not in this PR)

  • Push above 85% by adding tests for low-coverage routers (jobs.py 25%, match_jobs.py 31%, media.py 36%).
  • Add a frontend coverage flag once the web has a first vitest suite.

…in README

* pytest now runs with --cov=src + xml + term-missing, gated by
  --cov-fail-under=82 (currently at 82.05% project-wide).
* Excludes from coverage: src/**/__init__.py and the CLI façade
  (src/presentation/cli/__main__.py) whose logic is exercised through
  the application use-cases that ARE covered.
* New codecov.yml mirrors the local gate (project 82%, patch 80%,
  1pt and 2pt tolerance respectively), with ignore patterns for
  generated/façade paths.
* GitHub Actions: codecov/codecov-action@v4 uploads coverage.xml from
  the backend job. Token is optional for public repos but accepted via
  CODECOV_TOKEN secret if/when configured.
* README header: replaced the static 'CI - GitHub Actions' badge by
  the real workflow badge, added a live Codecov coverage badge, and
  switched the release badge to the live shields.io tag query.
@codexofc codexofc merged commit 78bfd52 into main May 25, 2026
2 of 4 checks passed
@codexofc codexofc deleted the chore/coverage-ci branch May 25, 2026 20:06
codexofc added a commit that referenced this pull request May 25, 2026
…31)

Follow-up to #30. The coverage PR exposed two pre-existing CI breakages:

1. **Backend ruff** — A bump of ruff brought a much larger default
ruleset that fired 562 errors (300+ of them were TC*
typing-only-imports). Curated the ignore list to keep CI focused on real
bugs rather than stylistic noise.

2. **Frontend npm install** — `react-intl@10` declares a peer dep on
`@types/react@19`. We're on React 18 (works fine at runtime). Added
`web/.npmrc` with `legacy-peer-deps=true`.

Verified locally:

* `ruff check src tests` → All checks passed.
* `ruff format --check src tests` → 218 files already formatted.
* `pytest` → 328 passed, coverage 82.06%.
* `npm install` + `npm run build` → green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant