A few days ago I wrote about Travis CI, and was wondering if we could integrate the testing of R packages into this wonderful platform. A reader (Vincent Arel-Bundock) pointed out in the comments that Travis was running Ubuntu that allows you to install software packages at your will.
I took a look at the documentation, and realized they were building and testing packages in virtual machines. No wonder
sudo apt-get works. Remember
apt-get -h | tail -n1:
This APT has Super Cow Powers. (APT有超级牛力)
R on Travis CI
Now we are essentially system admins, and we can install anything from Ubuntu repositories, so it does not really matter that Travis CI does not support R yet. Below are a few steps to integrate your R package (on Github) into this system:
- follow the official guide util you see
- copy my
.travis.ymlfor the knitr package if you want, or write your own;
- I use a custom library path
~/Rto install add-on R packages so that I do not have to type
- at the moment I use the RDev PPA by Michael Rutter to install R 3.0.0 since his plan for R 3.0 on CRAN is in May; at that time I’ll change this PPA to a CRAN repository
R CMD checkrequires all packages in
Suggestsas well, I install knitr using
install.packages(dep = TRUE)to make sure all relevant packages are installed
make checkare wrappers of
R CMD buildand
R CMD checkrespectively, defined in the
- I use a custom library path
- push this
.travis.ymlto Github, and Travis CI will start building your package when a worker is available (normally within a few seconds);
What I described here actually applies to any software packages (not only R), as long as the dependencies are available under Ubuntu, or you know how to build them.
But it is still far from CRAN
OK, it works, but we are still a little bit far from what CRAN does, because Travis CI does not have official support for R. Each time we have to install one Gigabyte of additional software to create the R testing environment (sigh, if only R did not have to tie itself to LaTeX). If these packages are pre-built in the virtual machines, it will save us a lot of time.
The second problem is, there is no Windows support on Travis CI (one developer told us on Twitter that it was coming). There is a page for OS X, but I did not really figure out how to build software under OS X there.
The third problem is Travis CI only builds and tests packages; it does not provide downloads like CRAN. Perhaps we can upload the packages using encryption keys to our own servers.
R-Forge, where are you going?
I will shut up here since I realized I was not being constructive. Let me spend more time thinking about this, and I love to hear suggestions from readers as well.
So, two potential Google Summer of Code projects:
- make R an officially supported language on Travis CI (this really depends on if the Travis team want it or not)
- improve R-Forge (of course this depends on if the R-Forge team think they need help or not)