Sets up continuous integration (CI) for an R package that is developed on GitHub using GitHub Actions. CI can be used to trigger various operations for each push or pull request, such as:
Run R CMD check on various operating systems and R versions
Build and deploy a pkgdown site
Determine test coverage
This family of functions
Adds the necessary configuration files and lists them in .Rbuildignore
Provides the markdown to insert a badge into your README
use_github_actions()use_github_actions_badge(name = "R-CMD-check.yaml", repo_spec = NULL)
use_github_action(
name,
ref = NULL,
url = NULL,
save_as = NULL,
readme = NULL,
ignore = TRUE,
open = FALSE
)
use_github_action_check_release(
save_as = "R-CMD-check.yaml",
ref = NULL,
ignore = TRUE,
open = FALSE
)
use_github_action_check_standard(
save_as = "R-CMD-check.yaml",
ref = NULL,
ignore = TRUE,
open = FALSE
)
use_github_action_pr_commands(
save_as = "pr-commands.yaml",
ref = NULL,
ignore = TRUE,
open = FALSE
)
For use_github_action(): Name of one of the example workflows
from https://github.com/r-lib/actions/tree/v2/examples. Examples:
"pkgdown", "check-standard.yaml".
For use_github_actions_badge(): Name of the workflow's YAML configuration
file. Examples: "R-CMD-check", "R-CMD-check.yaml".
If name has no extension, we assume it's .yaml.
Optional GitHub repo specification in this form: owner/repo. This can usually be inferred from the GitHub remotes of active project.
Desired Git reference, usually the name of a tag ("v2") or
branch ("main"). Other possibilities include a commit SHA ("d1c516d")
or "HEAD" (meaning "tip of remote's default branch"). If not specified,
defaults to the latest published release of r-lib/actions
(https://github.com/r-lib/actions/releases).
The full URL to a .yaml file on GitHub.
Name of the local workflow file. Defaults to name or
fs::path_file(url) for use_github_action(). Do not specify any other
part of the path; the parent directory will always be .github/workflows,
within the active project.
The full URL to a README file that provides more details
about the workflow. Ignored when url is NULL.
Should the newly created file be added to .Rbuildignore?
Open the newly created file for editing? Happens in RStudio, if
applicable, or via utils::file.edit() otherwise.
Configures a basic R CMD check workflow on GitHub Actions by adding a
standard R-CMD-check.yaml file to the .github/workflows directory of the
active project. This is actually just an alias for
use_github_action_check_release().
Generates a GitHub Actions badge and that's all. It does not configure a workflow. This exists mostly for internal use in the other functions documented here.
Configures an individual, specific GitHub Actions workflow, either one of the
examples from
r-lib/actions/examples
or a custom workflow given by the url parameter.
Used internally to power all the other GitHub Actions functions, but it can also be called directly by the user.
This entry-level, bare-minimum workflow installs the latest release of R (on
a current distribution of Linux) and runs R CMD check via the
rcmdcheck package.
This workflow runs R CMD check via the
rcmdcheck package on the three major
operating systems (Linux, macOS, and Windows) on the latest release of R and
on R-devel. This workflow is appropriate for a package that is (or aspires to
be) on CRAN or Bioconductor.
This workflow enables the use of two R-specific commands in pull request issue comments:
/document to run roxygen2::roxygenise() and update the PR
/style to run styler::style_pkg() and update the PR
use_github_file() for more about url format and parsing.
use_tidy_github_actions() for the standard GitHub Actions used for
tidyverse packages.
if (FALSE) {
use_github_actions()
use_github_action_check_standard()
use_github_action("pkgdown")
}
Run the code above in your browser using DataLab