Skip to content

Instantly share code, notes, and snippets.

@ellisvalentiner
Created October 12, 2016 21:04
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ellisvalentiner/31ce17c6a827f370606f15b61239361d to your computer and use it in GitHub Desktop.
Save ellisvalentiner/31ce17c6a827f370606f15b61239361d to your computer and use it in GitHub Desktop.
yaml to build R package for bitbucket pipelines continuous integration
image: rocker/hadleyverse:latest
pipelines:
default:
- step:
script:
- cd /opt/atlassian/pipelines/agent/build
- Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'
- Rscript -e 'devtools::build()'
- Rscript -e 'devtools::install(upgrade_dependencies = FALSE)'
- Rscript -e 'devtools::check()'
@Henri-Lo
Copy link

I tried this in R 3.4.1 but

Build setup2s
cd /opt/atlassian/pipelines/agent/build<1s
Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'<1s
�+ Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'
Error: Could not find package root.
Execution halted

where root package not available. Do you have newer approaches to test R code?

@aboland-edge
Copy link

I'm sure you found a solution long since this post, but it was one of the top hits when I googled this problem.

My library was in a sub directory in the repository, this was the problem. The solution was to set the directory to where the R library was.

script:
    - cd /opt/atlassian/pipelines/agent/build/my_R_library
    - Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'
    - Rscript -e 'devtools::build()'
    - Rscript -e 'devtools::install(upgrade_dependencies = FALSE)'
    - Rscript -e 'devtools::check()'

@stevegbrooks
Copy link

The first line should be changed to image: rocker/tidyverse:latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment