RFC: Automated test coverage PR comments for easier code review#648
Open
alfredosa wants to merge 8 commits into
Open
RFC: Automated test coverage PR comments for easier code review#648alfredosa wants to merge 8 commits into
alfredosa wants to merge 8 commits into
Conversation
| if len(parts) == 0 { | ||
| return "" | ||
| } | ||
| return strings.Join(parts, " ") |
There was a problem hiding this comment.
Lines 240-245 are not covered
Contributor
Author
|
See output: 2m 11s
12s
Prepare all required actions
Getting action download info
Download action repository 'aki77/reviewdog-action-code-coverage@v2' (SHA:afe9f2d9588ce5ade4fa73dff380d90c3a7dd31e)
Getting action download info
Download action repository 'reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893' (SHA:e04ffabe3898a0af8d0fb1af00c188831c4b5893)
Download action repository 'baptiste0928/cargo-install@e38323ef017552d7f7af73a3f4db467f278310ed' (SHA:e38323ef017552d7f7af73a3f4db467f278310ed)
Download action repository 'aki77/delete-pr-comments-action@ef208cb51cacbff428349ac715a337b2a07d62ef' (SHA:ef208cb51cacbff428349ac715a337b2a07d62ef)
Run ./.github/actions/go-coverage-reviewdog
Run set -eu
go: downloading github.com/jandelgado/gcov2lcov v1.1.1
Run set -eu
/home/runner/work/_temp/bin/gcov2lcov
Converting var/coverage.out -> var/lcov/var_coverage.out.lcov
Run aki77/reviewdog-action-code-coverage@v2
Run reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893
Run set -eu
🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog
Run set -eu
📖 reviewdog -h
Run # Determine OS and architecture
Downloading lcov_to_checkstyle-x86_64-unknown-linux-musl for linux/x86_64
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 520k 100 520k 0 0 3431k 0 --:--:-- --:--:-- --:--:-- 3431k
Run baptiste0928/cargo-install@e38323ef017552d7f7af73a3f4db467f278310ed
Installing lcov-util...
Restored lcov-util from cache.
Added /home/runner/.cargo-install/lcov-util/bin to PATH.
Installed lcov-util 0.2.1.
Run aki77/delete-pr-comments-action@ef208cb51cacbff428349ac715a337b2a07d62ef
Run lcov-merge $(ls var/lcov/*.lcov) | \
Error: internal/core/core.go:245:0: warning: Lines 240-245 are not covered (coverage) # <-------- HEHE |
There was a problem hiding this comment.
Pull request overview
Adds automated PR feedback for Go test coverage by converting generated coverage.out files to LCOV and using reviewdog to comment uncovered added lines directly in pull requests, reducing the need to inspect CI logs manually (Issue #611).
Changes:
- Add a composite GitHub Action to convert Go coverage profiles to LCOV and post PR annotations via reviewdog.
- Wire the coverage-commenting step into existing Go CI workflows and grant required PR write permissions.
- Adjust a failing pallets validation fixture and add a small core string utility.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/targets/pallets/testdata/fail-validate/.pallet/gitconfig.yaml |
Updates fail fixture to ensure validation fails deterministically. |
internal/core/core.go |
Adds NormalizeWhitespace helper for consistent string normalization. |
.github/workflows/reusable-goapp.yaml |
Runs the new coverage reviewdog step after Go tests and requests PR write permission. |
.github/workflows/mage.yaml |
Runs the new coverage reviewdog step in the mage workflow and requests PR write permission. |
.github/workflows/cicd.yaml |
Grants PR write permission where needed for downstream reusable workflows. |
.github/actions/go-coverage-reviewdog/action.yaml |
New composite action to install gcov2lcov, generate LCOV files, and invoke reviewdog coverage commenting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
74
to
+77
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr aims at adding code coverage comments as an increasing need for reviewers to have this available during code reviews. #611 Is the issue at hand.