Example gitlab-ci.yml for R Projects

[This article was first published on r - Brandon Bertelsen, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Example gitlab-ci.yml for R Projects

Most people are running open source projects, so they can easily use github and travis for free. I don’t have that luxury, but gitlab has really caught my attention lately. Combining gitlab, gitlab runner with docker makes things very straightforward. Here is an example .gitlab-ci.yml file that you would need to include in the base directory of your R project to have it run R CMD check and run testthat tests.

image: rocker/rstudio  
test:  
   script:
    - R -e 'install.packages(c("needed here"))'
    - R CMD build . --no-build-vignettes --no-manual
    - PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
    - R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual
    - R -e 'devtools::test()'

To leave a comment for the author, please follow the link and comment on their blog: r - Brandon Bertelsen.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)