Skip to content

schloerke/r-gha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R-CMD-check

R + GitHub Actions - A love story

This repo is not maintained after May 11, 2021 and may become out of date.

Demo

Usage

To add the workflow files to your R package repo, call:

## Typical R package repos
# usethis::use_github_action_check_standard()

# This R package repo uses (and all future repos should use)
usethis::use_github_action("check-pak")
usethis::use_github_action("pkgdown-pak")

... then git commit and git push the changes in your local repo!

GitHub Actions

Story

When submitting packages to CRAN, it helps to let them know where you've tested R packages and on which platforms. The more platforms and R versions that you can test your package on, the better!

History

Before GitHub Actions, developers used Travis-CI (and some packages still do!). However, Travis was limited in that it could only test using a single type linux machine. You could test on multiple R versions.

Given authors develop on a mac, this required package authors to use r-hub (lead by Gabor) to test on different flavors of windows machines. This service was MUCH better the praying and hoping your code worked, but was still not very robust.

R-hub may still be a good place to check if you have compiled ./src code. However, this is a small number of R packages.

CI Need

As RStudio has become more popular and usage demands are becoming more spread out, packages like plumber need to be sure they work on multiple operating systems and multiple versions of R.

To feel comfortable submitting a heavily used R package, I like to test on using:

tidyverse supports the latest 4 versions of R

These combinations create a large test matrix and is not fun to manually execute.

CI Solution

GitHub Actions (GHA) for R was initially explored by Max Held during his summer internship at RStudio. Since then, GHA created a complete different interface and Max's work was repurposed in https://github.com/r-lib/actions by Jim Hester.

Using r-lib/actions allows package developers to use consistent routines, yet customize the CI execution.

Two useful steps:

  • r-lib/actions/setup-r@v1: Set up the R process. Example
  • r-lib/actions/setup-pandoc@v1: Set up pandoc. Example

This repo uses pak to install system requirements and install all package dependencies. To me, any general usage of remotes should be replaced with pak. It is better for many reasons. Two being:

  • wholistic installation (consistency): It knows everything that is going to be installed before installing the first package.

  • parallel installation (speed): If two packages are not dependent on each other, they may be install in parallel.

  • pak

Real Life Usage

Test coverage and PR commands could be combined into a single workflow, such as rstudio/shiny's Rituals.

About

R + GitHub Actions

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages