fix(ci): fix coverage summary parsing#488
Conversation
📝 WalkthroughWalkthroughCoverage artifact upload now tolerates missing files; the coverage-summary step runs under a broader Changes
Sequence Diagram(s)sequenceDiagram
participant Runner as Runner (GitHub Actions)
participant FS as Filesystem (workspace)
participant Artifact as Artifact Service
participant GH_SUM as GitHub Step Summary
Runner->>FS: Run tests → generate coverage outputs
Runner->>FS: Check `coverage/` and `coverage/lcov.info`
alt lcov exists and non-empty
Runner->>FS: awk parse LINES_FOUND & LINES_HIT
Runner->>GH_SUM: Append coverage markdown table
else missing or empty lcov
Runner->>GH_SUM: Write "⚠️ No coverage data found." to $GITHUB_STEP_SUMMARY
end
Runner->>Artifact: Upload `coverage/` artifact (if-no-files-found: warn)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build-and-test.yml:
- Around line 116-119: The LINES_FOUND/LINES_HIT parsing using grep with "||
echo 0" can produce multi-line values under pipefail; replace the grep pipeline
with an awk one-liner that prints a single numeric count for DA entries and a
single numeric count for DA entries where the second field is non-zero (assign
to LINES_FOUND and LINES_HIT respectively) so the variables contain only plain
integers; then compute COVERAGE using those integers and guard the COVERAGE
calculation in case LINES_FOUND is zero to avoid division-by-zero. Use the
existing variable names LINES_FOUND, LINES_HIT and COVERAGE so the rest of the
workflow remains unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 94eb9b1d-e115-4870-ad4b-a471113e432a
📒 Files selected for processing (1)
.github/workflows/build-and-test.yml
- Use awk instead of grep for lcov parsing (avoids pipefail issues) - Add file existence check before parsing coverage - Add if-no-files-found: warn to artifact upload - Run coverage summary only on PRs with always() condition - Add fallback message when no coverage data found Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
Summary by CodeRabbit
Note: This release contains no user-facing changes.