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

Add codecov report on Github Action #1108

Merged
merged 10 commits into from
Dec 2, 2023

Conversation

jiji14
Copy link
Contributor

@jiji14 jiji14 commented Nov 27, 2023

Add Codecov Report (code coverage) on Github Action

Related Issue

Estimate code coverage

How to work

When we submit Pull Request, Codecovreport will be automatically generated.

@jiji14 jiji14 changed the title add codecov report workflow Add codecov report on Github Action Nov 27, 2023
@jiji14
Copy link
Contributor Author

jiji14 commented Nov 27, 2023

@shankari
Can you please check the token? It says No token specified or token is empty
Screenshot 2023-11-27 at 11 11 16 AM


Here is log and GitHub setting page in my personal project.
Screenshot 2023-11-27 at 11 12 40 AM
Screenshot 2023-11-27 at 11 13 16 AM

@shankari
Copy link
Contributor

@jiji14 alas,

https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.

We ran into this recently with @nataliejschulz; she can confirm.

Does codecov have a suggested workaround for open source projects, which will, of course, mostly follow the fork and pull request model?

@shankari
Copy link
Contributor

Answering my own question, it looks like it does, in issue #29 of https://github.com/codecov/codecov-action

Copy link

codecov bot commented Nov 28, 2023

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@jiji14
Copy link
Contributor Author

jiji14 commented Nov 29, 2023

@shankari
We are almost there for code coverage, and I need you to do one more thing to add a coverage report in the comments.


Even though I connected the e-mission-phone project to Codecov, the reports didn't show up in the comments. I had a few guesses.

  1. It might be because it was the first PR for Codecov. I mocked the situation with the test repository, but the report didn't show up even on the second PR.
  2. It might be because I deleted the token in the workflow. I also added the token again and then checked, but it didn't work either.
  3. There might be a setting for the comments. Upon checking the issue page on Codecov, I found a similar issue: code cov comment is not added to the PR.

The problem was that I missed connecting with the GitHub Apps - Codecov. After completing this step, I could see the report in the comments on my test repository.

Can you please follow these steps?

  1. Go to the GitHub Apps - Codecov page.

  1. Click on Configure.
Screenshot 2023-11-29 at 11 56 18 AM
  1. Select repositories > e-mission-phone and click Save.
Screenshot 2023-11-29 at 11 57 35 AM

Thanks for being patient with me! 😃

@shankari
Copy link
Contributor

shankari commented Dec 2, 2023

@jiji14 I had already added it as a GitHub app
Screen Shot 2023-12-01 at 11 04 32 PM

and there was a message indicating that this will work once this PR is merged
#1108 (comment)

Is that not good enough? I didn't merge because you didn't indicate that the changes were done...

@jiji14
Copy link
Contributor Author

jiji14 commented Dec 2, 2023

@shankari
Screenshot 2023-12-01 at 8 09 10 PM

This is the codecov report I received from my personal project, so I expected to see the coverage result before merging it. Initially, I thought the app didn't connect with the e-mission-phone repository. As you commented, I now understand that we will receive the coverage report after merging it. Can you please merge this PR? Thank you :D

@shankari
Copy link
Contributor

shankari commented Dec 2, 2023

Fingers crossed!

@shankari shankari merged commit 54b73f6 into e-mission:service_rewrite_2023 Dec 2, 2023
4 checks passed
@shankari
Copy link
Contributor

shankari commented Dec 3, 2023

@jiji14 Looks like it works!
#1063 (comment)

@jiji14
Copy link
Contributor Author

jiji14 commented Dec 3, 2023

@shankari
Great news! Just checked it works well! 🎊🎊🎊

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.

2 participants