Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Travis CI #7

Merged
merged 3 commits into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
sudo: false

language: cpp

os:
- linux
- osx

env:
# code analysis
- TASK=lint
- TASK=cpp_test
- TASK=python_test

branches:
only:
- master

matrix:
exclude:
- os: osx
env: TASK=lint

# dependent apt packages
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- doxygen
- wget
- git
- unzip
- gcc-4.8
- g++-4.8
- python-numpy
- python-nose
- python3-dev
- python3-nose
- graphviz

before_install:
- source dmlc-core/scripts/travis/travis_setup_env.sh
- export PYTHONPATH=${PYTHONPATH}:${PWD}/python

install:
- source tests/travis/setup.sh

script:
- tests/travis/run_test.sh

cache:
directories:
- ${HOME}/.cache/usr

before_cache:
- dmlc-core/scripts/travis/travis_before_cache.sh

after_failure:
- tests/travis/travis_after_failure.sh

notifications:
# Emails are sent to the committer's git-configured email address by default,
email:
on_success: change
on_failure: always
46 changes: 46 additions & 0 deletions tests/travis/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash


if [ ${TASK} == "lint" ]; then
make lint || exit -1
echo "Check documentations of c++ code..."
make doc 2>log.txt
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag") > logclean.txt
echo "---------Error Log----------"
cat logclean.txt
echo "----------------------------"
(cat logclean.txt|grep warning) && exit -1
(cat logclean.txt|grep error) && exit -1
exit 0
fi


if [ ! ${TRAVIS_OS_NAME} == "osx" ]; then
# use g++-4.8 for linux
if [ ${CXX} == "g++" ]; then
export CXX=g++-4.8
fi
fi

if [ ${TASK} == "cpp_test" ]; then
make -f dmlc-core/scripts/packages.mk gtest
make test || exit -1
for test in tests/cpp/*_test; do
./$test || exit -1
done
exit 0
fi

# run two test one for cython, one for ctypes
if [ ${TASK} == "python_test" ]; then
make clean
make -j all || exit -1
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
python -m nose tests/python/ || exit -1
python3 -m nose tests/python/ || exit -1
else
nosetests tests/python/ || exit -1
nosetests3 tests/python/ || exit -1
fi
exit 0
fi
15 changes: 15 additions & 0 deletions tests/travis/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash


if [ ${TRAVIS_OS_NAME} == "osx" ]; then
brew update
brew install python3
if [ ${TASK} == "python_test" ]; then
python -m pip install --user nose
python3 -m pip install --user nose
fi
fi

if [ ${TASK} == "lint" ]; then
pip install --user cpplint 'pylint==1.4.4' 'astroid==1.3.6'
fi
1 change: 1 addition & 0 deletions tests/travis/travis_after_failure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/bash