Skip to content

Commit

Permalink
Try R_LIBS_USER again in occasional check (#6278)
Browse files Browse the repository at this point in the history
* Try R_LIBS_USER again

* Sort library output
  • Loading branch information
MichaelChirico authored Jul 16, 2024
1 parent fdb9d0c commit bae231d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/R-CMD-check-occasional.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
schedule:
- cron: '17 13 16 * *' # 16th of month at 13:17 UTC
- cron: '17 13 17 * *' # 17th of month at 13:17 UTC

# A more complete suite of checks to run monthly; each PR/merge need not pass all these, but they should pass before CRAN release
name: R-CMD-check-occasional
Expand Down Expand Up @@ -100,38 +100,47 @@ jobs:
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_TESTS_NLINES_: 0
R_LIBS_USER: /home/runner/work/r-lib
run: |
options(crayon.enabled = TRUE)
remotes::install_deps(dependencies=TRUE, force=TRUE)
other_deps_expr = parse('inst/tests/other.Rraw', n=1L)
eval(other_deps_expr)
pkgs = get(as.character(other_deps_expr[[1L]][[2L]]))
# Many will not install on oldest R versions
try(remotes::install_cran(c(pkgs, "rcmdcheck"), force=TRUE))
# we define this in data.table namespace, but it appears to be exec
if (!exists("isFALSE", "package:base")) {
if (!exists("isFALSE", "package:base")) { # R>=3.5.0
if (!exists("isFALSE", asNamespace("data.table"))) {
message("isFALSE not found in base, but data.table did not define it either!\n")
}
# attempt defining it here as a workaround...
isFALSE = function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x
}
has_pkg = sapply(pkgs, requireNamespace, quietly=TRUE)
run_other = all(has_pkg)
other_deps_expr = parse('inst/tests/other.Rraw', n=1L)
eval(other_deps_expr)
other_pkgs = get(as.character(other_deps_expr[[1L]][[2L]]))
# Many will not install on oldest R versions
try(remotes::install_cran(c(other_pkgs, "rcmdcheck"), force=TRUE))
has_other_pkg = sapply(other_pkgs, requireNamespace, quietly=TRUE)
run_other = all(has_other_pkg)
if (!run_other) {
message(sprintf("Skipping other.Rraw since some required packages are not available: %s\n", toString(pkgs[!has_pkg])))
message(sprintf("Skipping other.Rraw since some required packages are not available: %s\n", toString(other_pkgs[!has_other_pkg])))
}
message("Will try and set TEST_DATA_TABLE_WITH_OTHER_PACKAGES=", as.character(run_other), " in R CMD check.")
# IINM rcmdcheck isolates its env from the calling process', besides what's passed to env=
env = c(TEST_DATA_TABLE_WITH_OTHER_PACKAGES=as.character(run_other))
env = c(
TEST_DATA_TABLE_WITH_OTHER_PACKAGES=as.character(run_other),
R_LIBS_USER=Sys.getenv("R_LIBS_USER")
)
do_vignettes = requireNamespace("knitr", quietly=TRUE)
build_args = if (!do_vignettes) "--no-build-vignettes"
build_args = NULL
check_args = c("--no-manual", "--as-cran")
if (!do_vignettes) check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes")
if (!do_vignettes) {
message("Skipping vignettes since knitr is unavailable.")
build_args = "--no-build-vignettes"
check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes")
}
if (requireNamespace("rcmdcheck", quietly=TRUE)) {
rcmdcheck::rcmdcheck(args = check_args, build_args = build_args, error_on = "warning", check_dir = "check", env=env)
} else {
Expand Down
4 changes: 2 additions & 2 deletions inst/tests/other.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ loaded = sapply(pkgs, f)
if (!all(loaded)) {
options(warning.length=8000)
stop(
"test.data.table('other.Rraw') failed to attach required package(s): ", toString(names(loaded)[!loaded]), ".",
"\nHere's all installed packages:\n ", paste(rownames(installed.packages()), collapse=","),
"test.data.table('other.Rraw') failed to attach required package(s): ", toString(sort(names(loaded)[!loaded])), ".",
"\nHere's all installed packages:\n ", paste(sort(rownames(installed.packages())), collapse=","),
"\nHere's the search() path:\n ", paste(search(), collapse="->"),
"\nIf you can't install them and this is R CMD check, please set environment variable TEST_DATA_TABLE_WITH_OTHER_PACKAGES back to the default, false; it's currently ", Sys.getenv("TEST_DATA_TABLE_WITH_OTHER_PACKAGES", "<unset>"), ".")
# Would like to install them now for convenience but gitlab-ci.yml seems to install to bus/mirror-other-packages/cran.
Expand Down

0 comments on commit bae231d

Please sign in to comment.