Skip to content

Add check_mac_devel() #2606

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

Open
wants to merge 1 commit 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 @@ -13,6 +13,7 @@ export(build_vignettes)
export(check)
export(check_built)
export(check_dep_version)
export(check_mac_devel)
export(check_mac_release)
export(check_man)
export(check_rhub)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* `test_coverage_active_file()` now reports if any tests failed and does
a better job of executing snapshot comparisons.

* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)

# devtools 2.4.5

* `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was
Expand Down
46 changes: 36 additions & 10 deletions R/check-mac.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,37 @@
#' the package.
#' @family build functions
#' @return The url with the check results (invisibly)
#' @name check_mac
NULL

#' @describeIn check_mac Check package on the development version of R.
#' @export
check_mac_devel <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))

Check warning on line 19 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L19

Added line #L19 was not covered by tests

check_mac(
pkg = pkg, version = "R-devel", dep_pkgs = dep_pkgs,
args = args, manual = manual, quiet = quiet, ...
)

Check warning on line 24 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L21-L24

Added lines #L21 - L24 were not covered by tests
}

#' @describeIn check_mac Check package on the released version of R.
#' @export
check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))

check_mac(
pkg = pkg, version = "R-release", dep_pkgs = dep_pkgs,
args = args, manual = manual, quiet = quiet, ...
)

Check warning on line 35 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L32-L35

Added lines #L32 - L35 were not covered by tests
}

check_mac <- function(pkg = ".", version = c("R-devel", "R-release"),
dep_pkgs = character(), args = NULL, manual = TRUE, quiet = FALSE, ...) {
pkg <- as.package(pkg)

version <- match.arg(version, several.ok = FALSE)

Check warning on line 42 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L42

Added line #L42 was not covered by tests

if (!quiet) {
cli::cli_inform(c(
"Building macOS version of {.pkg {pkg$package}} ({pkg$version})",
Expand All @@ -24,24 +49,25 @@
}

built_path <- pkgbuild::build(pkg$path, tempdir(),
args = args,
manual = manual, quiet = quiet, ...
args = args,
manual = manual, quiet = quiet, ...

Check warning on line 53 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L52-L53

Added lines #L52 - L53 were not covered by tests
)

dep_built_paths <- character()
for (i in seq_along(dep_pkgs)) {
dep_pkg <- as.package(dep_pkgs[[i]])$path
dep_built_paths[[i]] <- pkgbuild::build(dep_pkg, tempdir(),
args = args,
manual = manual, quiet = quiet, ...
args = args,
manual = manual, quiet = quiet, ...

Check warning on line 61 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L60-L61

Added lines #L60 - L61 were not covered by tests
)
}
on.exit(file_delete(c(built_path, dep_built_paths)), add = TRUE)

url <- "https://mac.r-project.org/macbuilder/v1/submit"

rlang::check_installed("httr")
body <- list(pkgfile = httr::upload_file(built_path))
body <- list(pkgfile = httr::upload_file(built_path),
rflavor = tolower(version))

Check warning on line 70 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L69-L70

Added lines #L69 - L70 were not covered by tests

if (length(dep_built_paths) > 0) {
uploads <- lapply(dep_built_paths, httr::upload_file)
Expand All @@ -50,11 +76,11 @@
}

res <- httr::POST(url,
body = body,
headers = list(
"Content-Type" = "multipart/form-data"
),
encode = "multipart"
body = body,
headers = list(
"Content-Type" = "multipart/form-data"
),
encode = "multipart"

Check warning on line 83 in R/check-mac.R

View check run for this annotation

Codecov / codecov/patch

R/check-mac.R#L79-L83

Added lines #L79 - L83 were not covered by tests
)

httr::stop_for_status(res, task = "Uploading package")
Expand Down
20 changes: 19 additions & 1 deletion man/check_mac_release.Rd → man/check_mac.Rd

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

2 changes: 1 addition & 1 deletion man/check_rhub.Rd

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

2 changes: 1 addition & 1 deletion man/check_win.Rd

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