diff --git a/.github/workflows/versions-matrix/action.R b/.github/workflows/versions-matrix/action.R index 2283637..b2b94c9 100644 --- a/.github/workflows/versions-matrix/action.R +++ b/.github/workflows/versions-matrix/action.R @@ -1,4 +1,56 @@ -json <- '{"include":[{"os": "macos-latest", "r": "release"}, {"os": "ubuntu-20.04", "r": "release"}, {"os": "ubuntu-22.04", "r": "devel", "http-user-agent": "release"}]}' +# - {os: macos-latest, r: 'release'} +# +# - {os: ubuntu-20.04, r: 'release'} +# +# # Use older ubuntu to maximise backward compatibility +# - {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'} +# - {os: ubuntu-22.04, r: 'release', covr: true, desc: 'with covr'} +# - {os: ubuntu-22.04, r: 'oldrel-1'} +# +# # Begin custom: R 3.6 +# - {os: ubuntu-22.04, r: 'oldrel-2'} +# # End custom: R 3.6 +# +# # Begin custom: R 3.5 +# - {os: ubuntu-22.04, r: 'oldrel-3'} +# # End custom: R 3.5 +# +# # Begin custom: R 3.4 +# - {os: ubuntu-22.04, r: 'oldrel-4'} +# # End custom: R 3.4 + +# FIXME: Dynamic lookup by parsing https://svn.r-project.org/R/tags/ +r_versions <- c("devel", paste0("4.", 4:0)) +macos <- data.frame(os = "macos-latest", r = r_versions[2:3]) +windows <- data.frame(os = "windows-latest", r = r_versions[1:3]) +linux_devel <- data.frame(os = "ubuntu-22.04", r = r_versions[1], `http-user-agent` = "release", check.names = FALSE) +linux <- data.frame(os = "ubuntu-22.04", r = r_versions[-1]) +covr <- data.frame(os = "ubuntu-22.04", r = r_versions[2], covr = "true", desc = "with covr") + +include_list <- list(macos, windows, linux_devel, linux, covr) +print(include_list) + +filter <- read.dcf("DESCRIPTION")[1,]["Config/gha/filter"] +if (!is.na(filter)) { + filter_expr <- parse(text = filter)[[1]] + subset_fun_expr <- bquote(function(x) subset(x, .(filter_expr))) + subset_fun <- eval(subset_fun_expr) + include_list <- lapply(include_list, subset_fun) + print(include_list) +} + +to_json <- function(x) { + if (nrow(x) == 0) return(character()) + parallel <- vector("list", length(x)) + for (i in seq_along(x)) { + parallel[[i]] <- paste0('"', names(x)[[i]], '":"', x[[i]], '"') + } + paste0("{", do.call(paste, c(parallel, sep = ",")), "}") +} + +configs <- unlist(lapply(include_list, to_json)) +json <- paste0('{"include":[', paste(configs, collapse = ","), ']}') + if (Sys.getenv("GITHUB_OUTPUT") != "") { writeLines(paste0("matrix=", json), Sys.getenv("GITHUB_OUTPUT")) } diff --git a/DESCRIPTION b/DESCRIPTION index 658de92..8dec641 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,3 +29,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 +Config/gha/filter: os != "windows-latest"