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

Coverage: Upload as separate step #199

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

pllim
Copy link
Contributor

@pllim pllim commented May 8, 2024

Upload to Codecov as separate step so it can be restarted without re-running the whole test suite because sometimes Codecov rate limits.

We need this to fix astropy/astropy#16379

This PR is tested downstream at astropy/astropy#16419

Also see spacetelescope/jdaviz#2865

You will see deprecation warning from actions/download-artifact#283 but it won't fail the upload.

cc @ConorMacBride @bsipocz

@pllim
Copy link
Contributor Author

pllim commented May 9, 2024

The test-conda OSX failure is unrelated (#197)

@pllim
Copy link
Contributor Author

pllim commented May 9, 2024

I guess it is quite impossible to test coverage here. I will undo the test changes and try to test this over at astropy instead (astropy/astropy#16419).

But with this patch, you will notice new jobs called Upload Coverage (pull_request) in the checks below. They attempt to download coverage files but skipped uploading because no coverage was done.

@pllim

This comment was marked as outdated.

@pllim
Copy link
Contributor Author

pllim commented May 9, 2024

Okay... autofix didn't do anything and I failed to see how my diff would trigger any such failures.

isort....................................................................Failed
- hook id: isort
- files were modified by this hook
encode scripts in workflows..............................................Failed
- hook id: encode-scripts
- files were modified by this hook

@pllim pllim marked this pull request as ready for review May 9, 2024 01:02
@Cadair Cadair requested a review from ConorMacBride May 16, 2024 08:31
@Cadair
Copy link
Member

Cadair commented May 16, 2024

I see the advantage of this, but it does cause you to loose some fidelity in the codecov reports, as you only get one CI job and you loose all the information about what OS / job it was (I think?).

Can you elaborate on the motivation for this a bit more, is it just codecov being flakey?

@pllim
Copy link
Contributor Author

pllim commented May 16, 2024

cause you to loose some fidelity in the codecov reports

Can you please elaborate on this? Each report would be uniquely named when uploaded as artifacts. They will all be downloaded by artifacts, and then re-uploaded to codecov all together. I don't see it being different from what workflow is already doing except the upload to codecov is a separate step.

motivation

@bsipocz asked for a solution to astropy/astropy#16379

@pllim
Copy link
Contributor Author

pllim commented May 16, 2024

Also it is painful to rerun test suite when only the upload fails.

@Cadair
Copy link
Member

Cadair commented May 17, 2024

I don't see it being different from what workflow is already doing except the upload to codecov is a separate step.

I think the difference (and it's not really a deal breaker) is that codecov looses the GHA metadata about which report was from which run?

Anyway, I am happy to merge it, but from the astropy test PR I am unconvinced it actually works?

@pllim
Copy link
Contributor Author

pllim commented May 17, 2024

Alternate solution is welcome. We have been using this over at

https://github.com/spacetelescope/jdaviz/blob/main/.github/workflows/ci_workflows.yml

and

https://github.com/astropy/specutils/blob/main/.github/workflows/ci_workflows.yml

but both workflows only have one coverage job each.

pllim added a commit to pllim/astropy that referenced this pull request May 17, 2024
@pllim
Copy link
Contributor Author

pllim commented May 17, 2024

@Cadair , what is this pre-commit silliness?

pllim added a commit to pllim/astropy that referenced this pull request May 17, 2024
so it can be restarted without re-running the whole test suite
because sometimes Codecov rate limits.
pllim added a commit to pllim/astropy that referenced this pull request May 17, 2024
@pllim
Copy link
Contributor Author

pllim commented May 17, 2024

I think it works as intended now. Please re-review, @Cadair . Thanks!

@Cadair
Copy link
Member

Cadair commented May 17, 2024

What was causing the trouble?

@pllim
Copy link
Contributor Author

pllim commented May 17, 2024

Initially, I didn't realize both artifact names actually contains the same coverage.yml filenames, and the artifact name does not really reflect the actual filenames at download time, so they were clobbering each other. But I fixed that.

@pllim
Copy link
Contributor Author

pllim commented May 22, 2024

@Cadair , are you convinced yet? Anything else I need to do here? Thanks!

@pllim
Copy link
Contributor Author

pllim commented May 29, 2024

@Cadair ? @astrofrog ? @ConorMacBride ? 🙏

@Cadair Cadair merged commit 95906bb into OpenAstronomy:main Jun 3, 2024
59 of 60 checks passed
@pllim pllim deleted the codecov-upload-new-job branch June 3, 2024 14:17
@pllim
Copy link
Contributor Author

pllim commented Jun 3, 2024

Thanks!

@pllim
Copy link
Contributor Author

pllim commented Jun 3, 2024

Hmm, astropy is picking this up but I don't understand why codecov complains about no token. We have one in repo secrets.

https://github.com/astropy/astropy/actions/runs/9355922312/job/25755726624

@Cadair
Copy link
Member

Cadair commented Jun 5, 2024

I think that's a bug with this. The sunpy builds in particular seem to be attempting to upload the same coverage artifacts more than once: https://github.com/sunpy/sunpy/actions/runs/9352703510/job/25742354670#step:3:6

As you can see in that log it's finding jobs from a different invocation of the workflow (the "test" one) and then downloading them in the "docs" workflow. Do you think you will have time to try and fix it @pllim ?

@Cadair
Copy link
Member

Cadair commented Jun 5, 2024

Ah maybe relatedly, that "docs" job on sunpy's CI has pytest: false set, which means it doesn't upload coverage, so if the artifact upload / download was working properly it should fail to download any artifacts at all and then skip the upload to codecov but that clearly isn't working.

@astrofrog
Copy link
Contributor

Yes this is breaking a lot of CI, a lot of my glue builds as well as reproject are failing. I think the artifact name needs to be more unique as the issue seems to happen for me if multiple OSes test e.g. py311-test

astrofrog added a commit to astrofrog/github-actions-workflows that referenced this pull request Jun 5, 2024
…d-new-job"

This reverts commit 95906bb, reversing
changes made to 2042027.
astrofrog added a commit to astrofrog/github-actions-workflows that referenced this pull request Jun 5, 2024
…d-new-job"

This reverts commit 95906bb, reversing
changes made to 2042027.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: failure of coverage upload doesn't change job status
3 participants