GitHub Actions for R

Max Held

GitHub Actions for R

Max Held

http://www.maxheld.de
@maxheld83
@maxheld

What is
Continuous Integration and Delivery (CI/CD)?

Without CI/CD

With CI/CD

GitHub Actions in Action

remotes::install_github(“r-lib/ghactions”) ghactions::use_ghactions(  workflow = ghactions::website() )

  git add .
  git commit -m "update project"
  git push

Is it easy
to reason about
?

Definition of the Computing Environment

Dockerfile

  FROM rhub/debian-gcc-release
  ...
  ENTRYPOINT ["/entrypoint.R"]
  
  docker build \
    --tag install-deps .
  docker run \
    --entrypoint R install-deps
  

.travis.yml

  language:r
  cache: packages
  ...
  deploy:
    provider: script
      script: Rscript -e \       'pkgdown::deploy_site_github(verbose = TRUE)'
  

What GitHub does …

  action "Deploy to shinyapps.io" {
    uses = "maxheld83/shinyapps@master"
    secrets = ["SHINYAPPS_SECRET", SHINYAPPS_TOKEN"]
  }

.. you can do too!

  docker run --env "SHINYAPPS_SECRET=foo" \ 
    --volume ${PWD}:${HOME} maxheld83/shinyapps:master

Definition of the Workflow Graph

  workflow "Deploy Shiny App" {
    on = "push"
    resolves = ["Deploy to shinyapps.io"]
  }
  action "Install Dependencies" {
    uses = "r-lib/ghactions/install-deps"
  }
  action "Deploy to shinyapps.io"{
    uses = "maxheld83/shinyapps@master"
    needs = ["Install Dependencies"]
  }

Isolation Can be a Good Thing

Your PC
R_LIBS=''
git push
ls .
index.Rmd
app.R
actions/rmarkdown
R_LIBS=/lib/R/library
render_site()
ls /github/workspace/
index.Rmd
app.R
_site/ 
actions/shinyapps
R_LIBS=/lib/R/library
deploy_app()
ls /github/workspace/
index.Rmd
app.R
_site/ 

Definition of the
API Ecosystem

Go Nuts! 🤯

It’s easier(ish)
to reason about.

🖖Thanks❤️

Jim Hester

RStudio Inc.

Gábor Csárdi

The R-Hub Project / R Consortium

Dirk Eddelbuettel & Carl Boettiger

The Rocker Project

Use Actions to Better 🤔🔧🐞

  1. Sign up for the beta at github.com/actions.
  2. remotes::install_github(“r-lib/ghactions”)

Learn More

maxheld.de/ghactions
github.com/r-lib/ghactions