Skip to content

fix(ci): fix coverage summary parsing#488

Merged
LakshanSS merged 1 commit intoopenchoreo:mainfrom
kaviththiranga:coverage
Apr 2, 2026
Merged

fix(ci): fix coverage summary parsing#488
LakshanSS merged 1 commit intoopenchoreo:mainfrom
kaviththiranga:coverage

Conversation

@kaviththiranga
Copy link
Copy Markdown
Contributor

@kaviththiranga kaviththiranga commented Apr 2, 2026

image

Summary by CodeRabbit

  • Chores
    • CI now publishes the coverage summary on all event runs while retaining PR context, warns instead of failing when coverage files are missing, and provides clearer diagnostics when coverage data is missing or empty; detailed coverage metrics are only included when valid data is present.

Note: This release contains no user-facing changes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

Coverage artifact upload now tolerates missing files; the coverage-summary step runs under a broader always() condition while still requiring PR context. Summary generation checks that coverage/lcov.info exists and is non-empty, uses awk to compute metrics, writes a markdown table only when data present, or a "⚠️ No coverage data found." warning otherwise.

Changes

Cohort / File(s) Summary
CI Workflow — Coverage & Reporting
​.github/workflows/build-and-test.yml
Set artifact upload if-no-files-found: warn; changed coverage-summary step condition to if: always() && github.event_name == 'pull_request'; added existence/non-empty check for coverage/lcov.info; replaced grep parsing with awk counts and write table only when LINES_FOUND > 0; write "⚠️ No coverage data found." when missing/empty.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • sameerajayasoma
  • jhivandb
  • LakshanSS

Poem

🐰 I hopped through jobs and logs so spry,
Searched for lcov under moonlit sky.
If none I find, I place a note,
Else I tally lines and proudly wrote.
Coverage safe—no need to cry.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description contains only a screenshot image without any text content matching the required template sections like Purpose, Goals, Approach, etc. Add a detailed description following the repository template, including Purpose, Goals, Approach, and relevant sections such as Test environment and Automation tests.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The PR title 'fix(ci): fix coverage summary parsing' accurately describes the main change—improving coverage summary parsing robustness in the CI workflow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b1ba4e5 and bfc96f6.

📒 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>
@kaviththiranga kaviththiranga changed the title fix(ci): make coverage upload and summary more robust fix(ci): fix coverage summary parsing Apr 2, 2026
@LakshanSS LakshanSS merged commit 077a91d into openchoreo:main Apr 2, 2026
7 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.

2 participants