Skip to content

Conversation

@sandhi18
Copy link
Contributor

Description

Added a small step to create the go unit test case coverage file and upload it

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Signed-off-by: sandhi <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 }}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
uses: actions/upload-artifact@v4
with:
# Name of the artifact to upload.
name: test-coverage.out
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
name: test-coverage.out
name: test-results

Copilot uses AI. Check for mistakes.
if: ${{ inputs.language == 'go' && inputs.unit-tests == true && inputs.build-profile == 'cli' }}
run: |
go test -v ./...
go test -v ./... > ${{ inputs.quality-junit-report }}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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