-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
157 additions
and
80 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
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 was deleted.
Oops, something went wrong.
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,24 @@ | ||
name: "Actions to read a matrix with all suggested packages, computed with the dep-suggests-matrix action" | ||
outputs: | ||
matrix: | ||
description: "Generated matrix" | ||
value: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install json2yaml | ||
run: | | ||
sudo npm install -g json2yaml | ||
shell: bash | ||
|
||
- id: set-matrix | ||
run: | | ||
# Empty contents if no suggested packages | ||
matrix=$(cat .github/dep-suggests-matrix.json || true) | ||
if [ -n "$matrix" ]; then | ||
echo $matrix | jq . | ||
echo $matrix | json2yaml | ||
fi | ||
echo "matrix=$matrix" | tee -a $GITHUB_OUTPUT | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# FIXME: Dynamic lookup by parsing https://svn.r-project.org/R/tags/ | ||
get_deps <- function() { | ||
# Determine package dependencies | ||
if (!requireNamespace("desc", quietly = TRUE)) { | ||
install.packages("desc") | ||
} | ||
|
||
deps_df <- desc::desc_get_deps() | ||
deps_df_optional <- deps_df$package[deps_df$type %in% c("Suggests", "Enhances")] | ||
deps_df_hard <- deps_df$package[deps_df$type %in% c("Depends", "Imports", "LinkingTo")] | ||
deps_df_base <- unlist(tools::standard_package_names(), use.names = FALSE) | ||
|
||
packages <- sort(deps_df_optional) | ||
packages <- intersect(packages, rownames(available.packages())) | ||
|
||
# Too big to fail, or can't be avoided: | ||
off_limits <- c("testthat", "rmarkdown", "rcmdcheck", deps_df_hard, deps_df_base) | ||
off_limits_dep <- unlist(tools::package_dependencies(off_limits, recursive = TRUE, which = "strong")) | ||
setdiff(packages, c(off_limits, off_limits_dep)) | ||
} | ||
|
||
if (Sys.getenv("GITHUB_BASE_REF") != "") { | ||
print(Sys.getenv("GITHUB_BASE_REF")) | ||
has_diff <- (system("git diff ${{ github.event.pull_request.base.sha }}... | egrep '^[+][^+]' | grep -q ::") == 0) | ||
if (has_diff) { | ||
system("git diff ${{ github.event.pull_request.base.sha }}... | egrep '^[+][^+]' | grep -q ::") | ||
packages <- get_deps() | ||
} else { | ||
writeLines("No changes using :: found, not checking without suggested packages") | ||
packages <- character() | ||
} | ||
} else { | ||
packages <- get_deps() | ||
} | ||
|
||
if (length(packages) > 0) { | ||
json <- paste0( | ||
'{"package":[', | ||
paste0('"', packages, '"', collapse = ","), | ||
']}' | ||
) | ||
} else { | ||
json <- character() | ||
} | ||
|
||
writeLines(json, ".github/dep-suggests-matrix.json") | ||
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 suggested packages" | ||
outputs: | ||
matrix: | ||
description: "Generated matrix" | ||
value: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: set-matrix | ||
run: | | ||
Rscript ./.github/workflows/dep-suggests-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