Compute-intensive vignettes, devtools, and travis-ci

I have a package with a vignette that takes around 30 minutes to build on a typical workstation. The previous version of this package kept the built vignette in inst/doc, but the current devtools gets rid of inst/doc and .gitignore's it.

My travis-ci workflow is now broken because building the vignette under travis-ci times out. If I tell travis-ci to build and check the package with --no-build-vignettes, I get WARNINGs from R CMD check under travis-ci: Files in the 'vignettes' directory but no files in 'inst/doc' and Package vignettes without corresponding single PDF/HTML.

Can anyone recommend a package-development workflow for using devtools and travis-ci with either pre-built vignettes (checked into GitHub) or without having R CMD check throw WARNINGs about missing vignettes?

Not sure about travis, but the following should help with R CMD check

Actually, the example from the post uses travis too...

Hope it helps

Thanks, but that doesn't quite get at my use case. This just deposits the precompiled PDF but without a corresponding vignette that has the code to generate the PDF, and then it has a wrapper vignette that does nothing but include the PDF when the vignette is built.

What I'm looking at is a vignette that I want to include with the package (including the .Rmd source for the vignette) but I want the pre-built vignette to be installed without recompiling it when I run the travis R CMD check

I think I have something that works, using a modified .travis.yml configuration.

The current devtools will build static versions of the vignettes using build_vignettes(install=TRUE), and install the resulting vignette output and vignette index in the doc and Meta directories, respectively, in the package root. Thus, I can add a pre_script stage to my travis build that makes an inst/doc directory and copies the files there.

I'd still be interested if anyone has a more elegant and simple answer, since this feels like an ugly hack.

See, and specifically,

language: r
sudo: false
cache: packages

    - name: release
      r: release
      r_check_args: --as-cran --no-build-vignettes
    - name: devel
      r: devel
      r_check_args: --as-cran --no-build-vignettes --use-valgrind
        - VALGRIND_OPTS='--leak-check=full --track-origins=yes'
            - valgrind

r_build_args: --no-resave-data --no-build-vignettes

  - if ! test -d inst/doc; then mkdir inst/doc; fi
  - cp -R doc/* inst/doc/
  - cp -R Meta/* inst/doc/

A bit late... A tech note about pre-computing vignettes by Jeroen Ooms. The gist is to call actual Rmd vignette source something like .Rmd.orig and to knit them to .Rmd. The .Rmd fake vignette sources have already executed R code. Therefore it can be used in the R CMD build/check process without creating errors, it can be knit rapidly.

As an alternative to pre-building the vignette, have you considered the option --ignore-vignettes? This will avoid prevent R CMD check from throwing any WARNINGS even though the built vignette is missing.

To test this, I forked your repo and updated .travis.yml to use --ignore-vignettes instead of your before_script step to copy the vignettes to inst/doc/. The Travis builds passed without any WARNING.

I'll end up deleting my fork, so for any potential future readers, checking the package while ignoring the vignettes can be done with the following steps:

R CMD build --no-build-vignettes --no-manual .
R CMD check --no-manual --ignore-vignettes --as-cran *. tar.gz
1 Like