Using the container-based infrastructure with package caching is now recommended for nearly all projects. There are more compute and network resources available for container based builds, which means they start processing in less time and run faster. The package caching makes package installation comparable or faster than using binary packages.

A minimal .travis.yml file that is suitable for most cases is

language: r
sudo: false
cache: packages

New packages can omit sudo: false, as it is the default for new repositories. However older repositories will have to explicitly set sudo: false to use the container based infrastructure.

If your package depends on development packages that are not on CRAN (such as GitHub) we recommend you use the Remotes: annotation in your package DESCRPITION file. This will allow your package and dependencies to be easily installed by devtools::install_github() as well as on Travis (Examples). It is generally no longer necessary to use r_github_packages, r_packages, r_binary_packages, etc. as this can be handled with Remotes.

If you need system dependencies, first check to see if they’re available with the apt-addon and include them in your .travis.yml. This will allow you to install them without sudo and still use the container based infrastructure.