Skip to content

Add Code Coverage Reporting to CI #52

@Carrington-dev

Description

@Carrington-dev

Description

Tests run in CI but no coverage reporting, making it hard to identify untested code.

Tasks

  • Add pytest-cov to test dependencies
  • Configure coverage in CI workflow
  • Upload coverage to Codecov or Coveralls
  • Add coverage badge to README
  • Set minimum coverage threshold
  • Block PRs that decrease coverage

Implementation

# .github/workflows/test-dj-payfast.yml
- name: Test with pytest and coverage
  run: |
    pytest --cov=payfast --cov-report=xml --cov-report=html

- name: Upload coverage to Codecov
  uses: codecov/codecov-action@v3
  with:
    file: ./coverage.xml
    fail_ci_if_error: true
    flags: unittests

- name: Check coverage threshold
  run: |
    coverage report --fail-under=80

Acceptance Criteria

  • Coverage calculated in CI
  • Coverage badge in README
  • PRs show coverage changes
  • Minimum threshold enforced

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions