Skip to content

ci: add coverage badge generator and make targets - #345

Open
markope wants to merge 1 commit into
gammazero:mainfrom
RecordEvolution:pr/coverage-badge
Open

ci: add coverage badge generator and make targets#345
markope wants to merge 1 commit into
gammazero:mainfrom
RecordEvolution:pr/coverage-badge

Conversation

@markope

@markope markope commented May 4, 2026

Copy link
Copy Markdown

Replaces the dead Travis badge in README.md with a GitHub Actions CI badge and a shields.io coverage badge whose percentage is regenerated in place by make coverage.

  • make test-coverage runs go test -race -coverprofile once over the whole module and writes the total percentage to coverage.txt. The transport-matrix variants in make test are intentionally not re-run here since they exercise transport edge cases, not different code paths in the router/wamp/client packages we measure.
  • make coverage-badge (depends on test-coverage) reads coverage.txt, picks a shields.io-compatible color from the same thresholds shields uses for its built-in coverage badges (red/orange/yellow/yellowgreen/ brightgreen at 50/70/80/90), and rewrites the Coverage badge URL in README.md in place via cross-platform sed. shields.io renders the badge on the fly so no SVG artifact is committed.
  • make coverage is a convenience alias.

CI runs make coverage on ubuntu-latest and warns (does not fail) if the badge in README.md drifted, so PRs with stale badges surface in the workflow logs without blocking merge.

Re-running make coverage against the same percentage produces no diff (deterministic output).

Description, Motivation and Context

We want to extend and harden the nexus for our usage patterns. We would like to do this in an upstream friendly way.
First on our list is to extend the testing framework to cover more tests and to provide a WAMP-spec harness.
This is a first PR with just a code coverage badge and tooling.

The goal is to just make test coverage more transparent and coverage more prominent.

What kind of change does this PR introduce?

  • Enhancement (improve existing code or documentation without affecting behavior)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • Overall test coverage is not decreased.
  • All new and existing tests passed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Replaces the dead Travis badge in README.md with a GitHub Actions CI
badge and a shields.io coverage badge whose percentage is regenerated
in place by `make coverage`.

- `make test-coverage` runs `go test -race -coverprofile` once over the
  whole module and writes the total percentage to coverage.txt. The
  transport-matrix variants in `make test` are intentionally not re-run
  here since they exercise transport edge cases, not different code
  paths in the router/wamp/client packages we measure.
- `make coverage-badge` (depends on test-coverage) reads coverage.txt,
  picks a shields.io-compatible color from the same thresholds shields
  uses for its built-in coverage badges (red/orange/yellow/yellowgreen/
  brightgreen at 50/70/80/90), and rewrites the Coverage badge URL in
  README.md in place via cross-platform sed. shields.io renders the
  badge on the fly so no SVG artifact is committed.
- `make coverage` is a convenience alias.

CI runs `make coverage` on ubuntu-latest and warns (does not fail) if
the badge in README.md drifted, so PRs with stale badges surface in the
workflow logs without blocking merge.

Re-running `make coverage` against the same percentage produces no
diff (deterministic output).
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