Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] fall back to source installs of R packages if binary missing (fixes #3875) #3876

Merged
merged 6 commits into from
Jan 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ if [[ $OS_NAME == "macos" ]]; then
fi
fi

# hack to fix https://github.com/microsoft/LightGBM/pull/3876#issuecomment-769187766
if [[ $OS_NAME == "macos" ]]; then
Rscript --vanilla -e "install.packages('withr', repos = '${CRAN_MIRROR}', type = 'source', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))"
fi

# Manually install Depends and Imports libraries + 'testthat'
# to avoid a CI-time dependency on devtools (for devtools::install_deps())
packages="c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat')"
if [[ $OS_NAME == "macos" ]]; then
packages+=", type = 'binary'"
packages+=", type = 'both'"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a reminder, this flag cannot be used on Linux, and that's why it's in this if.

From inside a rocker/verse container:

> install.packages("jsonlite", type = "both")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error in install.packages("jsonlite", type = "both") : 
  type == "both" can only be used on Windows or a CRAN build for macOS

fi
Rscript --vanilla -e "install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1
Rscript --vanilla -e "options(install.packages.compile.from.source = 'both'); install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1

cd ${BUILD_DIRECTORY}

Expand Down