[R] AppVeyor CI for R package (#2954)
* [R] fix finding R.exe with cmake on WIN when it is in PATH * [R] appveyor config for R package * [R] wrap the lines to make R check happier * [R] install only binary dep-packages in appveyor * [R] for MSVC appveyor, also build a binary for R package and keep as an artifact
This commit is contained in:
parent
4fa917b19f
commit
76f8f51438
@ -93,9 +93,12 @@
|
|||||||
#' objective = "multi:softprob", num_class = nclass, verbose = 0)
|
#' objective = "multi:softprob", num_class = nclass, verbose = 0)
|
||||||
#' trees0 <- seq(from=0, by=nclass, length.out=nrounds)
|
#' trees0 <- seq(from=0, by=nclass, length.out=nrounds)
|
||||||
#' col <- rgb(0, 0, 1, 0.5)
|
#' col <- rgb(0, 0, 1, 0.5)
|
||||||
#' xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
#' xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4,
|
||||||
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4,
|
||||||
|
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
|
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4,
|
||||||
|
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
#'
|
#'
|
||||||
#' @rdname xgb.plot.shap
|
#' @rdname xgb.plot.shap
|
||||||
#' @export
|
#' @export
|
||||||
|
|||||||
@ -123,9 +123,12 @@ mbst <- xgboost(data = x, label = as.numeric(iris$Species) - 1, nrounds = nround
|
|||||||
objective = "multi:softprob", num_class = nclass, verbose = 0)
|
objective = "multi:softprob", num_class = nclass, verbose = 0)
|
||||||
trees0 <- seq(from=0, by=nclass, length.out=nrounds)
|
trees0 <- seq(from=0, by=nclass, length.out=nrounds)
|
||||||
col <- rgb(0, 0, 1, 0.5)
|
col <- rgb(0, 0, 1, 0.5)
|
||||||
xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4,
|
||||||
xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4, n_col = 2, col = col, pch = 16, pch_NA = 17)
|
xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4,
|
||||||
|
n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
|
xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4,
|
||||||
|
n_col = 2, col = col, pch = 16, pch_NA = 17)
|
||||||
|
|
||||||
}
|
}
|
||||||
\references{
|
\references{
|
||||||
|
|||||||
64
appveyor.yml
64
appveyor.yml
@ -1,4 +1,6 @@
|
|||||||
environment:
|
environment:
|
||||||
|
R_ARCH: x64
|
||||||
|
USE_RTOOLS: true
|
||||||
matrix:
|
matrix:
|
||||||
- target: msvc
|
- target: msvc
|
||||||
ver: 2013
|
ver: 2013
|
||||||
@ -15,6 +17,15 @@ environment:
|
|||||||
- target: mingw
|
- target: mingw
|
||||||
generator: "Unix Makefiles"
|
generator: "Unix Makefiles"
|
||||||
- target: jvm
|
- target: jvm
|
||||||
|
- target: rmsvc
|
||||||
|
ver: 2015
|
||||||
|
generator: "Visual Studio 14 2015 Win64"
|
||||||
|
configuration: Release
|
||||||
|
- target: rmingw
|
||||||
|
generator: "Unix Makefiles"
|
||||||
|
|
||||||
|
#matrix:
|
||||||
|
# fast_finish: true
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x64
|
- x64
|
||||||
@ -34,6 +45,16 @@ install:
|
|||||||
- if /i "%target%" == "mingw" set DO_PYTHON=on
|
- if /i "%target%" == "mingw" set DO_PYTHON=on
|
||||||
- if /i "%target%_%ver%_%configuration%" == "msvc_2015_Release" set DO_PYTHON=on
|
- if /i "%target%_%ver%_%configuration%" == "msvc_2015_Release" set DO_PYTHON=on
|
||||||
- if /i "%DO_PYTHON%" == "on" conda install -y numpy scipy pandas matplotlib nose scikit-learn graphviz python-graphviz
|
- if /i "%DO_PYTHON%" == "on" conda install -y numpy scipy pandas matplotlib nose scikit-learn graphviz python-graphviz
|
||||||
|
# R: based on https://github.com/krlmlr/r-appveyor
|
||||||
|
- ps: |
|
||||||
|
if($env:target -eq 'rmingw' -or $env:target -eq 'rmsvc') {
|
||||||
|
#$ErrorActionPreference = "Stop"
|
||||||
|
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "$Env:TEMP\appveyor-tool.ps1"
|
||||||
|
Import-Module "$Env:TEMP\appveyor-tool.ps1"
|
||||||
|
Bootstrap
|
||||||
|
$DEPS = "c('data.table','magrittr','stringi','ggplot2','DiagrammeR','Ckmeans.1d.dp','vcd','testthat','igraph','knitr','rmarkdown')"
|
||||||
|
cmd /c "R.exe -q -e ""install.packages($DEPS, repos='$CRAN', type='win.binary')"" 2>&1"
|
||||||
|
}
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
@ -49,12 +70,55 @@ build_script:
|
|||||||
cmake .. -G"%generator%" &&
|
cmake .. -G"%generator%" &&
|
||||||
make -j2
|
make -j2
|
||||||
)
|
)
|
||||||
|
# Python package
|
||||||
- if /i "%DO_PYTHON%" == "on" (
|
- if /i "%DO_PYTHON%" == "on" (
|
||||||
cd %APPVEYOR_BUILD_FOLDER%\python-package &&
|
cd %APPVEYOR_BUILD_FOLDER%\python-package &&
|
||||||
python setup.py install
|
python setup.py install
|
||||||
)
|
)
|
||||||
|
# R package: make + mingw standard CRAN packaging (only x64 for now)
|
||||||
|
- if /i "%target%" == "rmingw" (
|
||||||
|
make Rbuild &&
|
||||||
|
ls -l &&
|
||||||
|
R.exe CMD INSTALL --no-multiarch xgboost*.tar.gz
|
||||||
|
)
|
||||||
|
# R package: cmake + VC2015
|
||||||
|
- if /i "%target%" == "rmsvc" (
|
||||||
|
mkdir build_rmsvc%ver% &&
|
||||||
|
cd build_rmsvc%ver% &&
|
||||||
|
cmake .. -G"%generator%" -DCMAKE_CONFIGURATION_TYPES="Release" -DR_LIB=ON &&
|
||||||
|
cmake --build . --target install --config Release
|
||||||
|
)
|
||||||
- if /i "%target%" == "jvm" cd jvm-packages && mvn test -pl :xgboost4j
|
- if /i "%target%" == "jvm" cd jvm-packages && mvn test -pl :xgboost4j
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
- if /i "%DO_PYTHON%" == "on" python -m nose tests/python
|
- if /i "%DO_PYTHON%" == "on" python -m nose tests/python
|
||||||
|
# mingw R package: run the R check (which includes unit tests), and also keep the built binary package
|
||||||
|
- if /i "%target%" == "rmingw" (
|
||||||
|
set _R_CHECK_CRAN_INCOMING_=FALSE&&
|
||||||
|
R.exe CMD check xgboost*.tar.gz --no-manual --no-build-vignettes --as-cran --install-args=--build --no-multiarch
|
||||||
|
)
|
||||||
|
# MSVC R package: run only the unit tests
|
||||||
|
# TODO: create a binary msvc-built package to keep as an artifact
|
||||||
|
- if /i "%target%" == "rmsvc" (
|
||||||
|
cd build_rmsvc%ver%\R-package &&
|
||||||
|
R.exe -q -e "library(testthat); setwd('tests'); source('testthat.R')"
|
||||||
|
)
|
||||||
|
|
||||||
|
on_failure:
|
||||||
|
# keep the whole output of R check
|
||||||
|
- if /i "%target%" == "rmingw" (
|
||||||
|
7z a failure.zip *.Rcheck\* &&
|
||||||
|
appveyor PushArtifact failure.zip
|
||||||
|
)
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
# log from R check
|
||||||
|
- path: '*.Rcheck\**\*.log'
|
||||||
|
name: Logs
|
||||||
|
# source R-package
|
||||||
|
- path: '\xgboost_*.tar.gz'
|
||||||
|
name: Bits
|
||||||
|
# binary R-package
|
||||||
|
- path: '**\xgboost_*.zip'
|
||||||
|
name: Bits
|
||||||
|
|||||||
@ -82,5 +82,5 @@ function(setup_rpackage_install_target rlib_target build_dir)
|
|||||||
if(length(deps)>0) install.packages(deps, repo = 'https://cloud.r-project.org/')")
|
if(length(deps)>0) install.packages(deps, repo = 'https://cloud.r-project.org/')")
|
||||||
install(CODE "execute_process(COMMAND \"${LIBR_EXECUTABLE}\" \"-q\" \"-e\" \"${XGB_DEPS_SCRIPT}\")")
|
install(CODE "execute_process(COMMAND \"${LIBR_EXECUTABLE}\" \"-q\" \"-e\" \"${XGB_DEPS_SCRIPT}\")")
|
||||||
install(CODE "execute_process(COMMAND \"${LIBR_EXECUTABLE}\" CMD INSTALL\
|
install(CODE "execute_process(COMMAND \"${LIBR_EXECUTABLE}\" CMD INSTALL\
|
||||||
\"--no-multiarch\" \"${build_dir}/R-package\")")
|
\"--no-multiarch\" \"--build\" \"${build_dir}/R-package\")")
|
||||||
endfunction(setup_rpackage_install_target)
|
endfunction(setup_rpackage_install_target)
|
||||||
|
|||||||
@ -86,7 +86,7 @@ else()
|
|||||||
|
|
||||||
# attempt to find R executable
|
# attempt to find R executable
|
||||||
if(NOT LIBR_EXECUTABLE)
|
if(NOT LIBR_EXECUTABLE)
|
||||||
find_program(LIBR_EXECUTABLE R)
|
find_program(LIBR_EXECUTABLE NAMES R R.exe)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@ -117,7 +117,7 @@ else()
|
|||||||
# ask R for R_HOME
|
# ask R for R_HOME
|
||||||
if(LIBR_EXECUTABLE)
|
if(LIBR_EXECUTABLE)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${LIBR_EXECUTABLE} "--slave" "--no-save" "-e" "cat(normalizePath(R.home(), winslash='/')"
|
COMMAND ${LIBR_EXECUTABLE} "--slave" "--no-save" "-e" "cat(normalizePath(R.home(), winslash='/'))"
|
||||||
OUTPUT_VARIABLE LIBR_HOME)
|
OUTPUT_VARIABLE LIBR_HOME)
|
||||||
endif()
|
endif()
|
||||||
# if R executable not available, query R_HOME path from registry
|
# if R executable not available, query R_HOME path from registry
|
||||||
@ -138,6 +138,12 @@ else()
|
|||||||
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include")
|
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include")
|
||||||
set(LIBR_LIB_DIR "${LIBR_HOME}/bin/${R_ARCH}")
|
set(LIBR_LIB_DIR "${LIBR_HOME}/bin/${R_ARCH}")
|
||||||
|
|
||||||
|
message(STATUS "LIBR_HOME [${LIBR_HOME}]")
|
||||||
|
message(STATUS "LIBR_EXECUTABLE [${LIBR_EXECUTABLE}]")
|
||||||
|
message(STATUS "LIBR_INCLUDE_DIRS [${LIBR_INCLUDE_DIRS}]")
|
||||||
|
message(STATUS "LIBR_LIB_DIR [${LIBR_LIB_DIR}]")
|
||||||
|
message(STATUS "LIBR_CORE_LIBRARY [${LIBR_CORE_LIBRARY}]")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user