Conversation
Signed-off-by: sandhi <sagarwal@progress.com>
There was a problem hiding this comment.
Pull request overview
This PR adds test coverage reporting for Go unit tests by redirecting test output to a file and uploading it as a GitHub Actions artifact.
Changes:
- Redirects Go test output to a quality report file
- Adds a new GitHub Actions step to upload the test coverage artifact
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if: ${{ inputs.language == 'go' && inputs.unit-tests == true && inputs.build-profile == 'cli' }} | ||
| run: | | ||
| go test -v ./... | ||
| go test -v ./... > ${{ inputs.quality-junit-report }} |
There was a problem hiding this comment.
Redirecting test output with > will lose stderr and won't capture actual coverage data. The command should use -coverprofile flag to generate proper coverage output (e.g., go test -v -coverprofile=coverage.out ./...), and consider using tee if you need both console output and file output.
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| # Name of the artifact to upload. | ||
| name: test-coverage.out |
There was a problem hiding this comment.
The artifact name 'test-coverage.out' is misleading since the captured output is test results in text format, not actual coverage data. Consider renaming to 'test-output' or 'test-results' to accurately reflect the content.
| name: test-coverage.out | |
| name: test-results |
| if: ${{ inputs.language == 'go' && inputs.unit-tests == true && inputs.build-profile == 'cli' }} | ||
| run: | | ||
| go test -v ./... | ||
| go test -v ./... > ${{ inputs.quality-junit-report }} |
There was a problem hiding this comment.
The output is being redirected to quality-junit-report but go test with -v produces plain text output, not JUnit XML format. To generate JUnit reports, you need a tool like gotestsum or go-junit-report to convert the output.
Description
Added a small step to create the go unit test case coverage file and upload it
Related Issue
Types of changes
Checklist:
Gemfile.lockhas changed, I have used--conservativeto do it and included the full output in the Description above.