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

http://www.markvanderloo.eu/yaRb/2019/01/11/add-a-static-pdf-vignette-to-an-r-package/

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 https://github.com/jonathan-g/datafsm, and specifically, https://github.com/jonathan-g/datafsm/blob/master/.travis.yml

language: r
sudo: false
cache: packages

matrix:
  include:
    - 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
      env:
        - VALGRIND_OPTS='--leak-check=full --track-origins=yes'
      addons:
        apt:
          packages:
            - valgrind

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

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