Welcome to post 52 in the R4 series.
Following up on the post #51 yesterday and its stated intent of posting some more here… The r-ci setup (which was introduced in post #32 and updated in post #45) offers portable continuous integration which can take advantage of different backends: Github Actions, Azure Pipelines, GitLab, BitBuckets, … and possibly as it only requires a basic Ubuntu shell after which it customizes itself and runs via shell script. Portably. Now, most of us, I suspect still use it with GitHub Actions but it is reassuring to know that one can take it elsewhere should the need or desire arise.
One thing many repos did, and which stopped working reliably is coverage analysis. This is made easy by the covr package, and made ‘fast, easy, reliable’ (as we quip) thanks to r2u. But transmission to codecov stopped working a while back so I had mostly commented it out in my repos, rendering the reports more and more stale. Which is not ideal.
A few weeks ago I gave this another look, and it turns that that codecov now requires an API token
to upload. Which one can generate in the user -> settings menu on
their website under the ‘access’ tab. Which in turn then needs to be
stored in each repo wanting to upload. For Github, this is
under settings -> secrets and variables -> actions as a
‘repository secret’. I suggest using CODECOV_TOKEN
for its
name.
After that the three-line block in the yaml file can reference it as
a secret as in the following snippet, now five lines, taken from one of
my ci.yaml
files:
- name: Coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./run.sh coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
It assigns the secret we stored on the website, references it by
prefix secrets.
and assigns it to the environment variable
CODECOV_TOKEN
. After this reports flow as one can see on
repositories where I re-enabled this as for example here for
RcppArmadillo.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. If you like this or other open-source work I do, you can now sponsor me at GitHub.