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

CI: Add code coverage #140

Merged
merged 3 commits into from
Jan 20, 2025
Merged

CI: Add code coverage #140

merged 3 commits into from
Jan 20, 2025

Conversation

namannimmo10
Copy link
Member

No description provided.

@namannimmo10 namannimmo10 force-pushed the codecov branch 2 times, most recently from 12c4853 to 0c27ac0 Compare July 18, 2024 14:36
@namannimmo10
Copy link
Member Author

Unable to push coverage to Codecov as git is not available with this container image.

@yousefmoazzam
Copy link
Contributor

Unable to push coverage to Codecov as git is not available with this container image.

Ah I see, that's a pain... Might be a dumb question, but is it possible to do an apt install -y git step (or something similar depending on what package manager is available in the container image) in the workflow to make git available? Not ideal, but if it works, that could be a workaround for now.

@namannimmo10
Copy link
Member Author

namannimmo10 commented Jul 18, 2024

No, cannot have sudo permissions easily. Trying to find a workaround!

@namannimmo10
Copy link
Member Author

One option is to add a Dockerfile.

@yousefmoazzam
Copy link
Contributor

Eh, that's kinda annoying, not allowing use of sudo within a container - what harm can it do, it's a container...

But fair enough, good luck trying to find a workaround, feels like it might be a pain 😅

@namannimmo10 namannimmo10 force-pushed the codecov branch 5 times, most recently from c6acbb4 to 51d2652 Compare July 19, 2024 11:51
@yousefmoazzam
Copy link
Contributor

yousefmoazzam commented Jul 19, 2024

FYI, there's a github action for uploading coverage to codecov, could be useful instead of trying to manually do it in a shell in a step in the workflow https://github.com/codecov/codecov-action (apologies if this has already been looked at and was found to be incompatible with the IRIS runner or something!)

@namannimmo10
Copy link
Member Author

Yeah - I tried a7abd29 before, but it's unable to find git. Think we are nearly there.

@namannimmo10 namannimmo10 force-pushed the codecov branch 13 times, most recently from a940bbf to 3f7fe8b Compare July 22, 2024 14:20
@namannimmo10 namannimmo10 force-pushed the codecov branch 2 times, most recently from fcf0ca3 to 98bbdbd Compare August 15, 2024 13:34
@namannimmo10
Copy link
Member Author

So peculiar. Same error again. Raised codecov/codecov-action#1546.

@yousefmoazzam
Copy link
Contributor

I was just perusing the issues and PRs, looked at the issue raised with the codecov action, and this error repeated twice at the end got me thinking a bit:

POST: 404 - {'detail': ErrorDetail(string='Could not find a repository associated with upload token ***', code='not_found')}

Does the repo in the relevant github organisation (DiamondLightSource) for which we want to get code coverage need to be setup on https://app.codecov.io/github/DiamondLightSource?

If I search for "httomo", I can see that httomolibgpu has the "Configure" button on the right, which suggests that it hasn't been "configured" to have code coverage uploaded to it?
codecov-io-httomo

If that was the issue, I could maybe understand the error being returned; it's essentially saying that coverage is trying to be uploaded for a github repo that isn't configured for that in codecov's website.

The docs for codecov suggest that this needs to be done https://docs.codecov.com/docs/quick-start#step-1-sign-up-for-codecov

@namannimmo10
Copy link
Member Author

Hi, thanks for pointing this out, see this discussion: https://diamondlightsource.slack.com/archives/CKW8E0V4H/p1721394261955809.

@yousefmoazzam
Copy link
Contributor

Fair enough. Though in my opinion, because the responder said that they're "not sure", I would not consider this a proof that stuff on codecov doesn't need to be done. Especially as there's no explanation for how it automatically gets done from simply being a repo in the DiamondLightSource organisation, and the fact that the codecov docs indicate that something does need to be done.

If I choose random repos from the DiamondLightSource organisation which are marked as "Configured" in codecov, they all are using the codecov github action, and if I choose random repos which are marked as "Not configured" in codecov, they do not use the codecov github action.

@thomasrockhu-codecov
Copy link

Tom from Codecov here. I apologize it's taken so long to get a response from us, but I'd like to help get this working for you. Would you be able to try again using the v5 action?

@namannimmo10
Copy link
Member Author

Hi Tom 👋 Many thanks for releasing v5. I just gave it a try and am still getting an upload error,

==> Running upload-coverage
      ./codecov --verbose upload-coverage -t <redacted> --fail-on-error --git-service github --sha eea3f1d1cf4ff501da1fc8934212e2363d80100e --file /home/runner/coverage.xml --gcov-executable gcov --name httomolibgpu-codecov
[PYI-970:ERROR] Failed to load Python shared library '/tmp/_MEIUJQIIM/libpython3.11.so.1.0': dlopen: /usr/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/_MEIUJQIIM/libpython3.11.so.1.0)
==> Failed to upload coverage
    Exiting...

Perhaps the custom container we are using here (ghcr.io/diamondlightsource/httomolibgpu:dockerfile) needs to have GLIBC_2.29, but again, I find it peculiar.

@thomasrockhu-codecov
Copy link

@namannimmo10, yeah, I believe that is an unknown requirement.

Sorry for the loop-around, but would you be able to run it with the pypi version?

- name: Upload coverage to Codecov
  run: |
    pip install codecov-cli
    codecovcli -v upload-coverage --fail-on-error --file /home/runner/coverage.xml --name httomolibgpu-codecov
  env:
    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

I wrote that freehand so I might have gotten something wrong. If so, I'll re-work the Action to allow for using the pypi version which SHOULD fix the problem.

@namannimmo10
Copy link
Member Author

OK, I don't see an error with that now. The branch is set to null. From Code tree at https://app.codecov.io/github/DiamondLightSource/httomolibgpu:

Once merged to your default branch, Codecov will show your report results on this dashboard

@namannimmo10 namannimmo10 merged commit 52f3c23 into main Jan 20, 2025
3 checks passed
@namannimmo10 namannimmo10 deleted the codecov branch January 20, 2025 14:40
@namannimmo10 namannimmo10 restored the codecov branch January 20, 2025 14:40
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.

3 participants