Skip to content

ci(test-unit): report coverage in job summary and PR comment - #1722

Open
joanestebanr wants to merge 1 commit into
developfrom
ci/test-unit-coverage-report
Open

ci(test-unit): report coverage in job summary and PR comment#1722
joanestebanr wants to merge 1 commit into
developfrom
ci/test-unit-coverage-report

Conversation

@joanestebanr

Copy link
Copy Markdown
Collaborator

🔄 Changes Summary

  • Restore coverage visibility lost with the SonarQube/SonarCloud removal (chore: remove SonarQube/SonarCloud integration #1719), consuming the coverage.out that make test-unit already generates:
    • Coverage summary: print the total from go tool cover -func to the workflow run's job summary
    • Coverage artifact: upload coverage.out as the coverage artifact (downloadable for go tool cover -html inspection; also serves as the diff baseline on pushes to develop/main/release/**)
    • PR comment: new code-coverage-report job (PRs only) posts a sticky comment with the total coverage delta vs the base branch and per-file coverage of changed packages, via fgrosse/go-coverage-report@v1.3.0
  • The report job declares its own scoped permissions (pull-requests: write to comment, actions: read to download the base-branch artifact); the test-unit job is unchanged

⚠️ Breaking Changes

  • None (CI-only change)

📋 Config Updates

  • None

✅ Testing

  • 🤖 Automatic: test-unit runs unchanged on this PR; the new summary step and artifact upload execute in this PR's run
  • 🖱️ Manual: the coverage summary command was verified locally against a real coverage.out profile

🔗 Related PRs

📝 Notes

  • First-run caveat: the code-coverage-report job will fail on PRs with "artifact not found" until this change lands on develop and a push run uploads the first baseline coverage artifact. It is a separate job, so test-unit itself is unaffected.
  • PRs from forks won't get the comment (no pull-requests: write on forked PRs)

🤖 Generated with Claude Code

Replace the coverage visibility lost with the SonarCloud removal (#1719):
print the total from coverage.out to the job summary, upload the profile
as an artifact, and post a sticky diff-coverage comment on PRs with
fgrosse/go-coverage-report using the base-branch artifact as baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27553d686b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


code-coverage-report:
name: code-coverage-report
if: github.event_name == 'pull_request'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip coverage comments on fork PRs

This job now runs for every pull_request, including PRs opened from forks. In that context GitHub downgrades GITHUB_TOKEN to read-only, while fgrosse/go-coverage-report@v1.3.0 ends by calling gh pr comment under set -e and its own README notes fork support is limited because the token cannot post PR comments. Those forked PRs will therefore get a failed code-coverage-report check even when test-unit passes; gate this job to same-repository PRs or make the comment step non-fatal for forks.

Useful? React with 👍 / 👎.

@joanestebanr joanestebanr self-assigned this Jul 13, 2026
@joanestebanr joanestebanr added the code-quality-improvement Code quality improvement label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-quality-improvement Code quality improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant