refactor and ci
This commit is contained in:
parent
59b91cf205
commit
af0a451dc4
1
.gitignore
vendored
1
.gitignore
vendored
@ -66,3 +66,4 @@ java/xgboost4j-demo/data/
|
||||
java/xgboost4j-demo/tmp/
|
||||
java/xgboost4j-demo/model/
|
||||
nb-configuration*
|
||||
dmlc-core
|
||||
|
||||
61
.travis.yml
61
.travis.yml
@ -1,36 +1,45 @@
|
||||
language: c
|
||||
|
||||
env:
|
||||
global:
|
||||
- _R_CHECK_TIMINGS_=0
|
||||
- R_BUILD_ARGS="--no-build-vignettes --no-manual"
|
||||
- R_CHECK_ARGS="--no-vignettes --no-manual"
|
||||
|
||||
warnings_are_errors: false
|
||||
|
||||
sudo: true
|
||||
|
||||
# Use Build Matrix to do lint and build seperately
|
||||
env:
|
||||
matrix:
|
||||
- TASK=lint LINT_LANG=cpp
|
||||
- TASK=lint LINT_LANG=python
|
||||
- TASK="R-package"
|
||||
- TASK="python-package"
|
||||
- TASK=build CXX=g++
|
||||
- TASK=build-with-dmlc CXX=g++
|
||||
|
||||
# dependent apt packages
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- doxygen
|
||||
- libopenmpi-dev
|
||||
- wget
|
||||
- libcurl4-openssl-dev
|
||||
- unzip
|
||||
- python-numpy
|
||||
- python-nose
|
||||
|
||||
before_install:
|
||||
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
|
||||
- chmod 755 ./travis-tool.sh
|
||||
- ./travis-tool.sh bootstrap
|
||||
- git clone https://github.com/dmlc/dmlc-core
|
||||
- export TRAVIS=dmlc-core/scripts/travis/
|
||||
- export PYTHONPATH=${PYTHONPATH}:${PWD}/wrapper
|
||||
- source ${TRAVIS}/travis_setup_env.sh
|
||||
|
||||
install:
|
||||
- make Rpack
|
||||
- cd ./xgboost
|
||||
- ../travis-tool.sh install_deps
|
||||
- pip install cpplint pylint --user `whoami`
|
||||
|
||||
script:
|
||||
- bash ../travis-tool.sh run_tests
|
||||
script: scripts/travis_script.sh
|
||||
|
||||
|
||||
after_failure:
|
||||
- scripts/travis_after_failure.sh
|
||||
|
||||
after_failure: cat /home/travis/build/dmlc/xgboost/R-package/xgboost.Rcheck/00install.out
|
||||
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- hetong007@gmail.com
|
||||
- tqchen@cs.washington.edu
|
||||
on_success: change
|
||||
on_failure: always
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
|
||||
36
Makefile
36
Makefile
@ -1,7 +1,7 @@
|
||||
export CC = gcc
|
||||
export CXX = g++
|
||||
export MPICXX = mpicxx
|
||||
export LDFLAGS= -pthread -lm
|
||||
export LDFLAGS= -pthread -lm
|
||||
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops
|
||||
# java include path
|
||||
export JAVAINCFLAGS = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux -I./java
|
||||
@ -12,8 +12,8 @@ ifeq ($(OS), Windows_NT)
|
||||
endif
|
||||
|
||||
ifeq ($(no_omp),1)
|
||||
CFLAGS += -DDISABLE_OPENMP
|
||||
else
|
||||
CFLAGS += -DDISABLE_OPENMP
|
||||
else
|
||||
CFLAGS += -fopenmp
|
||||
endif
|
||||
|
||||
@ -29,7 +29,7 @@ ifdef dmlc
|
||||
config = $(dmlc)/config.mk
|
||||
else
|
||||
config = $(dmlc)/make/config.mk
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
include $(config)
|
||||
include $(dmlc)/make/dmlc.mk
|
||||
@ -43,7 +43,7 @@ ifndef WITH_FPIC
|
||||
WITH_FPIC = 1
|
||||
endif
|
||||
ifeq ($(WITH_FPIC), 1)
|
||||
CFLAGS += -fPIC
|
||||
CFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ else
|
||||
TARGET = $(BIN)
|
||||
endif
|
||||
|
||||
.PHONY: clean all mpi python Rpack
|
||||
.PHONY: clean all mpi python Rpack lint
|
||||
|
||||
all: $(TARGET)
|
||||
mpi: $(MPIBIN)
|
||||
@ -78,9 +78,9 @@ python: wrapper/libxgboostwrapper.so
|
||||
# now the wrapper takes in two files. io and wrapper part
|
||||
updater.o: src/tree/updater.cpp src/tree/*.hpp src/*.h src/tree/*.h src/utils/*.h
|
||||
dmlc_simple.o: src/io/dmlc_simple.cpp src/utils/*.h
|
||||
gbm.o: src/gbm/gbm.cpp src/gbm/*.hpp src/gbm/*.h
|
||||
gbm.o: src/gbm/gbm.cpp src/gbm/*.hpp src/gbm/*.h
|
||||
io.o: src/io/io.cpp src/io/*.hpp src/utils/*.h src/learner/dmatrix.h src/*.h
|
||||
main.o: src/xgboost_main.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h
|
||||
main.o: src/xgboost_main.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h
|
||||
xgboost: updater.o gbm.o io.o main.o $(LIBRABIT) $(LIBDMLC)
|
||||
wrapper/xgboost_wrapper.dll wrapper/libxgboostwrapper.so: wrapper/xgboost_wrapper.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h updater.o gbm.o io.o $(LIBRABIT) $(LIBDMLC)
|
||||
|
||||
@ -97,11 +97,11 @@ subtree/rabit/lib/librabit_mock.a: subtree/rabit/src/engine_mock.cc
|
||||
subtree/rabit/lib/librabit_mpi.a: subtree/rabit/src/engine_mpi.cc
|
||||
+ cd subtree/rabit;make lib/librabit_mpi.a; cd ../..
|
||||
|
||||
$(BIN) :
|
||||
$(CXX) $(CFLAGS) -fPIC -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS)
|
||||
$(BIN) :
|
||||
$(CXX) $(CFLAGS) -fPIC -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS)
|
||||
|
||||
$(MOCKBIN) :
|
||||
$(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS)
|
||||
$(MOCKBIN) :
|
||||
$(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS)
|
||||
|
||||
$(SLIB) :
|
||||
$(CXX) $(CFLAGS) -fPIC -shared -o $@ $(filter %.cpp %.o %.c %.a %.cc, $^) $(LDFLAGS) $(DLLFLAGS)
|
||||
@ -109,13 +109,13 @@ $(SLIB) :
|
||||
$(JLIB) :
|
||||
$(CXX) $(CFLAGS) -fPIC -shared -o $@ $(filter %.cpp %.o %.c %.a %.cc, $^) $(LDFLAGS) $(JAVAINCFLAGS)
|
||||
|
||||
$(OBJ) :
|
||||
$(OBJ) :
|
||||
$(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c %.cc, $^) )
|
||||
|
||||
$(MPIOBJ) :
|
||||
$(MPICXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
|
||||
$(MPIOBJ) :
|
||||
$(MPICXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
|
||||
|
||||
$(MPIBIN) :
|
||||
$(MPIBIN) :
|
||||
$(MPICXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS)
|
||||
|
||||
install:
|
||||
@ -157,6 +157,10 @@ Rcheck:
|
||||
make Rbuild
|
||||
R CMD check --as-cran xgboost*.tar.gz
|
||||
|
||||
# lint requires dmlc to be in current folder
|
||||
lint:
|
||||
dmlc-core/scripts/lint.py xgboost $(LINT_LANG) src wrapper R-package
|
||||
|
||||
clean:
|
||||
$(RM) -rf $(OBJ) $(BIN) $(MPIBIN) $(MPIOBJ) $(SLIB) *.o */*.o */*/*.o *~ */*~ */*/*~
|
||||
cd subtree/rabit; make clean; cd ..
|
||||
|
||||
14
scripts/travis_R_script.sh
Executable file
14
scripts/travis_R_script.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Test R package of xgboost
|
||||
set -e
|
||||
export _R_CHECK_TIMINGS_=0
|
||||
export R_BUILD_ARGS="--no-build-vignettes --no-manual"
|
||||
export R_CHECK_ARGS="--no-vignettes --no-manual"
|
||||
|
||||
curl -OL http://raw.github.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
|
||||
5
scripts/travis_after_failure.sh
Executable file
5
scripts/travis_after_failure.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ${TASK} == "R-package" ]; then
|
||||
cat R-package/xgboost.Rcheck/00install.out
|
||||
fi
|
||||
28
scripts/travis_scripts.sh
Executable file
28
scripts/travis_scripts.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# main script of travis
|
||||
if [ ${TASK} == "lint" ]; then
|
||||
make lint || exit -1
|
||||
fi
|
||||
|
||||
if [ ${TASK} == "build" ]; then
|
||||
make all CXX=${CXX} || exit -1
|
||||
fi
|
||||
|
||||
if [ ${TASK} == "build-with-dmlc" ]; then
|
||||
cd dmlc-core
|
||||
cp make/config.mk .
|
||||
echo "USE_S3=1" >> config.mk
|
||||
make all CXX=${CXX}|| exit -1
|
||||
cd ..
|
||||
make dmlc=dmlc-core CXX=${CXX} || exit -1
|
||||
fi
|
||||
|
||||
if [ ${TASK} == "R-package" ]; then
|
||||
scripts/travis_R_script.sh || exit -1
|
||||
fi
|
||||
|
||||
if [ ${TASK} == "python-package" ]; then
|
||||
make all CXX=${CXX} || exit -1
|
||||
nosetests tests/python || exit -1
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user