-
Notifications
You must be signed in to change notification settings - Fork 42
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
[bug][github actions] codecov base commit does not match the "merge commit" that the branch used to generate coverage #564
Comments
From a user's perspective this seems to be a bug. Wondering what your thoughts on this are and if there are any work arounds that I'm missing? I'm really pushing hard to adopt codecov and am happy to help get this feature in if needed |
@Ryang20718 sorry I had a stomach bug yesterday. I'm going to escalate this to our product team to take a look |
@thomasrockhu-codecov let me know if there's any additional information I can help provide. We're currently in the middle of switching to codecov and I would love to get these edges ironed out! |
@Ryang20718 sorry I forgot to respond. We made some changes here which should go back to the way we were pulling commits initially for merged commits. Do you mind checking with the vanilla action v5? |
@thomasrockhu-codecov Tried with merge commit sha
|
also tried using a commit from main directly, but same result (report is still not using latest main to compare as base)
|
side note
|
@Ryang20718 yeah, |
@Ryang20718 perhaps I'm not understanding, is this what your commit structure is like
And on |
Assuming the current git structure looks like this
When running coverage right now, base is getting set to B
However, since github actions pull requests merges main into your PR, when running CI, my actual feature branch would have a merged main into my feature branch to run CI, so the merge base commit is D, or you can call it the parent commit. This is what I expect codecov to do when I specify the merge commit as the parent commit.
So I am expecting I'm assuming parrent commit is supposed to allow you to specify the base commit? @thomasrockhu-codecov are there any examples on how to do this with github actions or is there a bug here? |
Ok, setting the base to B makes sense in that first git structure. What I'm not understanding is the GHAction pull request merging main into PR Parent commit should be the commit that is the direct parent to the commit you are uploading. I can look for an example but I don't have one for you. Let me pull back to this PR old.
Looking at the commit history in GitHub What I do notice is that the FIRST commit on this PR on Codecov c177be5 is comparing against Did I get all this right? I will mention that I'm going to be offline for the next week, and going to see if someone on the team can take a look. |
Hi @Ryang20718 Tom handed this issue off to me, let me read though it and see what the issue is. |
correct !
the checkout action on a pull request uses the merge commit of a PR (HEAD of pr merged into target branch) https://github.com/actions/checkout#Checkout-pull-request-HEAD-commit-instead-of-merge-commit |
@rohan-at-sentry I'd love to huddle with you on this one if you have time. I think I understand the issue here, would like to see if it makes any sense. |
let me know if there's anything I can do to help investigate/verify! I'm hoping to make code coverage blocking at dayjob once this is resolved! |
@drazisil-codecov Wondering if you were able to root cause the issue? |
Sorry, for the ping again. Wondering if @drazisil-codecov is still investigating or @thomasrockhu-codecov ? |
Hi @Ryang20718 , I've been super busy, sorry. I believe that Jesse is escalating with engineering as part of your ticket. |
@Ryang20718 I think I understand your question a little better, let me try to make sure I get it and perhaps answer your question.
Let's assume that the structure is like this before you run CI GitHub Actions will do something like
So we actually receive However, If you want the merge of the two, then you would need to merge/rebase the feature branch onto main in order to get |
I was able to narrow down the bug and work around this issue via the CLI. @thomasrockhu-codecov codecov-action has a bug
|
On codecov reports (github actions), we see the base commit used to compare the PR is rather stale. example PR is Ryang20718/cflag#28
i.e if my branch was branched off commit
C
whilstA
is head, if I submit a pull request to run in github actions (for CI), we run on the merged commit.A --> main head
|
B
|
C --> user/ryang/user_branch
Thus, the state of our branch is actually the following diagram.
A --> main head --> user/ryang/user_branch
|
B
|
C
This leads to a couple of unexpected bugs found in code coverage status checks. I.e because we run all of our tests on the merged commit, there may be a decent amount of files changed between commits
C
andA
which we have inherited because we are running on the merged commit.Thus, project level coverage may differ drastically even though the files we have touched have 100% patch coverage.
I have tried a couple of ways of bypassing this by overriding the commit to use the
merged commit
however, that doesn't work. If you manually rebase your PR and resubmit CI, then the base commit for the codecov report is accurate again. However, this is not a great developer experience as we'd like to make our codecov status checks blocking, but currently this is a bugIt seems like https://community.codecov.com/t/selected-base-commit-when-pr-is-based-on-an-older-commit-of-the-target-branch/4101 is a similar issue
I tried setting
commit_parent
in codecov-action similar to codecov/codecov-action#597, but to no availand also setting
commit_parent
to the HEAD of main, but to no availeven though main has a more recent commits with coverage
Logs from attempt to use
parent_commit
The text was updated successfully, but these errors were encountered: