From 8b10f38a2b60a7f072b00cd72d6341befb3612f2 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:29:55 +0200 Subject: [PATCH 1/6] update --- .Rbuildignore | 1 + .github/workflows/scheduled.yaml | 19 ++++++++++--------- DESCRIPTION | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 0ce030ac..dc5035ac 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -21,3 +21,4 @@ images ^.revdeprefs\.yaml$ ^revdep$ ^\.covrignore$ +^inst/training_202307$ diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index 32599115..f876439f 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -48,14 +48,15 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} - revdepcheck: - if: > - github.event_name == 'schedule' || ( - github.event_name == 'workflow_dispatch' && - inputs.chosen-workflow == 'revdepcheck' - ) - name: revdepcheck ↩ī¸ - uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main + # disable until the first release + # revdepcheck: + # if: > + # github.event_name == 'schedule' || ( + # github.event_name == 'workflow_dispatch' && + # inputs.chosen-workflow == 'revdepcheck' + # ) + # name: revdepcheck ↩ī¸ + # uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main rhub: if: > github.event_name == 'schedule' || ( @@ -63,4 +64,4 @@ jobs: inputs.chosen-workflow == 'rhub' ) name: R-hub 🌐 - uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main + uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@rhub_skip_quarto diff --git a/DESCRIPTION b/DESCRIPTION index 9d3711d6..e70fe34d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,7 +17,7 @@ Depends: Imports: cli (>= 3.6.0), desc (>= 1.2), - gh, + gh (>= 1.1.0), jsonlite, pkgcache (>= 2.2.2.9000), pkgdepends (>= 0.5.0), From 97fd048a29434c55ea4c5a0bec2d3b4311fffdda Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:43:28 +0200 Subject: [PATCH 2/6] vbump testthat; add utils prefix to avoid R CMD NOTE --- DESCRIPTION | 2 +- R/get_ref.R | 8 ++++---- R/utils.R | 6 +++--- tests/testthat/helper.R | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e70fe34d..1a322f3a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,7 @@ Suggests: knitr (>= 1.42), pingr, rmarkdown (>= 2.23), - testthat (>= 3.0.4) + testthat (>= 3.1.9) Remotes: r-lib/pkgcache Config/Needs/verdepcheck: diff --git a/R/get_ref.R b/R/get_ref.R index f0a91e6f..6f8f0cee 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -527,7 +527,7 @@ get_release_date.remote_ref <- function(remote_ref) { #' verdepcheck:::get_release_data("MultiAssayExperiment") get_release_data <- function(package) { cran_archive <- pkgcache::cran_archive_list(packages = package)[, c("package", "version", "mtime")] - cran_current <- head( + cran_current <- utils::head( pkgcache::meta_cache_list(packages = package)[, c("type", "package", "version", "published")], 1 ) @@ -613,11 +613,11 @@ get_avail_date.remote_ref_cran <- function(remote_ref, start = get_release_date( ppm_url <- get_ppm_snapshot_by_date(date) date <- `if`( grepl("/latest$", ppm_url), - tail(pkgcache::ppm_snapshots(), 1)$date, + utils::tail(pkgcache::ppm_snapshots(), 1)$date, unname(as.Date(sub(".*/", "", ppm_url))) ) if (remote_ref$atleast != "") { - data <- available.packages( + data <- utils::available.packages( repos = ppm_url, filters = list( function(db) { @@ -638,7 +638,7 @@ get_avail_date.remote_ref_cran <- function(remote_ref, start = get_release_date( ) ) } else { - data <- available.packages( + data <- utils::available.packages( repos = ppm_url, filters = list(function(db) db[db[, "Package"] == remote_ref$package, ]) ) diff --git a/R/utils.R b/R/utils.R index 060272e0..26a93db4 100644 --- a/R/utils.R +++ b/R/utils.R @@ -33,11 +33,11 @@ get_ppm_snapshot_by_date <- function(date = NA) { if (is.na(date)) { return(pkgcache::repo_resolve("PPM@latest")) } - if (date >= tail(pkgcache::ppm_snapshots(), 1)$date) { + if (date >= utils::tail(pkgcache::ppm_snapshots(), 1)$date) { return(pkgcache::repo_resolve("PPM@latest")) } - if (date <= head(pkgcache::ppm_snapshots(), 1)$date) { - return(pkgcache::repo_resolve(sprintf("PPM@%s", head(pkgcache::ppm_snapshots(), 1)$date))) + if (date <= utils::head(pkgcache::ppm_snapshots(), 1)$date) { + return(pkgcache::repo_resolve(sprintf("PPM@%s", utils::head(pkgcache::ppm_snapshots(), 1)$date))) } tryCatch( pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))), diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index c64693b3..8e5546fe 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -69,7 +69,7 @@ test_proposal_common <- function(x, # CRAN if (is.null(pkg_gh_str) && is.null(pkg_ver_target)) { pkg_ver_target <- package_version( - available.packages( + utils::available.packages( repos = pkgcache::default_cran_mirror(), filters = list( add = TRUE, function(x) x[x[, "Package"] == pkg_name, ] From 427d5d609c4a1f8e35d8f011530308f78ffa79b9 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:12:29 +0200 Subject: [PATCH 3/6] Apply suggestions from code review Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> --- .github/workflows/scheduled.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index f876439f..1e011971 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -64,4 +64,4 @@ jobs: inputs.chosen-workflow == 'rhub' ) name: R-hub 🌐 - uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@rhub_skip_quarto + uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main From 95b92a8df4d86f7cdd545b5a5b52003f8e226980 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:21:08 +0200 Subject: [PATCH 4/6] use released pkgcache; add rmarkdown to vignettebuilder --- DESCRIPTION | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1a322f3a..a70b7be1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ Imports: desc (>= 1.2), gh (>= 1.1.0), jsonlite, - pkgcache (>= 2.2.2.9000), + pkgcache (>= 2.2.3), pkgdepends (>= 0.5.0), rcmdcheck, remotes (>= 2.2.0), @@ -32,8 +32,6 @@ Suggests: pingr, rmarkdown (>= 2.23), testthat (>= 3.1.9) -Remotes: - r-lib/pkgcache Config/Needs/verdepcheck: r-lib/cli, r-lib/desc, @@ -48,7 +46,8 @@ Config/Needs/verdepcheck: r-lib/pingr, r-lib/testthat VignetteBuilder: - knitr + knitr, + rmarkdown Encoding: UTF-8 Language: en-US LazyData: true From fc3de9159d72b2e9735e4dcf357d180c1d3be3db Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:35:27 +0200 Subject: [PATCH 5/6] use MultiAssayExperiment instead of SummarizedExperiment --- .../test-deps_installation_proposal.R | 38 ++++++++++++++----- tests/testthat/test-get_ref.R | 2 +- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/tests/testthat/test-deps_installation_proposal.R b/tests/testthat/test-deps_installation_proposal.R index 1ea9fe3a..85ea5471 100644 --- a/tests/testthat/test-deps_installation_proposal.R +++ b/tests/testthat/test-deps_installation_proposal.R @@ -288,20 +288,26 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles Bioc pack skip_if_offline() skip_if_empty_gh_token() - d_std_path <- local_description(list(SummarizedExperiment = "Import")) + d_std_path <- local_description( + list(MultiAssayExperiment = "Import"), + need_verdepcheck = c("bioc::MultiAssayExperiment") + ) x <- new_min_cohort_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common_bioc(x, "SummarizedExperiment") + test_proposal_common_bioc(x, "MultiAssayExperiment") }) test_that("new_min_isolated_deps_installation_proposal correctly handles Bioc package", { skip_if_offline() skip_if_empty_gh_token() - d_std_path <- local_description(list(SummarizedExperiment = "Import")) + d_std_path <- local_description( + list(MultiAssayExperiment = "Import"), + need_verdepcheck = c("bioc::MultiAssayExperiment") + ) x <- new_min_isolated_deps_installation_proposal(d_std_path) @@ -310,7 +316,7 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles Bioc pa # https://github.com/r-lib/pkgdepends/issues/365 withr::with_options( opts_partial_match_old, - test_proposal_common_bioc(x, "SummarizedExperiment") + test_proposal_common_bioc(x, "MultiAssayExperiment") ) }) @@ -318,26 +324,32 @@ test_that("new_release_deps_installation_proposal correctly handles Bioc package skip_if_offline() skip_if_empty_gh_token() - d_std_path <- local_description(list(SummarizedExperiment = "Import")) + d_std_path <- local_description( + list(MultiAssayExperiment = "Import"), + need_verdepcheck = c("bioc::MultiAssayExperiment") + ) x <- new_release_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common_bioc(x, "SummarizedExperiment") + test_proposal_common_bioc(x, "MultiAssayExperiment") }) test_that("new_max_deps_installation_proposal correctly handles Bioc package", { skip_if_offline() skip_if_empty_gh_token() - d_std_path <- local_description(list(SummarizedExperiment = "Import")) + d_std_path <- local_description( + list(MultiAssayExperiment = "Import"), + need_verdepcheck = c("bioc::MultiAssayExperiment") + ) x <- new_max_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common_bioc(x, "SummarizedExperiment") + test_proposal_common_bioc(x, "MultiAssayExperiment") }) # ################################################################ @@ -345,7 +357,10 @@ test_that("new_max_deps_installation_proposal correctly handles Bioc package", { test_that("indirect dependencies in the config field - ignore on default", { skip_if_offline() - d_std_path <- local_description(list(dplyr = "Import"), need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang")) + d_std_path <- local_description( + list(dplyr = "Import"), + need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang") + ) x <- new_max_deps_installation_proposal(d_std_path) @@ -358,7 +373,10 @@ test_that("indirect dependencies in the config field - ignore on default", { test_that("indirect dependencies in the config field - include on match with `extra_deps`", { skip_if_offline() - d_std_path <- local_description(list(dplyr = "Import"), need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang")) + d_std_path <- local_description( + list(dplyr = "Import"), + need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang") + ) x <- new_max_deps_installation_proposal(d_std_path, extra_deps = "rlang") diff --git a/tests/testthat/test-get_ref.R b/tests/testthat/test-get_ref.R index 526fc6ba..71c00adb 100644 --- a/tests/testthat/test-get_ref.R +++ b/tests/testthat/test-get_ref.R @@ -68,7 +68,7 @@ test_that("get_release_date with any class other than remote_ref.{github,cran,st test_that("get_release_data returns date for Bioconductor", { skip_if_offline() - expect_false(any(is.na(get_release_data("SummarizedExperiment")$mtime))) + expect_false(any(is.na(get_release_data("MultiAssayExperiment")$mtime))) }) test_that("get_ref_release returns a CRAN remote_reference if package exists", { From d53d77ced59e7799553a8cbf2988a54ee6aff493 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:22:29 +0200 Subject: [PATCH 6/6] rewrite test --- tests/testthat/test-get_ref.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-get_ref.R b/tests/testthat/test-get_ref.R index 71c00adb..c1e3a824 100644 --- a/tests/testthat/test-get_ref.R +++ b/tests/testthat/test-get_ref.R @@ -68,7 +68,9 @@ test_that("get_release_date with any class other than remote_ref.{github,cran,st test_that("get_release_data returns date for Bioconductor", { skip_if_offline() - expect_false(any(is.na(get_release_data("MultiAssayExperiment")$mtime))) + result <- get_release_data("MultiAssayExperiment")$mtime + expect_length(result, 1) + expect_s3_class(result, "POSIXct") }) test_that("get_ref_release returns a CRAN remote_reference if package exists", {