"src/io/cuda/cuda_column_data.cu" did not exist on "b857ee10cc9a913e6dedd15c2475765d1e923c7b"
test.sh 4.53 KB
Newer Older
1
#!/bin/bash
wxchan's avatar
wxchan committed
2

3
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
4
5
    export CXX=g++-8
    export CC=gcc-8
6
7
8
9
fi

conda create -q -n test-env python=$PYTHON_VERSION
source activate test-env
10

wxchan's avatar
wxchan committed
11
12
cd $TRAVIS_BUILD_DIR

13
if [[ $TASK == "check-docs" ]]; then
14
15
16
17
18
19
    if [[ $TRAVIS_OS_NAME != "osx" ]]; then
        sudo apt-get install linkchecker
    fi
    if [[ ${PYTHON_VERSION} == "2.7" ]]; then
        conda install mock
    fi
20
    conda install sphinx "sphinx_rtd_theme>=0.3"  # html5validator
21
    pip install rstcheck
22
    cd $TRAVIS_BUILD_DIR/python-package
23
    rstcheck --report warning `find . -type f -name "*.rst"` || exit -1
24
    cd $TRAVIS_BUILD_DIR/docs
25
    rstcheck --report warning --ignore-directives=autoclass,autofunction `find . -type f -name "*.rst"` || exit -1
26
    make html || exit -1
27
    find ./_build/html/ -type f -name '*.html' -exec \
28
    sed -i -e 's;\(\.\/[^.]*\.\)rst\([^[:space:]]*\);\1html\2;g' {} \;  # emulate js function
29
#    html5validator --root ./_build/html/ || exit -1
30
31
32
    if [[ $TRAVIS_OS_NAME != "osx" ]]; then
        linkchecker --config=.linkcheckerrc ./_build/html/*.html || exit -1
    fi
33
34
35
    exit 0
fi

36
if [[ $TASK == "pylint" ]]; then
37
38
    conda install pycodestyle
    pycodestyle --ignore=E501,W503 --exclude=./compute,./docs,./.nuget . || exit -1
wxchan's avatar
wxchan committed
39
40
41
    exit 0
fi

42
if [[ $TASK == "if-else" ]]; then
43
    conda install numpy
wxchan's avatar
wxchan committed
44
    mkdir build && cd build && cmake .. && make lightgbm || exit -1
wxchan's avatar
wxchan committed
45
    cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf convert_model_language=cpp convert_model=../../src/boosting/gbdt_prediction.cpp && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1
wxchan's avatar
wxchan committed
46
47
48
49
50
    cd $TRAVIS_BUILD_DIR/build && make lightgbm || exit -1
    cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=predict.conf output_result=ifelse.pred && python test.py || exit -1
    exit 0
fi

51
conda install numpy nose scipy scikit-learn pandas matplotlib pytest
wxchan's avatar
wxchan committed
52

53
if [[ $TASK == "sdist" ]]; then
wxchan's avatar
wxchan committed
54
    cd $TRAVIS_BUILD_DIR/python-package && python setup.py sdist || exit -1
55
    pip install $TRAVIS_BUILD_DIR/python-package/dist/lightgbm-$LGB_VER.tar.gz -v || exit -1
56
    pytest $TRAVIS_BUILD_DIR/tests/python_package_test || exit -1
57
    exit 0
58
elif [[ $TASK == "bdist" ]]; then
Guolin Ke's avatar
Guolin Ke committed
59
60
    if [[ $TRAVIS_OS_NAME == "osx" ]]; then
        cd $TRAVIS_BUILD_DIR/python-package && python setup.py bdist_wheel --plat-name=macosx --universal || exit -1
61
        mv dist/lightgbm-$LGB_VER-py2.py3-none-macosx.whl dist/lightgbm-$LGB_VER-py2.py3-none-macosx_10_9_x86_64.macosx_10_10_x86_64.macosx_10_11_x86_64.macosx_10_12_x86_64.macosx_10_13_x86_64.whl
Guolin Ke's avatar
Guolin Ke committed
62
63
64
    else
        cd $TRAVIS_BUILD_DIR/python-package && python setup.py bdist_wheel --plat-name=manylinux1_x86_64 --universal || exit -1
    fi
65
66
    pip install $TRAVIS_BUILD_DIR/python-package/dist/*.whl || exit -1
    pytest $TRAVIS_BUILD_DIR/tests/python_package_test || exit -1
wxchan's avatar
wxchan committed
67
68
69
    exit 0
fi

70
if [[ $TASK == "gpu" ]]; then
71
    conda install --yes -c conda-forge boost
72
    sed -i 's/std::string device_type = "cpu";/std::string device_type = "gpu";/' $TRAVIS_BUILD_DIR/include/LightGBM/config.h
73
    grep -q 'std::string device_type = "gpu"' $TRAVIS_BUILD_DIR/include/LightGBM/config.h || exit -1  # make sure that changes were really done
74
    if [[ $METHOD == "pip" ]]; then
Guolin Ke's avatar
Guolin Ke committed
75
        cd $TRAVIS_BUILD_DIR/python-package && python setup.py sdist || exit -1
76
        pip install $TRAVIS_BUILD_DIR/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--boost-root=$HOME/miniconda/envs/test-env/" --install-option="--opencl-include-dir=$AMDAPPSDK/include/" || exit -1
77
        pytest $TRAVIS_BUILD_DIR/tests/python_package_test || exit -1
78
79
        exit 0
    fi
wxchan's avatar
wxchan committed
80
81
82
83
fi

mkdir build && cd build

84
if [[ $TASK == "mpi" ]]; then
85
    cd $TRAVIS_BUILD_DIR/python-package && python setup.py sdist || exit -1
86
    pip install $TRAVIS_BUILD_DIR/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--mpi || exit -1
87
    cd $TRAVIS_BUILD_DIR/build
wxchan's avatar
wxchan committed
88
    cmake -DUSE_MPI=ON ..
89
90
elif [[ $TASK == "gpu" ]]; then
    cmake -DUSE_GPU=ON -DBOOST_ROOT=$HOME/miniconda/envs/test-env/ -DOpenCL_INCLUDE_DIR=$AMDAPPSDK/include/ ..
wxchan's avatar
wxchan committed
91
92
93
94
95
96
97
else
    cmake ..
fi

make _lightgbm || exit -1

cd $TRAVIS_BUILD_DIR/python-package && python setup.py install --precompile || exit -1
98
pytest $TRAVIS_BUILD_DIR || exit -1
99

100
if [[ $TASK == "regular" ]]; then
101
102
103
104
105
106
107
    conda install python-graphviz
    cd $TRAVIS_BUILD_DIR/examples/python-guide
    sed -i'.bak' '/import lightgbm as lgb/a\
import matplotlib\
matplotlib.use\(\"Agg\"\)\
' plot_example.py  # prevent interactive window mode
    for f in *.py; do python $f || exit -1; done  # run all examples
108
fi