-
Notifications
You must be signed in to change notification settings - Fork 15
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
Integrate code coverage metric into CI #262
Conversation
Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
As the recent package version of Matrix is not compatible any more with R versions < 4.4.0, but the Matrix package version that is automatically shipped with R 3.6 is smaller than the minimum package version of Matrix that coronet requires. To circumvent this problem, specifically install Matrix version 1.3-4 from the package archives if the minimum version required by coronet is not met. This change should not affect recent R versions, which automatically ship a sufficient version of Matrix. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Currently, I had to comment out one broken test. You can review that one and we can discuss about possible solutions to it 😄. |
Does the error at the end of the coverage generation occur because of the missing token in our repo configuration, or because of any other error? |
Because of the missing token. At the end of the report we see a warning which we can disregard, then followed by 2 lines of trying to access codecov's API, which fails because a lack of token 🤓 |
Ok, thanks. Then I will enter the token (as you have described above in the Description of this PR) later and re-run the failing build thereafter. |
@MaLoefUDS Sorry for triggering a series of failing builds. I followed your description, but unfortunately I had added the token to the wrong repository. That's the reason why it did not work in my last two tries. Now I've added the token to the correct repository prior to the current run. So, I expect the current run to succeed. If it does not succeed, then there might be something else going wrong... Let's keep our fingers crossed! |
Hm, still not working. I don't know what to do now... Maybe we can have a closer look at your settings in your fork during our next meeting to find out what's going wrong here? |
Activating the repo on codecov was not enough 😞 |
Ohhh yes I remember that I did something like that as well 😅 Sorry that I forgot to list it |
Still failing... 😞 I have an idea why this might not work yet: The default branch is So, the next question is: Does this work when the PR is not merged yet? As far as I can see, the PR does not contain any file that needs to be accessed by codecov, so everything should be present in GitHub's and codecov's settings and nothing needs to be present in the repository, right? And the other question is: Does this only work after it has been merged to the default branch (i.e., |
It could also be that our problem is related to this issue: codecov/feedback#112 Independent of the issue linked above: May it be an idea to install xml2 inside the container, as suggested by the error message at the end of your pipeline? I am wondering why we don't get a proper error message, but maybe that's just because of R things... Any other ideas on what we can do? |
After reading the linked issue, I might understand why it fails for us. I also believe that fixing that might require some more work 🫠. Possible reason for the fail: Of course it is a privacy leak when GitHub would give the repo secrets out when a workflow is triggered from a forked repo. Everyone can create a fork and shadow a file that usually handles the secret to leak / steal it. Therefore what I think happens is that GitHub just Possible fixes: Codecov seem to have thought of this issue and implemented "tokenless" authentication for workflows triggerd from forks when using |
This should make the coverage-report uploading also possible inside of PRs that originate from forks of the main coronet repo (see, PR se-sic#262). Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
Easier done than said 💪! I oriented myself at the basic example file codecov provides! Now I think the only thing missing is the adjustment of the badge. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Great!
Here is the code for the current badge:
However, I am not sure which branch we should choose for the badge. Default refers to Anyway, independent of which branch we will choose for the badge, we should add the branch name after
And also the tests that you disabled due to mismatches in path names should be fixed, I guess... |
About the batches: We can trivially obtain badges for both branches, once there has been at least one run of the new CI on both branches. The branch is encoded in the link (once you have uploaded runs from multiple branches), so we could even install the badge for master before even running the CI once then just leading to a broken link: https://codecov.io/gh/MaLoefUDS/coronet/branch/test/graph/badge.svg?token=OU3SR362X9 So I would just add both badges after the respective build status badges. About the missing test: Yes, you're right, I forgor 💀 |
Signed-off-by: Maximilian Löffler <s8maleof@stud.uni-saarland.de>
Introduce a new constant in 'testing-utils.R' that describes a prefix of the path leading to the testing data files. This constant is necessary since the 'coverage.R' run of all tests demands a different path prefix than the 'tests.R' run of all tests. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
(The failure right now is not a failure in the classical sense. It is a known issue described in the link on the tokenless authentication of codecov I sent above. I don‘t know to which extend we can try to fix that issue, but we can atleast make the CI not fail if the uploading fails if you’re fine with that) |
Hm, that sounds like that this would appear comparably often. If we always push in the "wrong moments", we'd never receive a coverage report. And failing checks are also bad if everything is ok except for that rate limit stuff of codecov. |
Hmm, maybe we can have a while loop in the Github action that sends the request until it went through for the time where they did not implement a fix? 🤔 Appart from that I'm not sure what else we can even do |
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.
This PR looks good to me. 👍
@MaLoefUDS Should we already merge this PR or did you find an easy possibility to separate uploading the coverage report?
I have made some research. GitHub provides some form a persistence called Artifacts. I was not able to fully explore that, but I actually believe that it could work for us |
This allows us to rerun only the upload if it fails because of rate limiting. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
8c69394
to
1e8c23b
Compare
This should make the coverage-report uploading also possible inside of PRs that originate from forks of the main coronet repo (see, PR se-sic#262). Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
Prerequisites
showcase.R
with respect to my changes.dev
.Description
Add codecov coverage to CI. Steps to make it run for the main repo:
Security -> Secrets and variables -> Actions -> Repository secrets
and add token there with keyCODECOV_TOKEN
. GitHub will then automatically and secretly supply token tocoverage.R
when executing the CI.Changelog
coverage.R
that generates coverage reports