Skip to content

ci: coverage reporting (go test -coverprofile to Codecov + step summary) - #61

Merged
ademboukabes merged 3 commits into
developfrom
ci/coverage-reporting
Oct 13, 2026
Merged

ademboukabes merged 3 commits into
developfrom
ci/coverage-reporting

Conversation

@ademboukabes

Copy link
Copy Markdown
Collaborator

Summary

Closes #51.

Introduces automated test coverage reporting in CI and local developer workflows:

  • Generates Go coverprofile with atomic mode and race detection (go test -race -coverprofile=coverage.out -covermode=atomic ./...).
  • Generates an instant Markdown coverage summary per package rendered in GitHub Step Summary ($GITHUB_STEP_SUMMARY).
  • Uploads coverage to Codecov via codecov/codecov-action@v5 (non-blocking if secret is absent).
  • Exports interactive HTML and raw coverage reports as CI build artifacts (actions/upload-artifact@v4).
  • Provides developer-friendly Makefile targets (make test-coverage and make coverage-html).

What changed

  1. GitHub Actions Workflow (.github/workflows/ci.yml):

    • Replaced plain go test -race ./... with atomic coverprofile generation.
    • Added ./scripts/coverage-summary.sh coverage.out step to emit a clean Markdown summary table into $GITHUB_STEP_SUMMARY.
    • Added codecov/codecov-action@v5 step with fail_ci_if_error: false.
    • Added actions/upload-artifact@v4 step archiving coverage.out and coverage.html (14 days retention).
  2. Portable Summary Script (scripts/coverage-summary.sh):

    • Portable POSIX sh/awk script computing overall statement coverage and per-package breakdown.
    • Categorizes packages with plain text status tags (GOOD >= 70%, WARN 30-69%, LOW < 30%).
    • Appends directly to $GITHUB_STEP_SUMMARY in CI, prints to stdout for local execution.
  3. Makefile & Tooling (Makefile, .gitignore):

    • Added make test-coverage (runs tests with coverprofile and displays report).
    • Added make coverage-html (generates browser-viewable coverage.html).
    • Added coverage.html to .gitignore.
  4. Documentation (CONTRIBUTING.md, docs/BACKLOG.md):

    • Documented make test-coverage and make coverage-html in CONTRIBUTING.md.
    • Marked coverage reporting as shipped in docs/BACKLOG.md.

Verification

  • make test-coverage: PASS (100% tests pass with race detector, overall statement coverage: 68.2%)
  • make lint (go vet ./... + golangci-lint run ./...): PASS (0 issues)
  • make build: PASS
  • ./mctf -C examples/sample-event validate: PASS
  • ./mctf -C examples/sample-event generate --check: PASS

@ademboukabes
ademboukabes merged commit ad86deb into develop Oct 13, 2026
3 checks passed
@ademboukabes
ademboukabes deleted the ci/coverage-reporting branch October 13, 2026 19:49
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