Unverified Commit dbc3d05c authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] [ci] Add option to skip installation in build_r.R (#2957)


Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent e6de39a7
...@@ -69,10 +69,10 @@ packages="c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat')" ...@@ -69,10 +69,10 @@ packages="c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat')"
if [[ $OS_NAME == "macos" ]]; then if [[ $OS_NAME == "macos" ]]; then
packages+=", type = 'binary'" packages+=", type = 'binary'"
fi fi
Rscript --vanilla -e "install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}')" || exit -1 Rscript --vanilla -e "install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1
cd ${BUILD_DIRECTORY} cd ${BUILD_DIRECTORY}
Rscript build_r.R || exit -1 Rscript build_r.R --skip-install || exit -1
PKG_TARBALL="lightgbm_${LGB_VER}.tar.gz" PKG_TARBALL="lightgbm_${LGB_VER}.tar.gz"
LOG_FILE_NAME="lightgbm.Rcheck/00check.log" LOG_FILE_NAME="lightgbm.Rcheck/00check.log"
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
# Sys.setenv("CXX" = "/usr/local/bin/g++-8") # Sys.setenv("CXX" = "/usr/local/bin/g++-8")
# Sys.setenv("CC" = "/usr/local/bin/gcc-8") # Sys.setenv("CC" = "/usr/local/bin/gcc-8")
args <- commandArgs(trailingOnly = TRUE)
INSTALL_AFTER_BUILD <- !("--skip-install" %in% args)
# R returns FALSE (not a non-zero exit code) if a file copy operation # R returns FALSE (not a non-zero exit code) if a file copy operation
# breaks. Let's fix that # breaks. Let's fix that
.handle_result <- function(res) { .handle_result <- function(res) {
...@@ -86,4 +89,8 @@ version <- gsub( ...@@ -86,4 +89,8 @@ version <- gsub(
tarball <- file.path(getwd(), sprintf("lightgbm_%s.tar.gz", version)) tarball <- file.path(getwd(), sprintf("lightgbm_%s.tar.gz", version))
cmd <- sprintf("R CMD INSTALL %s --no-multiarch --with-keep.source", tarball) cmd <- sprintf("R CMD INSTALL %s --no-multiarch --with-keep.source", tarball)
.run_shell_command(cmd) if (INSTALL_AFTER_BUILD) {
.run_shell_command(cmd)
} else {
print(sprintf("Skipping installation. Install the package with command '%s'", cmd))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment