diff --git a/.travis.yml b/.travis.yml index 3da70e438..dc38d6298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,7 @@ addons: - graphviz - openssl - libgit2 + - r update: true before_install: diff --git a/tests/travis/run_test.sh b/tests/travis/run_test.sh index 773452cd4..c30ef0399 100755 --- a/tests/travis/run_test.sh +++ b/tests/travis/run_test.sh @@ -79,23 +79,50 @@ fi if [ ${TASK} == "r_test" ]; then 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 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 fi