From 45f24e156a4f8e4ef90ce278abd66401f1a2165b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20J=C4=99drusiak?= Date: Mon, 12 Aug 2024 15:19:46 +0200 Subject: [PATCH 1/3] follow rhub v2 --- NAMESPACE | 1 + R/r-hub.R | 79 +++++++++++++++++++---------------------------- R/release.R | 2 +- man/check_rhub.Rd | 59 ----------------------------------- man/rhub_check.Rd | 49 +++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 108 deletions(-) delete mode 100644 man/check_rhub.Rd create mode 100644 man/rhub_check.Rd 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..d27018377 100644 --- a/R/r-hub.R +++ b/R/r-hub.R @@ -1,62 +1,45 @@ - #' 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, - ...) { +rhub_check <- function(gh_url = NULL, + platforms = c("ubuntu-release", "windows", "macos"), + r_versions = NULL, + branch = NULL) { rlang::check_installed("rhub") - pkg <- as.package(pkg) - 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() { + 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} From 3c41117533c04596b5e0b4697e538e035371386d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20J=C4=99drusiak?= Date: Mon, 12 Aug 2024 15:25:06 +0200 Subject: [PATCH 2/3] add min rhub 2.0.0 version --- R/r-hub.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/r-hub.R b/R/r-hub.R index d27018377..37a60faa5 100644 --- a/R/r-hub.R +++ b/R/r-hub.R @@ -23,7 +23,7 @@ rhub_check <- function(gh_url = NULL, platforms = c("ubuntu-release", "windows", "macos"), r_versions = NULL, branch = NULL) { - rlang::check_installed("rhub") + rlang::check_installed("rhub", version = "2.0.0") rhub::rhub_doctor(gh_url = gh_url) From 37972618cd62567e10922d596651cbedc90fcf42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20J=C4=99drusiak?= Date: Mon, 12 Aug 2024 15:26:51 +0200 Subject: [PATCH 3/3] Fix compatibility params --- R/r-hub.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/r-hub.R b/R/r-hub.R index 37a60faa5..006723ad0 100644 --- a/R/r-hub.R +++ b/R/r-hub.R @@ -36,7 +36,10 @@ rhub_check <- function(gh_url = NULL, #' @rdname rhub_check #' @export -check_rhub <- function() { +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,