Closed jennybc closed 2 years ago
Continuous integration (CI) services, such as Travis CI, can be used to automate important development tasks, like testing and building artefacts. Typically, this goes hand in hand with the practice of hosting development on a site like GitHub.com. Each time the developer pushes new work to GitHub, it triggers a Travis job to run R CMD check
or build and deploy a website.
The usethis::use_tidy_ci()
function does some basic setup that's relevant to almost any tidyverse or r-lib package. But there's a long tail of more specialized tasks that we implement in a more artisanal way. Here we record some of the common principles and mechanics, since they cannot be (yet?) be automated.
Many CI tasks require a piece of secret info that gives, say, Travis the permission to do something on behalf of the developer. Examples: make requests to a Google API, make commits back to the project repo, deploy to a hosting service. Managing these secrets requires care, but it's often worth it to test software more thoroughly or to keep a rendered book or website up-to-date.
What follows in a brain dump
Use the simplest, smallest secret possible.
.httr-oauth
file.Store the secret outside the project, i.e. in an env var or in a specific, semi-hidden place at the user-level. For example, store a secret file in some well-named folder below ~/.R/
or define an env var in ~/.Renviron
.
Plan for graceful and partial failure when the secret is not available.
Automatic rendering of
Hmmm, this cuts across documentation (both examples and vignettes), testing, and CI.
I now touch on @examplesIf
in the man/
chapter which I think is all that's needed there.
https://github.com/tidyverse/style/pull/110