-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Make codecov pull requests informational only #269
Make codecov pull requests informational only #269
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #269 +/- ##
=======================================
Coverage 96.46% 96.46%
=======================================
Files 16 16
Lines 1898 1898
=======================================
Hits 1831 1831
Misses 67 67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…report to codecov.io
This PR is going very badly. I've discovered
I think the issue is related to this being a PR from a forked branch. I'm not sure what needs to be done about it though. |
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.
Although all the checks are green, it seems like something is still wrong with Codecov. When I look at the Upload coverage step of 3.8 ubuntu-latest, I see:
error - 2024-11-14 13:33:38,751 -- Upload failed: [{"input":{"branch":"jagerber48:feature/code_cov_informational","commit_id":"4026faaab4ee6d4c6163e872defee173ec28988d","repo_id":18933979,"repo_name":"uncertainties"},"loc":["id"],"msg":"Field required","type":"missing","url":"https://errors.pydantic.dev/2.4/v/missing"}]
Looking at the Codecov page, it seems to have only one report instead of one per job in the matrix. I am not sure what report that is. It seems like all uploads failed on the latest run.
.github/workflows/python-package.yml
Outdated
@@ -53,14 +53,15 @@ jobs: | |||
python -m pip install .[test] | |||
- name: Test source code and docs | |||
run: | |||
cd tests; |
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.
Do you have to delete cd tests;
? With the default configuration, running pytest
puts the working directory on the Python import path and so import uncertainties
uses the files in the repo instead of the ones installed in site-packages. If there is an error in the packaging configuration such that a necessary file is not included in the package, the tests will still pass if they test with the files in the repo instead of the with the installed package. There are other ways to change pytest's behavior but just doing cd tests
is a simple way to make sure the package is tested.
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 need to understand this more. I think I would prefer to configure the pytest
runs more explicitly rather than relying on monkeying around with cd
and the implicit "path".
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.
That is fine but we can do that in a separate PR? For a long time, the standard way to do this was to use a src/
directory at the top level of the repo with the package inside of it. More recently pytest added some alternative ways of importing test modules instead of putting the working directory on the Python path. They come with some caveats though that we would have to assess. They are documented here:
https://docs.pytest.org/en/stable/explanation/pythonpath.html
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.
Yes, happy to discuss/do this in a separate PR. I'll pull that change out of this PR when I get a chance.
.github/workflows/python-package.yml
Outdated
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: lmfit/uncertainties | ||
file: ./coverage.xml |
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.
Could we add a name
entry here as well? If we set the name based on the Python version and OS, would that let us tell which report was from which run? Right now all the reports for PR have the same name on the Codecov page so it is hard to tell which is which. This mainly matters for distinguishing the no-numpy run from everything else.
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 think tag
s are what we're looking for here. Yes, we can do that. It's been my plan to add tags, but I wanted to get the more basic configuration working. I doubt adding tags will fix the issues we're seeing, but maybe I'm wrong. Maybe the tags will help.
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 we can do names also though.
Yes, see the issue I linked to in codecov feedback. I'm not sure what's going on here. As I said in my other comment, this error goes away if I include the token explicitly, but even though the github action job succeeds, the coverage reports don't appear on codecov.io. |
It looks like many of the current issues are stemming from the codecov.io server side as per the linked issue. Once those are resolved I think the main push of this PR --- improving and cleaning up codecov config --- can be resolved. |
Ok, seems like codecov/feedback#577 is resolved and our codecov reports are getting uploaded. Will tie up loose ends on this then it will be ready for review. However, it is troubling the codecov can have strange issues on their end that bothers our CI. In any case, making the code coverage informational only means that these issues don't need slow down our progress if we're happy to move forward even if there are minor coverage issues. |
I've expanded the scope of this PR to include codecov tags. @wshanks any objections? I can move that change into a new PR if we prefer. |
Some more changes:
On a previous commit I would put two flags on each with numpy codecov upload. e.g. |
This PR is ready for review. After this I'll transition back to working on source code instead of CI. However, it is on my radar, with low priority, to make some minor improvements to the CI configuration. Mostly just to make the github actions yaml file even simpler and easier to follow. This would include the |
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.
Great! Thanks for working this out. I think this is the right approach.
+1 on merging.
pre-commit run --all-files
with no errorsThis PR hopes to resolve a few issues with
uncertainty
package interaction withcodecov.io
..codecov.yaml
. Unfortunately, I think this was an invalid configuration. Specifically because thecomment
section is supposed to be a top-level section, not nested under thecodecov
section. This means that since that PR the yaml configuration has NOT been used for our codecov updates. I think this explains why we're seeing codecov failures despite best attempts to suppress them.numpy
behaves as an optional import #268 where a codecov failure is creating an X when we really just want the PR to go through. This PR will (attempt to) make it so that codecov coverage is reported, but will never result in a failed coverage run. This way reviewers can see if patch coverage is < 100% or if overall coverage drops due to a PR. If reviewers deem a lack or drop of coverage to be significant they can block PR approval. Otherwise, for minor coverage drops, the coverage can be easily ignored. It does so using theinformational
flag in the.codecov.yaml
file..codecov.yaml
file.