diff --git a/NAMESPACE b/NAMESPACE index b9b6527f3..f740b9781 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/r-hub.R b/R/r-hub.R index d3f690a8e..006723ad0 100644 --- a/R/r-hub.R +++ b/R/r-hub.R @@ -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 -#' . 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") - 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_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn)) + rhub::rhub_check(gh_url = gh_url, + platforms = platforms, + r_versions = r_versions, + branch = branch) +} - 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) } diff --git a/R/release.R b/R/release.R index 352c5886b..f155b9def 100644 --- a/R/release.R +++ b/R/release.R @@ -83,7 +83,7 @@ release <- function(pkg = ".", check = FALSE, args = NULL) { } } - if (yesno("Have you checked on R-hub (with `check_rhub()`)?")) { + if (yesno("Have you checked on R-hub (with `rhub_check()`)?")) { return(invisible()) } diff --git a/man/check_rhub.Rd b/man/check_rhub.Rd deleted file mode 100644 index 8eb445901..000000000 --- a/man/check_rhub.Rd +++ /dev/null @@ -1,59 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/r-hub.R -\name{check_rhub} -\alias{check_rhub} -\title{Run CRAN checks for package on R-hub} -\usage{ -check_rhub( - pkg = ".", - platforms = NULL, - email = NULL, - interactive = TRUE, - build_args = NULL, - ... -) -} -\arguments{ -\item{pkg}{The package to use, can be a file path to the package or a -package object. See \code{\link[=as.package]{as.package()}} for more information.} - -\item{platforms}{R-hub platforms to run the check on. If \code{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 \code{\link[rhub:platforms]{rhub::platforms()}} for a complete list.} - -\item{email}{email address to notify, defaults to the maintainer -address in the package.} - -\item{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.} - -\item{build_args}{Arguments passed to \verb{R CMD build}} - -\item{...}{extra arguments, passed to \code{\link[rhub:check_for_cran]{rhub::check_for_cran()}}.} -} -\value{ -a \code{rhub_check} object. -} -\description{ -It runs \code{\link[=build]{build()}} on the package, with the arguments specified -in \code{args}, and then submits it to the R-hub builder at -\url{https://builder.r-hub.io}. The \code{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. -} -\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 \code{\link[rhub:validate_email]{rhub::validate_email()}}. -} - -\seealso{ -Other build functions: -\code{\link{check_mac_release}()}, -\code{\link{check_win}()} -} -\concept{build functions} diff --git a/man/rhub_check.Rd b/man/rhub_check.Rd new file mode 100644 index 000000000..427238f1f --- /dev/null +++ b/man/rhub_check.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/r-hub.R +\name{rhub_check} +\alias{rhub_check} +\alias{check_rhub} +\title{Run CRAN checks for package on R-hub} +\usage{ +rhub_check( + gh_url = NULL, + platforms = c("ubuntu-release", "windows", "macos"), + r_versions = NULL, + branch = NULL +) + +check_rhub() +} +\arguments{ +\item{gh_url}{GitHub URL of a package to check, or \code{NULL} to check +the package in the current directory.} + +\item{platforms}{Platforms to use, a character vector. +Defaults to most common platforms. Use NULL to select from +a list in interactive sessions. See \code{\link[rhub:rhub_platforms]{rhub::rhub_platforms()}}.} + +\item{r_versions}{Which R version(s) to use for the platforms that +supports multiple R versions. This arguemnt is not implemented yet.} + +\item{branch}{Branch to use to run R-hub. Defaults to the current +branch if \code{gh_url} is \code{NULL}. Otherwise defaults to \code{"main"}. Note that +this branch also need to include the \code{rhub.yaml} workflow file.} +} +\description{ +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 \code{\link[usethis:use_github]{usethis::use_github()}} to do that. Then setup your +R-hub GH Action with \code{\link[rhub:rhub_setup]{rhub::rhub_setup()}}. +} + +\seealso{ +Other build functions: +\code{\link{check_mac_release}()}, +\code{\link{check_win}()} +} +\concept{build functions}