Skip to content
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

Fix scheduled #59

Merged
merged 6 commits into from
Oct 14, 2024
Merged
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 .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ images
^.revdeprefs\.yaml$
^revdep$
^\.covrignore$
^inst/training_202307$
17 changes: 9 additions & 8 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' || (
Expand Down
11 changes: 5 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Depends:
Imports:
cli (>= 3.6.0),
desc (>= 1.2),
gh,
gh (>= 1.1.0),
jsonlite,
pkgcache (>= 2.2.2.9000),
pkgcache (>= 2.2.3),
pkgdepends (>= 0.5.0),
rcmdcheck,
remotes (>= 2.2.0),
Expand All @@ -31,9 +31,7 @@ Suggests:
knitr (>= 1.42),
pingr,
rmarkdown (>= 2.23),
testthat (>= 3.0.4)
Remotes:
r-lib/pkgcache
testthat (>= 3.1.9)
Config/Needs/verdepcheck:
r-lib/cli,
r-lib/desc,
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions R/get_ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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) {
Expand All @@ -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, ])
)
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))),
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ]
Expand Down
38 changes: 28 additions & 10 deletions tests/testthat/test-deps_installation_proposal.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -310,42 +316,51 @@ 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")
)
})

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")
})

# ################################################################

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)

Expand All @@ -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")

Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-get_ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -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("SummarizedExperiment")$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", {
Expand Down
Loading