This lets you run R package tests and is intended to be used in a trigger when you push to a repository so you can monitor code quality.

cr_buildstep_packagetests(
  test_script = NULL,
  codecov_script = NULL,
  codecov_token = "$_CODECOV_TOKEN",
  build_image = "gcr.io/gcer-public/packagetools:latest",
  env = c("NOT_CRAN=true")
)

Arguments

test_script

The script that will perform tests. If NULL a default script is used in system.file("r_buildsteps", "devtools_tests.R")

codecov_script

The script that will perform coverage. If NULL a default script is used in system.file("r_buildsteps", "codecov_tests.R")

codecov_token

If using codecov, supply your codecov token here.

build_image

The docker image that will be used to run the R code for the test scripts

env

Environment arguments to be set during the test script runs

Examples

cr_buildstep_packagetests()
#> [[1]] #> ==cloudRunnerBuildStep== #> name: gcr.io/gcer-public/packagetools:latest #> args: #> - Rscript #> - -e #> - |- #> message("cran mirror: ", getOption("repos")) #> remotes::install_deps(dependencies = TRUE) #> rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning') #> env: #> - NOT_CRAN=true #> #> [[2]] #> ==cloudRunnerBuildStep== #> name: gcr.io/gcer-public/packagetools:latest #> args: #> - Rscript #> - -e #> - |- #> remotes::install_deps(dependencies = TRUE) #> remotes::install_local() #> cv <- covr::package_coverage() #> print(cv) #> covr::codecov(coverage=cv, commit = '$$COMMIT_SHA', branch = '$$BRANCH_NAME') #> env: #> - NOT_CRAN=true #> - CODECOV_TOKEN=$_CODECOV_TOKEN #>