[r-package] cut CI-time dependency on craigcitro/r-travis (fixes #4348) (#4353)

* [r-package] cut CI-time dependency on craigcitro/r-travis (fixes #4348)

* Install R

* Install R on OSX

* Remove gfortran symlink

* Specify CRAN repo

* added more R dependencies needed for testing

* removed heavy R dependencies in CI

* fixed bug in env var, removed unnecessary apt installs of R

* fix to R installs
This commit is contained in:
James Lamb 2019-04-12 02:22:48 -05:00 committed by Philip Hyunsu Cho
parent f4521bf6aa
commit edae664afb
2 changed files with 42 additions and 14 deletions

View File

@ -72,6 +72,7 @@ addons:
- graphviz - graphviz
- openssl - openssl
- libgit2 - libgit2
- r
update: true update: true
before_install: before_install:

View File

@ -79,23 +79,50 @@ fi
if [ ${TASK} == "r_test" ]; then if [ ${TASK} == "r_test" ]; then
set -e set -e
export _R_CHECK_TIMINGS_=0
export R_BUILD_ARGS="--no-build-vignettes --no-manual"
export R_CHECK_ARGS="--no-vignettes --no-manual"
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
# Work-around to fix "gfortran command not found" error
sudo ln -s $(which gfortran-7) /usr/local/bin/gfortran
sudo mkdir -p /usr/local/gfortran/lib/gcc/x86_64-apple-darwin15
sudo ln -s /usr/local/lib/gcc/7 /usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
fi
curl -OL https://raw.githubusercontent.com/craigcitro/r-travis/master/scripts/travis-tool.sh
chmod 755 ./travis-tool.sh
./travis-tool.sh bootstrap
make Rpack make Rpack
cd ./xgboost cd ./xgboost
../travis-tool.sh install_deps
../travis-tool.sh run_tests # Install package deps
Rscript -e "install.packages( \
c('devtools', 'testthat', 'lintr') \
, repos = 'http://cloud.r-project.org' \
, dependencies = c('Depends', 'Imports', 'LinkingTo') \
)"
Rscript -e \
"devtools::install_deps( \
repos = 'http://cloud.r-project.org' \
, upgrade = 'never' \
, dependencies = c('Depends', 'Imports', 'LinkingTo') \
)"
# install suggested packages separately to avoid huge build times
Rscript -e "install.packages( \
c('DiagrammeR', 'Ckmeans.1d.dp', 'vcd') \
, repos = 'https://cloud.r-project.org' \
, dependencies = c('Depends', 'Imports', 'LinkingTo') \
)"
# Run tests
echo "Building with R CMD build"
R CMD build \
--no-build-vignettes \
--no-manual \
.
echo "Running R tests"
R_PACKAGE_TARBALL=$(ls -1t *.tar.gz | head -n 1)
export _R_CHECK_TIMINGS_=0
export _R_CHECK_FORCE_SUGGESTS_=false
R CMD check \
${R_PACKAGE_TARBALL} \
--no-vignettes \
--no-manual \
--as-cran \
--install-args=--build
exit 0 exit 0
fi fi