Travis CI is a really nice tool to provide automated builds of projects. It supports different languages (e.g., C++, python, Ruby) and allows user configuration of the build environments before testing the build. Effectively, you give Travis CI a set of instructions on how to set up a virtual machine. The VM then follows these instructions and attempts to build your project. This is all done in nearly real time. What I like the most about this setup is that it’s simultaneously testing the build and your explicated assumptions about dependencies. Officially, R isn’t “supported”. But, the platform can and has been used for R package development.
Yihui Xie wrote a post about this last year, but I did not really appreciate the potential of the system then.
I had noticed the Travis CI status badge (e.g. “”) on a few of Hadley Wickham’s github repos, but did not really dive into it.
So, I did.
In particular, I wanted to start testing builds of RcppTN beyond my local machine in the lead up to an initial CRAN release.
Simple Tweak for Subdirectory Builds
Installing an R package that is published in a github repo is made insanely simple with Hadley Wickham’s devtools package. And, it even handles R packages deeper than the root level. The instructions here show use of that feature.
However, even though Travis CI has tight github integration (e.g. testing the
build on every commit), all of the examples I had seen used a Travis CI
.travis.yml) for an R package whose contents were at the
root of the github repo. Not so for RcppTN!
I have not taken the time to think about the cleanest way to generalize the “fix”, but instead of the default
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
I needed the following:
1 2 3 4 5 6 7
From this, it’s clear to see that the Travis CI build system is less like
and more what you’d do if you were typing the commands manually at a
make, any changes to the working directory path are reset after
each command in a recipe. So, with
is different from
1 2 3
But, with Travis CI, it’s just like typing things in a shell. Once you’ve
cd-ed into a directory, you stay there until you explicitly say to navigate
If you need information on getting started with Travis CI and R, see here.