Skip to content

feat: add cargo-tarpaulin coverage reporting (#63) - #332

Merged
Calebux merged 1 commit into
zintarh:mainfrom
bashir347:feat/issue-63-coverage-reporting
Jul 29, 2026
Merged

feat: add cargo-tarpaulin coverage reporting (#63)#332
Calebux merged 1 commit into
zintarh:mainfrom
bashir347:feat/issue-63-coverage-reporting

Conversation

@bashir347

Copy link
Copy Markdown
Contributor

Adds line coverage measurement and reporting to the project using cargo-tarpaulin.

Changes

  • tarpaulin.toml — new config file. Key decisions:

    • lib = true because the crate is cdylib; tarpaulin can't instrument a wasm binary so it
      targets the native test binary instead
    • fail-under = 90 enforces the >90% line coverage acceptance criterion on every CI run
    • out = ["Html", "Xml"] for a browsable report and Cobertura XML for Codecov
    • Excludes src/test.rs, src/security_test.rs, src/prop_test.rs, src/constants.rs — test
      scaffolding and empty files shouldn't skew the metric
  • .github/workflows/ci.yml — coverage job updated:

    • Cargo registry cache to avoid reinstalling tarpaulin on every run
    • Idempotent install guard (command -v cargo-tarpaulin)
    • Runs cargo tarpaulin --config tarpaulin.toml (explicit config path)
    • Uploads cobertura.xml to Codecov via codecov/codecov-action@v4; fail_ci_if_error: false so a
      Codecov outage doesn't break CI
    • HTML report uploaded as a 30-day artifact
  • README.md — Codecov badge added

  • .gitignore — /coverage/ excluded

  • Makefile — make coverage target added for local use

Setup required

Add a CODECOV_TOKEN secret in Settings → Secrets → Actions (token from codecov.io
(https://codecov.io) after linking the repo). The badge won't update without it, but CI won't
fail thanks to fail_ci_if_error: false.

Testing

Run locally with:

cargo install cargo-tarpaulin --locked
make coverage

report at coverage/tarpaulin-report.html

closes #63

- Add tarpaulin.toml config (lib=true for cdylib, fail-under=90,
  Html+Xml output to coverage/, excludes test/prop/constants files)
- Update CI coverage job: cargo cache, idempotent tarpaulin install,
  --config flag, codecov upload, HTML artifact (30 days)
- Add Codecov badge to README
- Gitignore coverage/ directory
- Add make coverage target to Makefile
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@bashir347 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Calebux
Calebux merged commit 3f98944 into zintarh:main Jul 29, 2026
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.

Add code coverage reporting with cargo-tarpaulin

2 participants