I would like to set up Travis CI for an R project hosted on Github that isn’t a package. Unfortunately, the official R Travis support seems to be pretty hard-wired to packages (which, to be fair, makes sense).
Is there any chance to get this working for non-package code, or is my only recourse to branch r-travis and patch it according to my specifications? I don’t feel competent enough to do this easily.
Here’s my failing Travis configuration:
language: R
r_github_packages:
- klmr/modules
r_binary_packages:
- testthat
script: make test
This fails with the following error:
The command
"Rscript -e 'deps <- devtools::install_deps(dependencies = TRUE);if (!all(deps %in% installed.packages())) { message("missing: ", paste(setdiff(deps, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'"
failed and exited with 1 during .
This makes sense: devtools::install_deps
only works in the context of a package.
I’ve tried suppressing the installation step, by adding install: true
to my configuration. However, now the dependencies are no longer installed, and the build consequently fails with
Error in loadNamespace(name) : there is no package called ‘modules’
It turns out that a naïve approach is fairly easy; the following (complete .travis.yml
) works for my purposes:
language: R
install:
- Rscript -e 'install.packages(c("devtools", "testthat"))'
- Rscript -e 'devtools::install_github("klmr/modules")'
script: make test
However, I’d still prefer a solution that can actually use the Travis declarations (r_binary_packages
, etc.) instead of having to install dependencies manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With