Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 25, 2025

This PR integrates comprehensive code coverage into the OpenMina repository, following the approach used in proof-systems#2504.

Features Added

🎯 Makefile Targets

  • make setup-coverage-tools - Install required coverage tools (llvm-tools-preview, grcov)
  • make test-coverage - Run basic tests with coverage (libraries and tests only)
  • make test-with-coverage - Run comprehensive tests with coverage (includes binaries)
  • make coverage-report - Generate HTML coverage report
  • make coverage-lcov - Generate LCOV report for CI/codecov
  • make coverage-summary - Display coverage summary in terminal
  • make coverage-clean - Clean all coverage data and reports

🌙 CI Integration

  • Nightly workflow that runs coverage analysis at 2:00 AM UTC daily
  • Manual trigger with choice between basic/comprehensive coverage
  • Automatic upload to Codecov with proper token handling
  • Artifact preservation for coverage reports (30-day retention)
  • Coverage summary in GitHub step summary

⚙️ Configuration

  • codecov.yml with appropriate ignore patterns and thresholds
  • Coverage targets: 70% minimum, 85% target, 95% excellent
  • Integration with GitHub checks and annotations
  • Proper exclusions for test files, generated code, and tooling

📚 Documentation

  • Comprehensive coverage guide at website/docs/developers/code-coverage.md
  • Usage examples and troubleshooting guide
  • IDE integration instructions (VS Code Coverage Gutters)
  • Best practices for writing testable code
  • Added to developer documentation sidebar

Usage Examples

# Quick setup
make setup-coverage-tools

# Fast coverage during development
make test-coverage
make coverage-summary

# Comprehensive coverage for analysis
make test-with-coverage
make coverage-report
open target/coverage/html/index.html

# Generate reports for CI
make coverage-lcov

# Clean up
make coverage-clean

Verification

The implementation has been tested end-to-end:

  • ✅ Coverage data collection works correctly
  • ✅ HTML and LCOV report generation verified
  • ✅ Coverage summary displays properly
  • ✅ All Makefile targets functional
  • ✅ Documentation accessible and complete

Example coverage output from testing:

| file                            | coverage | covered   | missed_lines      |
|---------------------------------|----------|-----------|-------------------|
| macros/src/action_event.rs      | 0.00%    | 0 / 396   | 19-495            |
| macros/src/lib.rs               | 33.33%   | 3 / 9     | 3-9               |
| macros/src/serde_yojson_enum.rs | 98.37%   | 241 / 245 | 13, 118, 175, 209 |

Total coverage: 37.54%

This provides a solid foundation for tracking and improving code coverage across the OpenMina codebase.

Fixes #1197.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Code quality: integrate code coverage Integrate code coverage with Makefile targets, nightly CI, and Codecov Jul 25, 2025
@Copilot Copilot AI requested a review from dannywillems July 25, 2025 12:47
Copilot finished work on behalf of dannywillems July 25, 2025 12:47
@dannywillems dannywillems force-pushed the copilot/fix-1197 branch 2 times, most recently from 0e8f535 to da55f86 Compare July 25, 2025 18:30
@dannywillems dannywillems marked this pull request as ready for review August 22, 2025 07:41
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.

Code quality: integrate code coverage
2 participants