do_package_checks() adds default steps related to package checks to the "before_install", "install", "script" and "after_success" stages:

This macro is only available for R packages.

  1. step_install_deps() in the "install" stage, using the repos argument.

  2. step_session_info() in the "install" stage.

  3. step_rcmdcheck() in the "script" stage, using the warnings_are_errors, notes_are_errors, args, and build_args arguments.

  4. A call to covr::codecov() in the "after_success" stage (only if the codecov flag is set)

do_package_checks(
  ...,
  codecov = !ci_is_interactive(),
  warnings_are_errors = NULL,
  notes_are_errors = NULL,
  args = NULL,
  build_args = NULL,
  error_on = "warning",
  repos = repo_default(),
  type = getOption("pkgType"),
  dependencies = TRUE,
  timeout = Inf,
  check_dir = "check"
)

Arguments

...

Ignored, used to enforce naming of arguments.

codecov

[flag]
Whether to include a step running covr::codecov(quiet = FALSE) (default: only for non-interactive CI, see ci_is_interactive()).

warnings_are_errors

[flag]
Deprecated, use error_on.

notes_are_errors

[flag]
Deprecated, use error_on.

args

[character]
Passed to rcmdcheck::rcmdcheck().

Default for local runs: c("--no-manual", "--as-cran").

Default for Windows: c("--no-manual", "--as-cran", "--no-vignettes", "--no-build-vignettes", "--no-multiarch").

On GitHub Actions option "--no-manual" is always used (appended to custom user input) because LaTeX is not available and installation is time consuming and error prone.

build_args

[character]
Passed to rcmdcheck::rcmdcheck().
Default for local runs: "--force".
Default for Windows: c("--no-build-vignettes", "--force").

error_on

[character]
Whether to throw an error on R CMD check failures. Note that the check is always completed (unless a timeout happens), and the error is only thrown after completion. If "never", then no errors are thrown. If "error", then only ERROR failures generate errors. If "warning", then WARNING failures generate errors as well. If "note", then any check failure generated an error.

repos

[character]
Passed to rcmdcheck::rcmdcheck(), default: repo_default().

type

Passed on to install.packages(). The default avoids installation from source on Windows and macOS by passing .Platform$pkgType.

dependencies

Which dependencies do you want to check? Can be a character vector (selecting from "Depends", "Imports", "LinkingTo", "Suggests", or "Enhances"), or a logical vector.

TRUE is shorthand for "Depends", "Imports", "LinkingTo" and "Suggests". NA is shorthand for "Depends", "Imports" and "LinkingTo" and is the default. FALSE is shorthand for no dependencies (i.e. just check this package, not its dependencies).

The value "soft" means the same as TRUE, "hard" means the same as NA.

You can also specify dependencies from one or more additional fields, common ones include:

  • Config/Needs/website - for dependencies used in building the pkgdown site.

  • Config/Needs/coverage for dependencies used in calculating test coverage.

timeout

[numeric]
Passed to rcmdcheck::rcmdcheck(), default: Inf.

check_dir

[character]
Path specifying the directory for R CMD check. Defaults to "check" for easy upload of artifacts.

See also

Examples

#> Creating a clean tic stage configuration
#> See `?tic::dsl_get` for details
do_package_checks()
#>
#> ── tic configuration ───────────────────────────────────────────────────────────
#> ── install ──────────────────────────────────────────────────────────── stage ── #> ▶ step_install_deps(repos = repo_default(), type = getOption("pkgType"), #> dependencies = TRUE) #> ▶ step_session_info() #> ── script ───────────────────────────────────────────────────────────── stage ── #> ▶ step_rcmdcheck(warnings_are_errors = NULL, notes_are_errors = NULL, #> args = NULL, build_args = NULL, error_on = "warning", repos = repo_default(), #> timeout = Inf, check_dir = "check")
#>
#> ── tic configuration ───────────────────────────────────────────────────────────
#> ── install ──────────────────────────────────────────────────────────── stage ── #> ▶ step_install_deps(repos = repo_default(), type = getOption("pkgType"), #> dependencies = TRUE) #> ▶ step_session_info() #> ── script ───────────────────────────────────────────────────────────── stage ── #> ▶ step_rcmdcheck(warnings_are_errors = NULL, notes_are_errors = NULL, #> args = NULL, build_args = NULL, error_on = "warning", repos = repo_default(), #> timeout = Inf, check_dir = "check")