Search code examples
rtravis-cicran

Use checkpoint and a MRAN snapshot as CRAN mirror with travis-ci?


I'd like to use the checkpoint package or the MRAN snapshot repo to set the versions of packages that get used when my package is built on Travis-CI.

I'm looking for advice on getting either of these working:

  1. Travis using the local files (i.e. stored in the github repo of my pkg) of the packages that my package depends on. For example, if I use checkpoint to download the sources of the packages and store them in a directory with my package, how can I get Travis to install the packages from that local location, rather than from CRAN? or,

  2. Travis use the MRAN snapshot URL to download the packages archived on a specific date, as set in the URL.

I've been experimenting with various options in the .travis.yml file in this test package: https://github.com/benmarwick/checkpointtest

For example, here are .travis.yml files that I've tried:

# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages
warnings_are_errors: false

cran: https://mran.revolutionanalytics.com/

and

# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages
warnings_are_errors: false

repos:
  CRAN: https://mran.revolutionanalytics.com/snapshot/2016-09-02

and

# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages
cran: https://mran.revolutionanalytics.com/snapshot/2016-09-02
env:
  global:
  - R_LIBS_USER=~/vignettes/packages/.checkpoint/2016-09-02/lib/x86_64-w64-mingw32/3.3.1
  - R_LIBS_SITE=~/vignettes/packages/.checkpoint/2016-09-02/lib/x86_64-w64-mingw32/3.3.1

And several other combinations.

So far everything has resulted in an error (https://travis-ci.org/benmarwick/checkpointtest), often this is the error message:

W: Failed to fetch https://mran.revolutionanalytics.com//bin/linux/ubuntu/precise/Packages server certificate verification failed.
 CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

How can I get Travis-CI to be aware of the checkpoint package, and not contact CRAN to download dependencies?

This question is related to my packrat question about getting Travis to use non-CRAN package sources.


Solution

  • This appears to work:

    # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
    
    language: R
    sudo: false
    
    cache:
      packages: true
    
    repos:
      MRAN: "https://mran.microsoft.com/snapshot/2016-11-08"
    
    warnings_are_errors: false