katwre / rworkflows

Continuous integration for R packages. Automates testing, documentation website building, and containerised deployment.

Home Page:https://neurogenomics.github.io/rworkflows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


CRAN checks License: GPL-3

R build status R build status R build status

Authors: Brian Schilder, Alan Murphy, Nathan Skene

README updated: Mar-13-2023

Intro

GitHub Actions are a powerful way to automatically launch workflows every time you push changes to a GitHub repository. This is a form of Continuous Integration (CI), which helps ensure that your code is always working as expected (without having to manually check each time).

Here, we have designed a robust, reusable, and flexible action specifically for the development of R packages. We also provide an R function to automatically generate a workflow file that calls the rworkflows composite action:

Currently, rworkflows action performs the following tasks:

  1. Builds a Docker container to run subsequent steps within.
  2. Builds and checks your R package (with CRAN and/or Bioconductor checks).
  3. Runs units tests.
  4. Runs code coverage tests and uploads the results to Codecov.
  5. (Re)builds and launches a documentation website for your R package.
  6. Pushes an Rstudio Docker container to DockerHub with your R package and all its dependencies pre-installed.

Importantly, this workflow is designed to work with any R package out-of-the-box. This means you won’t have to manually edit any yaml files, just run the rworkflows::use_workflow() function and you’re ready to go!

Quickstart

Install and create the workflow in your R package’s project folder.

## in R

#### Install rworkflows R package ####
### For the stable CRAN release
if(!require("rworkflows")) install.packages("rworkflows")
### Or, for the latest development version
# if(!require("rworkflows")) remotes::install_github("neurogenomics/rworkflows")

### Create workflow file
path <- rworkflows::use_workflow()

Push to GitHub, and let everything else run automatically! You can check the status of your workflow by clicking on the Actions tab in your GitHub repo.

## in the Terminal
git add .
git commit -m "Added rworkflows"
git push

Note: If you want to skip running GitHub Actions on a particular push, simply add “[skip ci]” somewhere in the commit message, e.g.: git commit -m "Update README [skip ci]"

Documentation

Introductory tutorial for using rworkflows.

GitHub Secrets

Before pushing changes to your new R package, you will need to set up one or more GitHub Secrets:

  • PAT_GITHUB [Required]: Speeds up installations and gives access to private repos on GitHub Actions. You can generate your very own Personal Authentication Token using these instructions.
  • DOCKER_TOKEN [Optional]: Allows GitHub Actions to push to a DockerHub account.

Copy-and-paste instructions for creating a Docker or Singularity container with the rworkflows R package pre-installed.

Interactive graph showing all the GitHub repos that currently use the rworkflows action.

Citation

If you use rworkflows, please cite:

Brian M. Schilder, Alan E. Murphy, & Nathan G. Skene (2023) The rworkflows suite: automated continuous integration for quality checking, documentation website creation, and containerised deployment of R packages, Research Square; https://doi.org/10.21203/rs.3.rs-2399015/v1

Acknowledgments

rworkflows builds upon the work of many others, especially the following:

This workflow is derived from the workflow generated by the use_bioc_github_action() function within the biothis package.

Key changes in rworkflows

  • Uses dynamic variables to specify R/Bioconductor versions (e.g. r: "latest") and the name of your R package, as opposed to static names that are likely to become outdated (e.g. r: "4.0.1").
  • Additional error handling and dependencies checks.
  • Re-renders README.Rmd before rebuilding the documentation website.

A general set of GitHub Actions.

A set of GitHub Actions for R development.

Builds and deploys the GitHub Pages documentation website in the rworkflows GHA workflows.

A set of GitHub Actions for building/pushing Docker containers.

Uses the official bioconductor/bioconductor_docker Docker container.

NOTE: Whenever a new version of Bioconductor is released, the bioconductor/bioconductor_docker container will often lag behind the actual Bioconductor releases for up to several days, due to the time it takes to update the container. This means that sometimes “devel” in Bioconductor/bioconductor_docker is actually referring to the current “release” version of Bioconductor (i.e. the previous Bioc version’s “devel”). For further details, see this Issue, and the Bioconductor release schedule.

This Dockerfile was partly adapted from the scFlow Dockerfile.

Unlike other Dockerfiles, this one does not require any manual editing when applying to different R packages. This means that users who are unfamiliar with Docker do not have to troubleshoot making this file correctly. It also means that it will continue to work even if your R package dependencies change.

A very useful command line tool for testing GitHub Actions locally.

Session Info

utils::sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] here_1.0.1          rprojroot_2.0.3     digest_0.6.31      
##  [4] utf8_1.2.3          BiocFileCache_2.6.1 R6_2.5.1           
##  [7] stats4_4.2.1        RSQLite_2.3.0       evaluate_0.20      
## [10] httr_1.4.5          ggplot2_3.4.1       pillar_1.8.1       
## [13] yulab.utils_0.0.6   rworkflows_0.99.7   biocViews_1.66.3   
## [16] rlang_1.0.6         curl_5.0.0          data.table_1.14.8  
## [19] rstudioapi_0.14     whisker_0.4.1       blob_1.2.3         
## [22] DT_0.27             RUnit_0.4.32        rmarkdown_2.20.1   
## [25] desc_1.4.2          readr_2.1.4         stringr_1.5.0      
## [28] htmlwidgets_1.6.1   dlstats_0.1.6       BiocPkgTools_1.16.1
## [31] munsell_0.5.0       igraph_1.4.1        RCurl_1.98-1.10    
## [34] bit_4.0.5           compiler_4.2.1      xfun_0.37          
## [37] pkgconfig_2.0.3     BiocGenerics_0.44.0 rorcid_0.7.0       
## [40] htmltools_0.5.4     tidyselect_1.2.0    tibble_3.2.0       
## [43] httpcode_0.3.0      XML_3.99-0.13       fansi_1.0.4        
## [46] dplyr_1.1.0         tzdb_0.3.0          dbplyr_2.3.1       
## [49] bitops_1.0-7        rappdirs_0.3.3      crul_1.3           
## [52] grid_4.2.1          RBGL_1.74.0         jsonlite_1.8.4     
## [55] gtable_0.3.1        lifecycle_1.0.3     DBI_1.1.3          
## [58] magrittr_2.0.3      scales_1.2.1        graph_1.76.0       
## [61] cli_3.6.0           stringi_1.7.12      cachem_1.0.7       
## [64] renv_0.17.0         fauxpas_0.5.0       xml2_1.3.3         
## [67] rvcheck_0.2.1       ellipsis_0.3.2      filelock_1.0.2     
## [70] generics_0.1.3      vctrs_0.5.2         gh_1.4.0           
## [73] RColorBrewer_1.1-3  tools_4.2.1         bit64_4.0.5        
## [76] Biobase_2.58.0      glue_1.6.2          hms_1.1.2          
## [79] fastmap_1.1.1       yaml_2.3.7          colorspace_2.1-0   
## [82] BiocManager_1.30.20 rvest_1.0.3         memoise_2.0.1      
## [85] badger_0.2.3        knitr_1.42

About

Continuous integration for R packages. Automates testing, documentation website building, and containerised deployment.

https://neurogenomics.github.io/rworkflows


Languages

Language:HTML 93.0%Language:R 6.8%Language:Dockerfile 0.2%