Skip to content

Test coverage#89

Merged
greatest0fallt1me merged 34 commits intoCalloraOrg:mainfrom
clintjeff2:test-coverage
Feb 27, 2026
Merged

Test coverage#89
greatest0fallt1me merged 34 commits intoCalloraOrg:mainfrom
clintjeff2:test-coverage

Conversation

@clintjeff2
Copy link
Contributor

@clintjeff2 clintjeff2 commented Feb 25, 2026

chore: add test coverage report and 95% target

Summary

Implements issue #53 — adds cargo-tarpaulin based test coverage measurement
and enforces a minimum of 95 % line coverage on every push and pull-request.


Changes

New files

File Purpose
tarpaulin.toml cargo-tarpaulin configuration — fail-under = 95, HTML + XML + Stdout reports, lib = true to avoid Soroban cdylib linker issues
scripts/coverage.sh One-command local coverage runner; auto-installs cargo-tarpaulin if missing
.github/workflows/coverage.yml CI workflow: runs on push / PR, uploads HTML artefact, posts coverage table as a PR comment

Modified files

File Change
contracts/vault/src/test.rs Expanded from 2 to 8 tests — added cases for None initial balance, uninitialised vault, insufficient-balance guard, exact-balance deduction, and get_meta field validation
README.md New Test coverage section documents local and CI usage
.gitignore Added coverage/ to keep generated HTML / XML out of git

Coverage result

100 % line coverage (24 / 24 lines) — exceeds the 95 % minimum.
Screenshot from 2026-02-25 07-55-37


How to reproduce locally

# One-time setup + run
./scripts/coverage.sh

# Or directly
cargo tarpaulin --config tarpaulin.toml

Open coverage/tarpaulin-report.html in a browser for the interactive report.


CI behaviour

  • cargo tarpaulin --config tarpaulin.toml runs on every push to main / master and on every PR.
  • The workflow exits non-zero (failing the required check) if coverage drops below 95 %.
  • The HTML report is uploaded as a downloadable workflow artefact (kept 30 days).
  • A summary table is posted as a comment on every pull-request.

Checklist

  • All 8 tests pass (cargo test)
  • Coverage ≥ 95 % verified locally (cargo tarpaulin)
  • tarpaulin.toml parses without warnings
  • scripts/coverage.sh is executable and self-contained
  • GitHub Actions workflow added
  • README updated with coverage section
  • coverage/ added to .gitignore
  • Screenshot of passing coverage run attached above

Closes #53

@greatest0fallt1me
Copy link
Contributor

@clintjeff2 resolve the conflicts

@greatest0fallt1me
Copy link
Contributor

@clintjeff2 please fix the pipeline & resolve the conflicts

@clintjeff2
Copy link
Contributor Author

I have been fixing conflicts now for the pass 2 hours. Each time you merge some other work I have to refix, this is exhausting

@clintjeff2
Copy link
Contributor Author

Fixed them

@greatest0fallt1me
Copy link
Contributor

@clintjeff2 please resolve the conflicts

@clintjeff2
Copy link
Contributor Author

@greatest0fallt1me @greatest0fallt1me
MERGE PLEASE

@greatest0fallt1me
Copy link
Contributor

@clintjeff2 please resolve the conflicts

@greatest0fallt1me greatest0fallt1me merged commit ab09326 into CalloraOrg:main Feb 27, 2026
0 of 3 checks passed
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 Cargo Test Coverage Report to CI or Local Script

2 participants