"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "5b675461e704e8d550cfe48dff7463e407d3e185"
Unverified Commit 08ccd4a3 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] allow use of custom R executable when building CRAN package (#4754)



* [R-package] allow use of custom R executable building CRAN package

* Update build-cran-package.sh
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent dac0dffe
#!/bin/bash #!/bin/bash
RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" || exit -1 RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" || exit -1
sh build-cran-package.sh || exit -1 sh build-cran-package.sh \
--r-executable=RDvalgrind \
|| exit -1
RDvalgrind CMD INSTALL --preclean --install-tests lightgbm_*.tar.gz || exit -1 RDvalgrind CMD INSTALL --preclean --install-tests lightgbm_*.tar.gz || exit -1
cd R-package/tests cd R-package/tests
......
...@@ -195,7 +195,7 @@ jobs: ...@@ -195,7 +195,7 @@ jobs:
shell: bash shell: bash
run: | run: |
RDscript${{ matrix.r_customization }} -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" RDscript${{ matrix.r_customization }} -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())"
sh build-cran-package.sh sh build-cran-package.sh --r-executable=RD${{ matrix.r_customization }}
RD${{ matrix.r_customization }} CMD INSTALL lightgbm_*.tar.gz || exit -1 RD${{ matrix.r_customization }} CMD INSTALL lightgbm_*.tar.gz || exit -1
- name: Run tests with sanitizers - name: Run tests with sanitizers
shell: bash shell: bash
......
...@@ -394,7 +394,7 @@ RDscript${R_CUSTOMIZATION} \ ...@@ -394,7 +394,7 @@ RDscript${R_CUSTOMIZATION} \
-e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())"
# install lightgbm # install lightgbm
sh build-cran-package.sh sh build-cran-package.sh --r-executable=RD${R_CUSTOMIZATION}
RD${R_CUSTOMIZATION} \ RD${R_CUSTOMIZATION} \
CMD INSTALL lightgbm_*.tar.gz CMD INSTALL lightgbm_*.tar.gz
...@@ -423,7 +423,8 @@ docker run \ ...@@ -423,7 +423,8 @@ docker run \
RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())"
sh build-cran-package.sh sh build-cran-package.sh \
--r-executable=RDvalgrind
RDvalgrind CMD INSTALL \ RDvalgrind CMD INSTALL \
--preclean \ --preclean \
......
...@@ -4,11 +4,40 @@ ...@@ -4,11 +4,40 @@
# Prepare a source distribution of the R package # Prepare a source distribution of the R package
# to be submitted to CRAN. # to be submitted to CRAN.
# #
# [arguments]
#
# --r-executable Customize the R executable used by `R CMD build`.
# Useful if building the R package in an environment with
# non-standard builds of R, such as those provided in
# https://github.com/wch/r-debug.
#
# [usage] # [usage]
#
# # default usage
# sh build-cran-package.sh # sh build-cran-package.sh
#
# # custom R build
# sh build-cran-package.sh --r-executable=RDvalgrind
set -e set -e
LGB_R_EXECUTABLE=R
while [ $# -gt 0 ]; do
case "$1" in
--r-executable=*)
LGB_R_EXECUTABLE="${1#*=}"
;;
*)
echo "invalid argument '${1}'"
exit -1
;;
esac
shift
done
echo "Building lightgbm with R executable: ${LGB_R_EXECUTABLE}"
ORIG_WD="$(pwd)" ORIG_WD="$(pwd)"
TEMP_R_DIR="$(pwd)/lightgbm_r" TEMP_R_DIR="$(pwd)/lightgbm_r"
...@@ -140,7 +169,7 @@ cd "${TEMP_R_DIR}" ...@@ -140,7 +169,7 @@ cd "${TEMP_R_DIR}"
cd "${ORIG_WD}" cd "${ORIG_WD}"
R CMD build \ "${LGB_R_EXECUTABLE}" CMD build \
--keep-empty-dirs \ --keep-empty-dirs \
lightgbm_r lightgbm_r
......
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