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")
)The script that will call rcmdcheck to perform tests. If NULL a default script is used in system.file("r_buildsteps", "devtools_tests.R", package="googlecloudRunner")
The script that will call codecov to perform coverage. If NULL a default script is used in system.file("r_buildsteps", "codecov_tests.R", package="googleCloudRunner")
If using codecov, supply your codecov token here.
The docker image that will be used to run the R code for the test scripts
Environment arguments to be set during the test script runs
If using codecov, these environment arguments are added to aid with the codecoverage:
* "CODECOV_TOKEN=$_CODECOV_TOKEN"
* "GCB_PROJECT_ID=$PROJECT_ID"
* "GCB_BUILD_ID=$BUILD_ID"
* "GCB_COMMIT_SHA=$COMMIT_SHA"
* "GCB_REPO_NAME=$REPO_NAME"
* "GCB_BRANCH_NAME=$BRANCH_NAME"
* "GCB_TAG_NAME=$TAG_NAME"
* "GCB_HEAD_BRANCH=$_HEAD_BRANCH"
* "GCB_BASE_BRANCH=$_BASE_BRANCH"
* "GCB_HEAD_REPO_URL=$_HEAD_REPO_URL"
* "GCB_PR_NUMBER=$_PR_NUMBER"
https://docs.codecov.com/reference
Other Cloud Buildsteps:
cr_buildstep_bash(),
cr_buildstep_decrypt(),
cr_buildstep_df(),
cr_buildstep_docker(),
cr_buildstep_edit(),
cr_buildstep_extract(),
cr_buildstep_gcloud(),
cr_buildstep_gitsetup(),
cr_buildstep_mailgun(),
cr_buildstep_nginx_setup(),
cr_buildstep_pkgdown(),
cr_buildstep_run(),
cr_buildstep_r(),
cr_buildstep_secret(),
cr_buildstep_slack(),
cr_buildstep_targets(),
cr_buildstep()
# NOT RUN {
cr_buildstep_packagetests()
# }
Run the code above in your browser using DataLab