5

Can someone point me towards a working example where packrat is used with AppVeyor to build an R package? Searching through Google and GitHub, I can't find any packrat-enable package that uses AppVeyor.

Does the appveyor.yml file need to change? Are there some settings I need to add through the AppVeyor website?

I have a very minimal package (testthat is the only dependency) that broke AppVeyor builds. Here is the code frozen for that commit. Here is the AppVeyor log.

(If this SO question sounds familiar, I'm about to ask a similar question for Travis-CI.)

Community
  • 1
  • 1
wibeasley
  • 5,000
  • 3
  • 34
  • 62
  • are you building with windows? it says your rtools is not compatible (or the rtools on the server) – rawr May 01 '15 at 23:37
  • yes, AppVeyor is Windows only, although @krlmlr's approach (which I'm using; https://github.com/krlmlr/r-appveyor/blob/master/scripts/appveyor-tool.ps1) calls MinGW and MSYS. Despite the compatibility message, I don't think the rtools version is a problem. I receive the same warning message on my desktop, and it's not been a problem. – wibeasley May 02 '15 at 00:15
  • I looked into this a little more. The RTools compatibility message appeared before introducing Packrat, and the builds completed successfully. (eg, https://ci.appveyor.com/project/wibeasley/premiss/build/1.0.9#L134). Also, Hadley added version information for RTools 3.3 ten days ago (https://github.com/hadley/devtools/commit/6fe9509c80cd7a51f5c1275e3ee4aa80b7659f28). It looks like the scripts install the stable devtools from the Ubuntu repository (not CRAN or GitHub), so these messages might be showing for a while (https://github.com/krlmlr/r-travis/blob/master/scripts/travis-tool.sh#L117). – wibeasley May 02 '15 at 00:37

1 Answers1

6

Yes, the solution here is similar to the same question for Travis-CI.

Here's an example of an appveyor.yml file that will enable you to use packrat packages in your package:

# DO NOT CHANGE the "init" and "install" sections below

# Download script file from GitHub
init:
  ps: |
        $ErrorActionPreference = "Stop"
        Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
        Import-Module '..\appveyor-tool.ps1'
install:
  ps: Bootstrap

# Adapt as necessary starting from here

environment:
  global:
   WARNINGS_ARE_ERRORS: 0
   USE_RTOOLS: true

build_script:
  - R -e  "0" --args --bootstrap-packrat

test_script:
  - travis-tool.sh run_tests

on_failure:
  - 7z a failure.zip *.Rcheck\*
  - appveyor PushArtifact failure.zip

artifacts:
  - path: '*.Rcheck\**\*.log'
    name: Logs

  - path: '*.Rcheck\**\*.out'
    name: Logs

  - path: '*.Rcheck\**\*.fail'
    name: Logs

  - path: '*.Rcheck\**\*.Rout'
    name: Logs

  - path: '\*_*.tar.gz'
    name: Bits

  - path: '\*_*.zip'
    name: Bits

The important parts that differ from the template are:

 environment:
      global:
       WARNINGS_ARE_ERRORS: 0
       USE_RTOOLS: true

    build_script:
      - R -e  "0" --args --bootstrap-packrat

This enables Rtools for the build, and loads the packrat packages.

It's also important to note that we are excluding - travis-tool.sh install_deps because that would cause the packages you depend on to be downloaded from CRAN, rather than built from your packrat directory.

Here's an example of an appveyor build for a simple R package where this is working: https://ci.appveyor.com/project/benmarwick/javaonappveyortest/build/1.0.21

Community
  • 1
  • 1
Ben
  • 41,615
  • 18
  • 132
  • 227