Skip to content

Commit

Permalink
RC 0.2.3 (#74)
Browse files Browse the repository at this point in the history
* Set the minimum version of the {pak} package to 0.6.0.
Parameterize the sysreqs_platform used to find system dependencies in pkg_sysreqs

* Update NEWS.md

* Update DESCRIPTION

* update news and README

* skip test on r-devel (even on linux...)
  • Loading branch information
VincentGuyader authored Jul 19, 2024
1 parent 5ef486d commit 44919b7
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 37 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dockerfiler
Title: Easy Dockerfile Creation from R
Version: 0.2.2.9003
Version: 0.2.3
Authors@R: c(
person("Colin", "Fay", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0001-7343-1846")),
Expand All @@ -25,12 +25,11 @@ Imports:
glue (>= 1.4.2),
jsonlite (>= 1.7.2),
memoise,
pak (>= 0.2.0),
pak (>= 0.6.0),
pkgbuild (>= 1.2.0),
purrr,
R6 (>= 2.5.0),
remotes (>= 2.2.0),
renv,
usethis (>= 2.0.1),
utils
Suggests:
Expand Down
9 changes: 6 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 0.2.2.xxxx
# dockerfile 0.2.3

- remove sysreqs.r-hub.io to use {pak} instead for system requirement detection
- move from `pak::pkg_system_requirements` to `pak::pkg_sysreqs()` thanks to @B0ydT
- `dock_from_renv` allow to specify user to use in Dockerfile
- the `dependencies` parameter in `dock_from_renv` if set to `TRUE` will install required dependencies plus optional and development dependencies. defaut is `NA` only required (hard) dependencies,
- Set the minimum version of the {pak} package to 0.6.0.
- Parameterize the `sysreqs_platform` used to find system dependencies in pkg_sysreqs (only debian/ubuntu based images are supported)

# dockerfile 0.2.2

# dockerfiler 0.2.2

- fix : create a `use_pak` parameters in `dock_from_renv` to set `renv.config.pak.enabled = FALSE` instead of `renv.config.pak.enabled = TRUE` to avoid issues with {pak} during `renv::restore()`

Expand All @@ -22,7 +25,7 @@
- feat: Added `renv_version` parameter to `dock_from_renv` to be able to fix the renv version to use during `renv::restore()` (@campbead)


# dockerfile 0.2.0
# dockerfiler 0.2.0

- fix: graceful failing in case no internet

Expand Down
9 changes: 3 additions & 6 deletions R/dock_from_renv.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pkg_sysreqs_mem <- memoise::memoise(
#' dependencies,
#' - `FALSE`: do not install any dependencies. (You might end up with a
#' non-working package, and/or the installation might fail.)
#' @param sysreqs_platform System requirements platform.`ubuntu` by default. If `NULL`, then the current platform is used. Can be : "ubuntu-22.04" if needed to fit with the `FROM` Operating System. Only debian or ubuntu based images are supported
#' @importFrom utils getFromNamespace
#' @return A R6 object of class `Dockerfile`.
#' @details
Expand Down Expand Up @@ -67,6 +68,7 @@ dock_from_renv <- function(
use_pak = FALSE,
user = NULL,
dependencies = NA,
sysreqs_platform = "ubuntu",
renv_version
) {
try(dockerfiler::renv$initialize(),silent=TRUE)
Expand Down Expand Up @@ -100,12 +102,7 @@ dock_from_renv <- function(
)


# ici il faut connaire l'image utilisé par l'image.


# distro_args <- list(sysreqs_platform = "ubuntu-22.04")

distro_args <- list(sysreqs_platform = "ubuntu")
distro_args <- list(sysreqs_platform = sysreqs_platform)

install_cmd <- "apt-get install -y"
update_cmd <-"apt-get update -y"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ You’re reading the doc about version :

``` r
desc::desc_get_version()
#> [1] '0.2.2'
#> [1] '0.2.3'
```

The check results are:

``` r
devtools::check(quiet = TRUE)
#> ℹ Loading dockerfiler
#> ── R CMD check results ────────────────────────────────── dockerfiler 0.2.2 ────
#> Duration: 1m 0.6s
#> ── R CMD check results ────────────────────────────────── dockerfiler 0.2.3 ────
#> Duration: 1m 31.3s
#>
#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
```
Expand Down
26 changes: 15 additions & 11 deletions dev/flat_dock_from_renv.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pkg_sysreqs_mem <- memoise::memoise(
#' dependencies,
#' - `FALSE`: do not install any dependencies. (You might end up with a
#' non-working package, and/or the installation might fail.)
#' @param sysreqs_platform System requirements platform.`ubuntu` by default. If `NULL`, then the current platform is used. Can be : "ubuntu-22.04" if needed to fit with the `FROM` Operating System. Only debian or ubuntu based images are supported
#' @importFrom utils getFromNamespace
#' @return A R6 object of class `Dockerfile`.
#' @details
Expand Down Expand Up @@ -106,6 +107,7 @@ dock_from_renv <- function(
use_pak = FALSE,
user = NULL,
dependencies = NA,
sysreqs_platform = "ubuntu",
renv_version
) {
try(dockerfiler::renv$initialize(),silent=TRUE)
Expand Down Expand Up @@ -139,12 +141,7 @@ dock_from_renv <- function(
)
# ici il faut connaire l'image utilisé par l'image.
# distro_args <- list(sysreqs_platform = "ubuntu-22.04")
distro_args <- list(sysreqs_platform = "ubuntu")
distro_args <- list(sysreqs_platform = sysreqs_platform)
install_cmd <- "apt-get install -y"
update_cmd <-"apt-get update -y"
Expand Down Expand Up @@ -330,10 +327,12 @@ writeLines(renv_file, file.path(dir_build, "renv.lock"))
# dock_from_renv ----
test_that("dock_from_renv works", {
# testthat::skip_on_cran()
# skip_if_not(interactive())
# Create Dockerfile
skip_if(is_rdevel, "skip on R-devel")
out <- dock_from_renv(
lockfile = the_lockfile,
FROM = "rocker/verse",
Expand All @@ -346,8 +345,7 @@ test_that("dock_from_renv works", {
out,
"R6"
)
#python3 is not a direct dependencies from custom_packages
expect_false( any(grepl("python3",out$Dockerfile)))
# read Dockerfile
out$write(
Expand All @@ -373,7 +371,10 @@ test_that("dock_from_renv works", {
1
)
skip_if(is_rdevel, "Skip R-devel")
#python3 is not a direct dependencies from custom_packages
expect_false( any(grepl("python3",out$Dockerfile)))
# System dependencies are different when build in interactive environment?
# yes. strange.
skip_if_not(interactive())
Expand Down Expand Up @@ -409,7 +410,7 @@ test_that("dock_from_renv works with full dependencies", {
# testthat::skip_on_cran()
# skip_if_not(interactive())
# Create Dockerfile
skip_if(is_rdevel, "skip on R-devel")
out <- dock_from_renv(
dependencies = TRUE,
lockfile = the_lockfile,
Expand All @@ -423,6 +424,7 @@ test_that("dock_from_renv works with full dependencies", {
out,
"R6"
)
skip_if(is_rdevel, "Skip R-devel")
#python3 is a un-direct dependencies from custom_packages
expect_true( any(grepl("python3",out$Dockerfile)))
})
Expand Down Expand Up @@ -468,6 +470,8 @@ test_that("gen_base_image works", {
test_that("dock_from_renv works with specific renv", {
skip_if(is_rdevel, "skip on R-devel")
# testthat::skip_on_cran()
the_lockfile1.0.0 <- system.file("renv_with_1.0.0.lock",package = "dockerfiler")
Expand Down
3 changes: 3 additions & 0 deletions man/dock_from_renv.Rd

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

3 changes: 3 additions & 0 deletions tests/testthat/setup_cache_dir.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
R_USER_CACHE_DIR<-tempfile()
dir.create(R_USER_CACHE_DIR)
Sys.setenv("R_USER_CACHE_DIR"=R_USER_CACHE_DIR)
r_version <- R.Version()$version.string
is_rdevel <- grepl("unstable", r_version)
# is_debian <- grepl("debian", tolower(Sys.info()['release']))
31 changes: 25 additions & 6 deletions tests/testthat/test-dock_from_desc.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ withr::with_dir(
descdir,
{
test_that("dock_from_desc works", {

skip_if(is_rdevel, "skip on R-devel")

my_dock <- dock_from_desc(file.path(".", "DESCRIPTION__"))

expect_s3_class(my_dock, "R6")
Expand All @@ -57,12 +60,8 @@ withr::with_dir(
tpf
)
)
expect_true(
grepl(
"apt-get update && apt-get install",
tpf
)
)


expect_true(
grepl(
"mkdir /build_zone",
Expand Down Expand Up @@ -92,6 +91,26 @@ withr::with_dir(
# Only if package I guess
# expect_true(file.exists(file.path(descdir, ".Rbuildignore")))
expect_true(file.exists(file.path(descdir, ".dockerignore")))









skip_if(is_rdevel, "Skippé sous R-devel")

expect_true(
grepl(
"apt-get update && apt-get install",
tpf
)
)



})
}
)
17 changes: 12 additions & 5 deletions tests/testthat/test-dock_from_renv.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ writeLines(renv_file, file.path(dir_build, "renv.lock"))

# dock_from_renv ----
test_that("dock_from_renv works", {


# testthat::skip_on_cran()
# skip_if_not(interactive())
# Create Dockerfile

skip_if(is_rdevel, "skip on R-devel")
out <- dock_from_renv(
lockfile = the_lockfile,
FROM = "rocker/verse",
Expand All @@ -52,8 +54,7 @@ test_that("dock_from_renv works", {
out,
"R6"
)
#python3 is not a direct dependencies from custom_packages
expect_false( any(grepl("python3",out$Dockerfile)))


# read Dockerfile
out$write(
Expand All @@ -79,7 +80,10 @@ test_that("dock_from_renv works", {
1
)


skip_if(is_rdevel, "Skip R-devel")
#python3 is not a direct dependencies from custom_packages
expect_false( any(grepl("python3",out$Dockerfile)))

# System dependencies are different when build in interactive environment?
# yes. strange.
skip_if_not(interactive())
Expand Down Expand Up @@ -115,7 +119,7 @@ test_that("dock_from_renv works with full dependencies", {
# testthat::skip_on_cran()
# skip_if_not(interactive())
# Create Dockerfile

skip_if(is_rdevel, "skip on R-devel")
out <- dock_from_renv(
dependencies = TRUE,
lockfile = the_lockfile,
Expand All @@ -129,6 +133,7 @@ test_that("dock_from_renv works with full dependencies", {
out,
"R6"
)
skip_if(is_rdevel, "Skip R-devel")
#python3 is a un-direct dependencies from custom_packages
expect_true( any(grepl("python3",out$Dockerfile)))
})
Expand Down Expand Up @@ -174,6 +179,8 @@ test_that("gen_base_image works", {


test_that("dock_from_renv works with specific renv", {

skip_if(is_rdevel, "skip on R-devel")
# testthat::skip_on_cran()
the_lockfile1.0.0 <- system.file("renv_with_1.0.0.lock",package = "dockerfiler")

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-dockerbuild.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
n_temp <- tempdir()
file.copy("renv.lock", n_temp)
skip_if(is_rdevel, "skip on R-devel")
withr::with_dir(
n_temp,
{
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-get_sysreqs.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("get_sysreqs works", {
skip_on_cran()
skip_if(is_rdevel, "Skip R-devel")
res <- get_sysreqs(
c("mongolite"),
quiet = TRUE
Expand Down

0 comments on commit 44919b7

Please sign in to comment.