-
Notifications
You must be signed in to change notification settings - Fork 89
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
Codecov isn't finding the correct base
with "squash and merge"
#1745
Comments
base
with "squash and merge"
To be honest, I couldn't figure out what Codecov was doing, though I figured we'd only pay a lot of attention to it when we're working on maximizing coverage. I didn't think we needed it to run in every PR, I would have been happy to run it on demand. Even without changing anything, Codecov is correctly describing the current absolute level of coverage, right? It's true deltas that are wrong, I expect. That's what we'd be most interested in when working on maximizing it. We'd have to really know what we're doing if we get into a mode where we want every PR to have a non-negative coverage change. That's what this system seems to be designed for, and I can see that being a good idea in a very stable codebase—you don't want contributors adding features without testing them. For us, now, it can go up and down, as long as it is generally increasing. If making the tests run against a putative merge to |
I've seen that option. It would be super-safe to require branches to be up-to-date before merging, but it would mean a concurrency traffic jam for small-fix PRs, and we tend to have a lot of those. If we have two PRs with auto-merge turned on, when one of them gets merged, the other will now need to update to satisfy the rule. If it doesn't auto-update (which I expect to be the case), then it needs to wait for a human to notice it and press the update button. If there's no notification for that, it might be waiting for a long time. Regardless, it might have been 90% done with its tests and now has to start over from scratch. I expect that a lot of the testing time would be wasted that way.1 What I was saying above is that the tests would run on a putative merge-commit, rather than the actual last commit of the branch. (Azure had an option for that, and we used it.) If So I was willing to accept that a CI test is testing something different from what will happen when the PR gets merged (as we have now); I was just saying that it's a little better to test out-of-date merge-commits than non-merge-commits. And if that allows Codecov to be correct, then even better; we can adopt that model. Footnotes
|
Version of Awkward Array
main
Description and code to reproduce
I've been noticing recently that Codecov estimates in changed coverage do not correspond to what's actually happening in the PR; namely, PRs that add no tests (e.g. those which add documentation or rename variables) still increase test coverage.
It turns out, Codecov uses the commit history to find the base with uploaded coverage metadata. Because we use "squash and merge", and don't run any Codecov jobs in
main
, Codecov always finds an old commit (e.g. e692946) to use as the base. Ourbuild-test
workflow has a schedule, so Codecov is only ever at-most 1 month out of date. In the below figure, you can see that each new branch never finds a codecov commit until the first commit which has thecodecov
tagThe simplest solution here is to run a special CI job upon the closure of a PR that uploads the codecov metadata: https://community.codecov.com/t/unable-to-determine-a-parent-commit-to-compare-against-in-base-branch-after-squash-and-merge/2480/20
However, my initial concern is that unless we also require PRs to be up-to-date before merging, the merge would happen after the CI had run Codecov, which could lead to out-of-sync coverage estimates.
A better solution might just be to run the build-test workflow for commits to main.
The text was updated successfully, but these errors were encountered: