Skip to content

Test coverage reporting in CI #46

@tamtom

Description

@tamtom

Summary

Add test coverage reporting to the CI pipeline so developers and reviewers can track test coverage over time. Coverage reports should be generated on every PR, uploaded as artifacts, and optionally displayed as a badge in the README.

Implementation Plan

  • Add make test-coverage target to Makefile:
    test-coverage:
    	go test -coverprofile=coverage.out -covermode=atomic ./...
    	go tool cover -html=coverage.out -o coverage.html
    	go tool cover -func=coverage.out
  • Update .github/workflows/pr-checks.yml:
    • Replace make test with make test-coverage (or add as separate step)
    • Upload coverage.out and coverage.html as GitHub Actions artifacts
    • Print coverage summary in job output
  • Add .gitignore entries for coverage files:
    • coverage.out
    • coverage.html
  • Optional — Coverage badge:
    • Integrate with Codecov or Coveralls for automatic badge generation
    • Add badge to README.md: [![Coverage](badge-url)](coverage-url)
  • Optional — Coverage threshold enforcement:
    • Add a step that parses coverage.out and fails if total coverage drops below a threshold (e.g., 50%)
    • Use a simple Go script or shell command to extract the total percentage
  • Add make test-coverage-view for local development:
    test-coverage-view: test-coverage
    	open coverage.html

Files to Create/Modify

  • Modify: Makefile (add test-coverage, test-coverage-view targets)
  • Modify: .github/workflows/pr-checks.yml (add coverage step, artifact upload)
  • Modify: .gitignore (add coverage.out, coverage.html)
  • Modify (optional): README.md (add coverage badge)

Acceptance Criteria

  • make test-coverage generates coverage.out and coverage.html
  • make test-coverage prints function-level coverage summary to stdout
  • CI uploads coverage report as a downloadable artifact on every PR
  • Coverage files are in .gitignore
  • Coverage report is viewable locally with make test-coverage-view
  • (Optional) Coverage badge displays in README
  • (Optional) CI fails if coverage drops below configured threshold

ASC Reference

ASC CLI tracks test coverage in CI and uses it to maintain quality standards. Coverage reports help identify untested code paths and ensure new features include adequate tests. The gplay CLI should adopt similar practices to maintain code quality as the project grows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    asc-parityFeature parity with ASC CLItestingTesting infrastructure

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions