Skip to content
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

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

ConnorJC3
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 28, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 28, 2023
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: '^1.20.2'
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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?

Copy link
Member

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/...
Copy link
Contributor

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?

Copy link
Contributor Author

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)

@AndrewSirenko
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 28, 2023
@torredil
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2023
@k8s-ci-robot k8s-ci-robot merged commit 2b2439f into kubernetes-sigs:master Sep 28, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants