Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow rhub v2 #2575

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export(release_checks)
export(reload)
export(revdep)
export(revdep_maintainers)
export(rhub_check)
export(run_examples)
export(session_info)
export(show_news)
Expand Down
84 changes: 35 additions & 49 deletions R/r-hub.R
Original file line number Diff line number Diff line change
@@ -1,62 +1,48 @@

#' Run CRAN checks for package on R-hub
#'
#' It runs [build()] on the package, with the arguments specified
#' in `args`, and then submits it to the R-hub builder at
#' <https://builder.r-hub.io>. The `interactive` option controls
#' whether the function waits for the check output. Regardless, after the
#' check is complete, R-hub sends an email with the results to the package
#' maintainer.
#' It runs an R-hub GitHub action on the package.
#' Used to check if the package passes CRAN checks on
#' different platforms and R versions.
#'
#' @section GitHub and R-hub:
#' To use R-hub you must first setup a GitHub repository.
#' Use [usethis::use_github()] to do that. Then setup your
#' R-hub GH Action with [rhub::rhub_setup()].
#'
#' @section About email validation on r-hub:
#' To build and check R packages on R-hub, you need to validate your
#' email address. This is because R-hub sends out emails about build
#' results. See more at [rhub::validate_email()].
#' @param platforms Platforms to use, a character vector.
#' Defaults to most common platforms. Use NULL to select from
#' a list in interactive sessions. See [rhub::rhub_platforms()].
#'
#' @param platforms R-hub platforms to run the check on. If `NULL`
#' uses default list of CRAN checkers (one for each major platform, and
#' one with extra checks if you have compiled code). You can also specify
#' your own, see [rhub::platforms()] for a complete list.
#' @param email email address to notify, defaults to the maintainer
#' address in the package.
#' @param interactive whether to show the status of the build
#' interactively. R-hub will send an email to the package maintainer's
#' email address, regardless of whether the check is interactive or not.
#' @param build_args Arguments passed to `R CMD build`
#' @param ... extra arguments, passed to [rhub::check_for_cran()].
#' @inheritParams check
#' @inheritParams rhub::rhub_check
#' @family build functions
#' @return a `rhub_check` object.
#' @return NULL
#'
#' @export

check_rhub <- function(pkg = ".",
platforms = NULL,
email = NULL,
interactive = TRUE,
build_args = NULL,
...) {
rlang::check_installed("rhub")
pkg <- as.package(pkg)
rhub_check <- function(gh_url = NULL,
platforms = c("ubuntu-release", "windows", "macos"),
r_versions = NULL,
branch = NULL) {
rlang::check_installed("rhub", version = "2.0.0")

Check warning on line 26 in R/r-hub.R

View check run for this annotation

Codecov / codecov/patch

R/r-hub.R#L26

Added line #L26 was not covered by tests

built_path <- build(pkg$path, tempdir(), quiet = !interactive,
args = build_args)
on.exit(file_delete(built_path), add = TRUE)
rhub::rhub_doctor(gh_url = gh_url)

Check warning on line 28 in R/r-hub.R

View check run for this annotation

Codecov / codecov/patch

R/r-hub.R#L28

Added line #L28 was not covered by tests

check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
rhub::rhub_check(gh_url = gh_url,
platforms = platforms,
r_versions = r_versions,
branch = branch)

Check warning on line 33 in R/r-hub.R

View check run for this annotation

Codecov / codecov/patch

R/r-hub.R#L30-L33

Added lines #L30 - L33 were not covered by tests
}

status <- rhub::check_for_cran(
path = built_path,
email = email,
platforms = platforms,
show_status = interactive,
...
)
#' @rdname rhub_check
#' @export

if (!interactive) {
cli::cli_inform(c(v = "R-hub check for package {.pkg {pkg$package}} submitted."))
status
} else {
status
}
check_rhub <- function(gh_url = NULL,
platforms = c("ubuntu-release", "windows", "macos"),
r_versions = NULL,
branch = NULL) {
lifecycle::deprecate_soft(when = "2.4.6", what = "check_rhub()", with = "rhub_check()")
rhub_check(gh_url = gh_url,
platforms = platforms,
r_versions = r_versions,
branch = branch)

Check warning on line 47 in R/r-hub.R

View check run for this annotation

Codecov / codecov/patch

R/r-hub.R#L43-L47

Added lines #L43 - L47 were not covered by tests
}
2 changes: 1 addition & 1 deletion R/release.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
}
}

if (yesno("Have you checked on R-hub (with `check_rhub()`)?")) {
if (yesno("Have you checked on R-hub (with `rhub_check()`)?")) {

Check warning on line 86 in R/release.R

View check run for this annotation

Codecov / codecov/patch

R/release.R#L86

Added line #L86 was not covered by tests
return(invisible())
}

Expand Down
59 changes: 0 additions & 59 deletions man/check_rhub.Rd

This file was deleted.

49 changes: 49 additions & 0 deletions man/rhub_check.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading