README.md

R + AppVeyor AppVeyor build status Travis-CI Build Status

This is a solution for continuous integration for R projects on Windows, using AppVeyor -- a CI testing service similar to Travis-CI. Under the hood, r-travis is used to perform the testing; this works even on Windows thanks to MinGW and MSYS.

Usage

  1. Sign up to AppVeyor.
  2. Enable testing for your project.
  3. Run usethis::use_appveyor() in your project.
  4. (Optional) Adapt appveyor.yml to your needs according to the documentation.
  5. (Optional) Add a badge as described by the output of usethis::use_appveyor().
  6. Be sure to supply a .gitattributes file that takes care of fixing CRLF conversion settings that are relevant on Windows. The one in this repo can be used for starters.
  7. Push to your repo to start building.
  8. Enjoy!

Build and test commands

The travis-tool used in appveyor.yml is a modified copy of the r-travis project, documentation is available on its wiki.

Environment variables

These can be set in the appveyor.yml, overriding the defaults. This repo tests several configurations at once in a build matrix, see also the build status.

Example:

environment:
  VARIABLE: value

Artifacts

In contrast to Travis-CI, AppVeyor offers facilities for hosting artifacts. This can be configured by adding a section to the appveyor.yml. The sample file is configured to deploy logs, and source and binary versions of the built package. Check the "ARTIFACTS" section for your project at AppVeyor.

LaTeX

See the example contributed by @pat-s for a way to install LaTeX. The tinytex package is another option.

Pandoc and other software

The Chocolatey installer is a convenient way to install other software. See below for a Pandoc example from the reprex repository:

before_test:
  - cinst pandoc
  - ps: $env:Path += ";C:\Program Files (x86)\Pandoc\"
  - pandoc -v

Troubleshooting

Using a 64-bit R installation

Some R packages, notably rJava, require a 64-bit installation of Windows and R. If you try to install these packages on a 32-bit system you'll see a message similar to:

  Error: .onLoad failed in loadNamespace() for 'rJava', details:
    call: inDL(x, as.logical(local), as.logical(now), ...)
    error: unable to load shared object 'C:/Users/appveyor/AppData/Local/Temp/1/RtmpWa3KNC/RLIBS_bdc2913935/rJava/libs/i386/rJava.dll':
    LoadLibrary failure:  %1 is not a valid Win32 application.

To solve this problem, add to your appveyor.yml:

platform: x64

environment:
  R_ARCH: x64

This will cause Appveyor to run your build on a 64-bit version of Windows Server, using the 64-bit R binary.

Acknowledgements

This wouldn't have been as easy without r-travis and the experience gained there. Thanks!

See also

The win-builder project has been around much longer and provides more comprehensive testing; you still might want to use this service before submitting to CRAN.

Other branches

Build status for expected failure (master-fail branch, failure expected)

License

MIT © Kirill Müller.



krlmlr/r-appveyor documentation built on March 27, 2022, 10:57 a.m.