-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add codespace for 3.4.0, maintaining r-devel as default (#103)
* Add codespaces for 3.3.0, 3.6.3, maintaining r-devel as default * Use Jan's image for 3.3.0; abandon 3.6.x for now * 3.3.0 needs repos= set, can't use remotes * Need Depends for bit64 (for now) * More debugging * Actual requirement is 3.4.0 * Try rocker-org again with 3.4.0 * image name? * Try rocker/r-base * Without rocker/ ? * Skip git for now * Try evercran instead * git installs cleanly too * fixes for functional env
- Loading branch information
1 parent
c2a4dcb
commit a230fb2
Showing
8 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"build": { "dockerfile": "Dockerfile", "context": ".."} | ||
"build": { "dockerfile": "r-devel/Dockerfile", "context": ".."} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Minimal testthat masks for R before testthat support so that source(test_script) works | ||
|
||
test_that = function(desc, expr) tryCatch(expr, skip_error = identity) | ||
|
||
skip_if = function(cond, info) { | ||
if (!cond) return(invisible()) | ||
e = simpleError(paste("Skipping:", info)) | ||
class(e) = c("skip_error", class(e)) | ||
stop(e) | ||
} | ||
|
||
skip_if_not_installed = function(pkg) { | ||
skip_if(!requireNamespace(pkg), paste(pkg, "is not installed")) | ||
} | ||
|
||
expect_identical = function(x, y, tolerance = NULL, ignore_attr = NULL) { | ||
if (!is.null(ignore_attr)) { | ||
attributes(x) = attributes(x)[!names(attributes(x)) %in% ignore_attr] | ||
attributes(y) = attributes(y)[!names(attributes(y)) %in% ignore_attr] | ||
} | ||
if (is.null(tolerance)) { | ||
stopifnot(identical(x, y)) | ||
} else { | ||
stopifnot(isTRUE(all.equal(x, y, tolerance=tolerance))) | ||
} | ||
invisible(x) | ||
} | ||
|
||
expect_true = function(x) expect_identical(x, TRUE) | ||
expect_false = function(x) expect_identical(x, FALSE) | ||
|
||
# NB: this doesn't really work like expect_warning does, to be revisited... | ||
expect_warning = function(expr, msg, ...) { | ||
e = new.env() | ||
withCallingHandlers( | ||
warning = function(w) { e$msg = conditionMessage(w); invokeRestart("muffleWarning") }, | ||
expr | ||
) | ||
stopifnot(grepl(msg, e$msg, ...)) | ||
invisible(x) | ||
} | ||
# overwrite by automatically passing these tests for now | ||
expect_warning = function(...) invisible() | ||
|
||
expect_error = function(expr, msg, ...) { | ||
val = tryCatch(expr, error = identity) | ||
stopifnot(inherits(val, "error") && grepl(msg, conditionMessage(val), ...)) | ||
} | ||
|
||
expect_s3_class = function(x, kls) stopifnot(inherits(x, kls)) | ||
expect_length = function(x, l) expect_identical(length(x), l) | ||
|
||
expect_output = function(expr, str, ...) { | ||
act = paste(capture.output(val <- expr), collapse="\n") | ||
stopifnot(grepl(str, act, ...)) | ||
invisible(val) | ||
} | ||
|
||
expect_match = function(x, pattern, ..., all=TRUE) { | ||
agg = if (all) base::all else any | ||
stopifnot(agg(grepl(pattern, x, ...))) | ||
invisible(x) | ||
} | ||
|
||
expect_no_match = function(x, pattern, ...) { | ||
stopifnot(!any(grepl(pattern, x, ...))) | ||
invisible(x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ghcr.io/r-hub/evercran/3.4.0 | ||
|
||
RUN apt-get -qq update && \ | ||
apt-get install -y --no-install-recommends git | ||
|
||
COPY DESCRIPTION . | ||
|
||
RUN Rscript -e ' \ | ||
options(repos = "https://cloud.r-project.org"); \ | ||
dcf = read.dcf("DESCRIPTION", c("Depends", "Imports", "Suggests")); \ | ||
deps = names(tools:::.split_dependencies(dcf)); \ | ||
default_pkgs = tools:::.get_standard_package_names()$base; \ | ||
installable = setdiff(rownames(available.packages()), default_pkgs); \ | ||
message("All deps: ", toString(deps)); \ | ||
deps = intersect(deps, installable); \ | ||
message("Installing: ", toString(deps)); \ | ||
install.packages(deps); \ | ||
' | ||
|
||
# Needed for testthat equivalency on pre-testthat R | ||
WORKDIR /root | ||
COPY .devcontainer/r-340/.Rprofile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"build": { "dockerfile": "Dockerfile", "context": "../.." } | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters