Story
When submitting packages to CRAN, it helps to let them know where you’ve tested R packages and on which platforms. The more platforms and R versions that you can test your package on, the better!
History
Before GitHub Actions, developers used Travis-CI (and some packages still do!). However, Travis was limited in that it could only test using a single type linux machine. You could test on multiple R versions.
Given authors develop on a mac, this required package authors to use r-hub
(lead by Gabor) to test on different flavors of windows machines. This service was MUCH better the praying and hoping your code worked, but was still not very robust.
R-hub may still be a good place to check if you have compiled ./src
code. However, this is a small number of R packages.
CI Need
As RStudio has become more popular and usage demands are becoming more spread out, packages like plumber
need to be sure they work on multiple operating systems and multiple versions of R.
To feel comfortable submitting a heavily used R package, I like to test on using:
- Operating Systems
- macOS,
- windows,
- ubuntu 16, and
- ubuntu 20
- R versions
- devel
- release
- oldrelease
- 3.4
- 3.3 (As there is no name called
reallyoldrelease
)
tidyverse
supports the latest 4 versions of R
These combinations create a large test matrix and is not fun to manually execute.
CI Solution
GitHub Actions (GHA) for R was initially explored by Max Held during his summer internship at RStudio. Since then, GHA created a complete different interface and Max’s work was repurposed in https://github.com/r-lib/actions by Jim Hester.
Using r-lib/actions
allows package developers to use consistent routines, yet customize the CI execution.
Two useful steps:
-
r-lib/actions/setup-r@v1
: Set up the R process. Example -
r-lib/actions/setup-pandoc@v1
: Set up pandoc. Example
This repo uses pak
to install system requirements and install all package dependencies. To me, any general usage of remotes
should be replaced with pak
. It is better for many reasons. Two being:
wholistic installation (consistency): It knows everything that is going to be installed before installing the first package.
parallel installation (speed): If two packages are not dependent on each other, they may be install in parallel.
-
pak
- A new version of
remotes
A fresh approach to package installation
- Website: https://pak.r-lib.org/
- GitHub: https://github.com/r-lib/pak
- A new version of