covr
covr copied to clipboard
Automatic support for Coveralls on GItHub Actions
This is a continuation of https://github.com/r-lib/covr/issues/457 with more clear objectives, now that we're debugged and understood exactly where the issues lie.
There is currently code (https://github.com/r-lib/covr/blob/caed186fc47884d1e848c09ddb9433716bd671c6/R/coveralls.R#L65-L70) that only adds git info to the coverage report if the CI is one of: [jenkins, drone, travis-pro]. This list needs to be also include "github-actions" (and the documentation should explicitly say that this string is supported).
This will get {covr} to attempt to attach git info, but it will not fully work yet. Specifically, the badge will not get updated because the branch will not be set correctly. This is because in https://github.com/r-lib/covr/blob/caed186fc47884d1e848c09ddb9433716bd671c6/R/coveralls.R#LL117C35-L117C58 it's looking for the envvar CI_BRANCH which does not exist in GitHub Actions. Perhaps using the GITHUB_REF_NAME envvar will work (I haven't tested it, but based on github actions' documentation it seems like it should).
Other than the branch not getting set correctly, the remote URL is also not set because it looks for a CI_REMOTE envvar, which again doesn't exist for github actions. Perhaps system_output("git", c("config", "--get", "remote.origin.url")) can be used for that.
And lastly, for code cleanliness purposes, it might be a good idea to rename the function jenkins_git_info() to just get_it_info().
For at least the last 8 years codecov has been the recommended provider to use with covr rather than coveralls, and today very few people still use coveralls.
Because of this is unlikely any time will be spent on this issue. If you want this automatic support for coveralls you are going to need to send a PR with the suggested changes in this issue. As they seem minor it will likely be merged after a review round.
Unfortunately I'm using it within an organization that has approved coveralls but has not approved codecov (🤷♂️ ). I may open a PR in the future for this.