Continuous Integration for R packages

What is git?

Git is a version control system, and the best I have worked with for that matter. 15 years ago, I was happy when my company decided to migrate from RCS to SVN. Branching became simple, and many daily problems just disappeared. So I shuned other source control versioning systems for a long time. Until I came across git, that is. git introduces the concept of de-central repositories, and branching is a very light-weight operation. This is not only attractive for open-source projects, but that’s where git shines the most. For example, it is very easy and natural to fork projects.

As a result of the success of git, there has been an ecosystem of servies, products and projects that grew around it in the past few years. One of the most prominent examples is github. github is a social network of git-hosted open-source projects. It also includes project management, bug tracking, and other features. And all for free.

For example, you can find our data.tree package on github: data.tree.


Using git with RStudio is easy, as it’s basically built in and comes for free out of the box.

What is CI?

github in turn has been so successful that soon enough an entire ecosystem of services built around github has started to bloom. One of these services is travis-ci. This is a Berlin, Germany based company that focused 100% on github.

CI – Continuous Integration, is basically a build server that triggers a build whenever you push changes to a source code repository.

There is many different build servers like Jenkins, TeamCity, Continuum, and many others. Some of them are easier to configure than others, of course.

What is Travis?

Travis is a service that offers CI on top of github.

As travis-ci is completely integrated with github, setting up continuous integration with travis is extremely simple, as long as your source code is hosted with github. For most platforms, CI can be turned on literally with two clicks. Unfortunately, R is not (yet) a first class citizen on travis-ci, so we need to tell travis-ci what it actually needs to do. Until recently, this was a bit cumbersome, as you can read in Yihui’s blog.

But luckily, the R package devtools and r-travis (which btw are both also hosted on github) are working hard on making this configuration as simple as possible. At the time of this writing, all you need to do to turn on ci for your R package is:

  1. host your R package on github
  2. create a .travis.yml file by installing devtools  library(devtools) devtools::use_travis()
  3. go to, accept to link you github account with travis
  4. turn on ci for your project by switching the button shown in travis-ci

And if you want to customize your build, then you need to configure the .travis.yml file. It contains the entire travis configuration in YAML format. You can find some details in this blog entry.



As of this writing, it is not yet straight forward to include vignette building into the travis build process. As a result, you get a warning like this:

Package vignette without corresponding PDF/HTML

To resolve this, you can set the option –no-manual in .travis.yaml like this:


Leave a Reply