-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from krlmlr/f-gha-dynamic
- Loading branch information
Showing
6 changed files
with
120 additions
and
368 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
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,57 @@ | ||
# - {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")) | ||
} | ||
writeLines(json) |
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,13 @@ | ||
name: "Actions to compute a matrix with all R and OS versions" | ||
outputs: | ||
matrix: | ||
description: "Generated matrix" | ||
value: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: set-matrix | ||
run: | | ||
Rscript ./.github/workflows/versions-matrix/action.R | ||
shell: bash |
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
Oops, something went wrong.