cr_deploy_packagetests {googleCloudRunner} | R Documentation |
Deploy a cloudbuild.yml for R package tests and upload to Codecov
Description
This tests an R package each time you commit, and uploads the test coverage results to Codecov
Usage
cr_deploy_packagetests(
steps = NULL,
cloudbuild_file = "cloudbuild-tests.yml",
env = c("NOT_CRAN=true"),
test_script = NULL,
codecov_script = NULL,
codecov_token = "$_CODECOV_TOKEN",
build_image = "gcr.io/gcer-public/packagetools:latest",
create_trigger = c("file", "inline", "no"),
trigger_repo = NULL,
...
)
Arguments
steps |
extra steps to run before the cr_buildstep_packagetests steps run (such as decryption of auth files) |
cloudbuild_file |
The cloudbuild yaml file to write to. See create_trigger |
env |
Environment arguments to be set during the test script runs |
test_script |
The script that will call rcmdcheck to perform tests. If |
codecov_script |
The script that will call codecov to perform coverage. If |
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 |
create_trigger |
If creating a trigger, whether to create it from the cloudbuild_file or inline |
trigger_repo |
If not NULL, a cr_buildtrigger_repo where a buildtrigger will be created via cr_buildtrigger |
... |
Arguments passed on to
|
Details
The trigger repository needs to hold an R package configured to do tests upon.
For GitHub, the repository will need to be linked to the project you are building within, via https://console.cloud.google.com/cloud-build/triggers/connect
If your tests need authentication details, add these via cr_buildstep_secret to the steps
argument, which will prepend decrypting the authentication file before running the tests.
If you want codecov to ignore some files then also deploy a .covrignore file to your repository - see covr website at https://covr.r-lib.org/ for details.
See Also
Create your own custom deployment using cr_buildstep_packagetests which this function uses with some defaults
Other Deployment functions:
cr_deploy_docker_trigger()
,
cr_deploy_docker()
,
cr_deploy_pkgdown()
,
cr_deploy_run_website()
,
cr_deploy_run()
,
cr_deploy_r()
Examples
# create a local cloudbuild.yml file for packagetests
pd <- cr_deploy_packagetests(create_trigger = "no")
pd
# add a decryption step for an auth file
cr_deploy_packagetests(
steps = cr_buildstep_secret("my_secret", "auth.json"),
env = c("NOT_CRAN=true", "MY_AUTH_FILE=auth.json"),
timeout = 1200,
create_trigger = "no"
)
# creating a buildtrigger repo for trigger_repo
repo <- cr_buildtrigger_repo("MarkEdmondson1234/googleCloudRunner",
branch = "master"
)
## Not run:
# will create the file in the repo, and point a buildtrigger at it
cr_deploy_packagetests(create_trigger = "file", trigger_repo = repo)
# will make an inline build within a buildtrigger
cr_deploy_packagetests(create_trigger = "inline", trigger_repo = repo)
## End(Not run)
unlink("cloudbuild-tests.yml")