-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Github actions code coverage CI job #1762
Conversation
Signed-off-by: Connor Catlett <[email protected]>
- name: Set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.20.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe overkill, but can we avoid hardcoding with an env var? https://stackoverflow.com/questions/74021760/how-to-use-environment-variables-on-github-actions-without-hard-coding-them-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what you're suggesting? Can you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently hardcode the go version for other workflows as well but its a good idea to grab it from go mod using go-version-file
: https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file.
|
||
- name: Generate report | ||
run: | | ||
go test -coverprofile base-coverage.tmp ./cmd/... ./pkg/... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance we can get the -html=coverage.out
as an artifact and link the file in the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe so, as we would have to host it somewhere. As far as I can tell GitHub does not host artifacts for you.
I do have an idea to show the code coverage output on the prow test runs, but didn't think it was appropriate for this PR (and might not be possible? needs more investigation)
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: torredil The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is this a bug fix or adding new feature?
"New feature" for CI
What is this PR about? / Why do we need it?
Adds a GitHub Actions CI job to diff code coverage and comment the difference on the PR.
What testing is done?
Note: although the PR jobs will run on this PR, the comment job must be committed to
master
before it can run. See example runs below:Example with decrease: ConnorJC3#2
Example with no change: ConnorJC3#3
Example with increase: ConnorJC3#5
Example with external contributor: ConnorJC3#6