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

enable coverage for PRs #17204

Merged
merged 14 commits into from
Nov 8, 2024
Merged

enable coverage for PRs #17204

merged 14 commits into from
Nov 8, 2024

Conversation

tgummerer
Copy link
Collaborator

Codecov numbers should be stable enough now to enable them for PRs as well.

@tgummerer tgummerer requested a review from a team as a code owner September 9, 2024 12:20
@tgummerer tgummerer added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Sep 9, 2024
@tgummerer tgummerer force-pushed the tg/enable-codecov-checks branch from f63b1e3 to 61bd8d6 Compare September 9, 2024 14:37
Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

Definitely want to do this!

Aren't we still running a different set of tests between PRs and merges? If so, this may end up destabilizing the coverage numbers (PRs will report a smaller coverage number than merges).

I think we need to make sure we're running the full set of tests on PRs. Maybe that means we run the full tests on the current language runtime version, and report coverage for that for both PRs and merges. And then have merges also run on minimum language runtime version as well, but don't report coverage for those tests? Something like that? Or open to other ideas.

@tgummerer tgummerer force-pushed the tg/enable-codecov-checks branch 6 times, most recently from b868d9b to d497bd7 Compare September 23, 2024 09:19
@tgummerer
Copy link
Collaborator Author

I managed to set the base of the PR correctly here now, but the results are still somewhat sad. Codecov seems to get confused that we are building the merge commit, and attributes wrong coverage because of that. Looking at the codecov result, it looks like it's attributing missing coverage to comments, or even lines that can't even be uncovered, e.g.

ps_screenshot

So I think our options here I think are:

  • make sure that the PR is always based on the latest commit on master (that's pretty annoying, and will lead to a lot of rebases on master during PR reviews, which is extra annoying)
  • build the PR checks based on the the HEAD commit, instead of the merge commit. I think this is less annoying, but might lead to some surprises at merge time. Not ideal, but better than the option above.
  • Don't use the coverage numbers as PR checks

There's also the issue Justin points out above regarding running different tests. We would have to run the macos tests during PRs as well, and either start running the Windows tests during merge (making the merge queue more annoying again), or ignore coverage numbers for windows (that's probably fine?). But there's also things like sdk/go/common/util/ciutil/github_actions.go, which runs different code based on whether we're running during a pull request or in the merge queue, so the coverage numbers for that will always be different.

@mikhailshilkov
Copy link
Member

I have a hard time imagining the experience in my head. Is it safe to ship the check (the least bad option, without blocking PRs on it) and live with it for a couple of days?

@tgummerer
Copy link
Collaborator Author

I was planning on discussing this in ideation tomorrow before merging it.

@tgummerer
Copy link
Collaborator Author

I think I got the merge commit thing right now, with there only being small diffs in the code coverage from running a different set of tests in the merge queue and on PR still. However now the status checks don't show up anymore 🤦

I opened an upstream issue to ask about this: codecov/codecov-action#1581

@blampe
Copy link
Contributor

blampe commented Oct 10, 2024

https://app.codecov.io/gh/pulumi/pulumi/pull/17204/indirect-changes

Your GitHub PR is based on ebf838e (older) but coverage is getting computed using d30f4b5 (newer) as its base.

You might try computing a value for commit_parent as something like git merge-base {{ github.base_ref }} {{ github.head_ref }} to find the specific commit you branched from. I would have expected it to do this automatically 🤷

git merge-base origin/master origin/tg/enable-codecov-checks
ebf838e02e36c2549206275c3a40c37f95e1e6c4

@tgummerer tgummerer force-pushed the tg/enable-codecov-checks branch from 530fe56 to 35bda57 Compare October 14, 2024 15:18
@tgummerer
Copy link
Collaborator Author

https://app.codecov.io/gh/pulumi/pulumi/pull/17204/indirect-changes

Your GitHub PR is based on ebf838e (older) but coverage is getting computed using d30f4b5 (newer) as its base.

You might try computing a value for commit_parent as something like git merge-base {{ github.base_ref }} {{ github.head_ref }} to find the specific commit you branched from. I would have expected it to do this automatically 🤷

git merge-base origin/master origin/tg/enable-codecov-checks
ebf838e02e36c2549206275c3a40c37f95e1e6c4

Hrm I gave this a try now, and it's showing the base correctly as 6e9ec22 now, but the coverage data still seems to be broken :( I don't feel like I understand what codecov is doing here at all.

@tgummerer tgummerer force-pushed the tg/enable-codecov-checks branch from 0b8268c to 09f34fa Compare November 5, 2024 15:02
Comment on lines 73 to 75
# codegen tests take quite a while to run.
# Run them only if ci/test is set,
# or if one of the codegen files changed.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this comment outdated now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, good catch! I've updated it now.

@tgummerer tgummerer enabled auto-merge November 7, 2024 18:04
@tgummerer tgummerer added this pull request to the merge queue Nov 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2024
@tgummerer tgummerer enabled auto-merge November 8, 2024 08:34
@tgummerer tgummerer added this pull request to the merge queue Nov 8, 2024
Merged via the queue into master with commit 632e2f8 Nov 8, 2024
86 checks passed
@tgummerer tgummerer deleted the tg/enable-codecov-checks branch November 8, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants