Skip to content

Commit e953e2e

Browse files
authored
Setup Travis CI (#7)
* Setup Travis CI * add source * fix source
1 parent 78ea652 commit e953e2e

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

.travis.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
sudo: false
2+
3+
language: cpp
4+
5+
os:
6+
- linux
7+
- osx
8+
9+
env:
10+
# code analysis
11+
- TASK=lint
12+
- TASK=cpp_test
13+
- TASK=python_test
14+
15+
branches:
16+
only:
17+
- master
18+
19+
matrix:
20+
exclude:
21+
- os: osx
22+
env: TASK=lint
23+
24+
# dependent apt packages
25+
addons:
26+
apt:
27+
sources:
28+
- ubuntu-toolchain-r-test
29+
packages:
30+
- doxygen
31+
- wget
32+
- git
33+
- unzip
34+
- gcc-4.8
35+
- g++-4.8
36+
- python-numpy
37+
- python-nose
38+
- python3-dev
39+
- python3-nose
40+
- graphviz
41+
42+
before_install:
43+
- source dmlc-core/scripts/travis/travis_setup_env.sh
44+
- export PYTHONPATH=${PYTHONPATH}:${PWD}/python
45+
46+
install:
47+
- source tests/travis/setup.sh
48+
49+
script:
50+
- tests/travis/run_test.sh
51+
52+
cache:
53+
directories:
54+
- ${HOME}/.cache/usr
55+
56+
before_cache:
57+
- dmlc-core/scripts/travis/travis_before_cache.sh
58+
59+
after_failure:
60+
- tests/travis/travis_after_failure.sh
61+
62+
notifications:
63+
# Emails are sent to the committer's git-configured email address by default,
64+
email:
65+
on_success: change
66+
on_failure: always

tests/travis/run_test.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
4+
if [ ${TASK} == "lint" ]; then
5+
make lint || exit -1
6+
echo "Check documentations of c++ code..."
7+
make doc 2>log.txt
8+
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag") > logclean.txt
9+
echo "---------Error Log----------"
10+
cat logclean.txt
11+
echo "----------------------------"
12+
(cat logclean.txt|grep warning) && exit -1
13+
(cat logclean.txt|grep error) && exit -1
14+
exit 0
15+
fi
16+
17+
18+
if [ ! ${TRAVIS_OS_NAME} == "osx" ]; then
19+
# use g++-4.8 for linux
20+
if [ ${CXX} == "g++" ]; then
21+
export CXX=g++-4.8
22+
fi
23+
fi
24+
25+
if [ ${TASK} == "cpp_test" ]; then
26+
make -f dmlc-core/scripts/packages.mk gtest
27+
make test || exit -1
28+
for test in tests/cpp/*_test; do
29+
./$test || exit -1
30+
done
31+
exit 0
32+
fi
33+
34+
# run two test one for cython, one for ctypes
35+
if [ ${TASK} == "python_test" ]; then
36+
make clean
37+
make -j all || exit -1
38+
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
39+
python -m nose tests/python/ || exit -1
40+
python3 -m nose tests/python/ || exit -1
41+
else
42+
nosetests tests/python/ || exit -1
43+
nosetests3 tests/python/ || exit -1
44+
fi
45+
exit 0
46+
fi

tests/travis/setup.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
4+
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
5+
brew update
6+
brew install python3
7+
if [ ${TASK} == "python_test" ]; then
8+
python -m pip install --user nose
9+
python3 -m pip install --user nose
10+
fi
11+
fi
12+
13+
if [ ${TASK} == "lint" ]; then
14+
pip install --user cpplint 'pylint==1.4.4' 'astroid==1.3.6'
15+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/bash

0 commit comments

Comments
 (0)