-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renovate, check without suggested packages, parallel and ccache
- Loading branch information
Showing
9 changed files
with
292 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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: | | ||
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")] | ||
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) | ||
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 = ","), | ||
']}' | ||
) | ||
writeLines(json) | ||
writeLines(paste0("matrix=", json), Sys.getenv("GITHUB_OUTPUT")) | ||
} else { | ||
writeLines("Package list empty!") | ||
} | ||
shell: Rscript {0} |
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 |
---|---|---|
|
@@ -83,3 +83,31 @@ runs: | |
sudo ln -s $(which true) /usr/local/bin/qpdf | ||
sudo ln -s $(which true) /usr/local/bin/checkbashisms | ||
shell: bash | ||
|
||
- name: Install ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
max-size: 10G | ||
verbose: 1 | ||
save: false | ||
restore: false | ||
|
||
- name: Use ccache for compiling R code, and parallelize | ||
run: | | ||
mkdir -p ~/.R | ||
echo 'CC := ccache $(CC)' >> ~/.R/Makevars | ||
echo 'CXX := ccache $(CXX)' >> ~/.R/Makevars | ||
echo 'CXX11 := ccache $(CXX11)' >> ~/.R/Makevars | ||
echo 'CXX14 := ccache $(CXX14)' >> ~/.R/Makevars | ||
echo 'CXX17 := ccache $(CXX17)' >> ~/.R/Makevars | ||
echo 'MAKEFLAGS = -j2' >> ~/.R/Makevars | ||
cat ~/.R/Makevars | ||
echo 'CCACHE_SLOPPINESS=locale,time_macros' | tee -a $GITHUB_ENV | ||
# echo 'CCACHE_DEBUG=true' | tee -a $GITHUB_ENV | ||
# echo "CCACHE_DEBUGDIR=$(dirname $(pwd))/ccache-debug" | tee -a $GITHUB_ENV | ||
# mkdir -p $(dirname $(pwd))/.ccache-debug | ||
echo 'PKG_BUILD_EXTRA_FLAGS=false' | tee -a $GITHUB_ENV | ||
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.