Creating R Packages with Packrat and AppVeyor

Can someone point me to a working example where packrat is used with AppVeyor to create an R package? Searching through Google and GitHub, I cannot find the packrat-enable package that uses AppVeyor.

Is it necessary to modify the appveyor.yml file? Are there any settings I need to add through the AppVeyor website?

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

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

+4
source share
1 answer

Yes, the solution here seems to be the same question for Travis-CI .

Here is an example file appveyor.ymlthat will allow 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 allows Rtools to build and download packrat packages.

It is also important to note that we exclude - travis-tool.sh install_depsit because it will result in packages depending on the download from the CRAN, and not from the packrat directory.

Here is an example application build for a simple R package where it works: https://ci.appveyor.com/project/benmarwick/javaonappveyortest/build/1.0.21

+5

All Articles