forked from pele-python/pele
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
83 lines (76 loc) · 2.99 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
language: python
python:
- 2.7
virtualenv:
system_site_packages: true
branches:
only:
- master
before_install:
# Use miniconda and conda packages to speed up dependency setup (principally
# borrowed from https://gist.github.com/dan-blanchard/7045057
# and https://github.com/Jorge-C/ordination/blob/master/.travis.yml
- sudo apt-get update -qq
- sudo apt-get install -qq libatlas-dev libatlas-base-dev liblapack-dev gfortran python-qt4 lcov
- gem install coveralls-lcov
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
# Update conda itself
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update conda
# Useful for debugging any issues with conda
- conda info -a
# Additional channel for pyqt4
- conda config --add channels asmeurer
# matplotlib needs a DISPLAY
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
install:
- conda create --yes -n pelenv python=$TRAVIS_PYTHON_VERSION nose pip cython numpy scipy matplotlib qt pyqt sqlalchemy networkx
- source activate pelenv
- pip install munkres hungarian pyro4 brewer2mpl pyopengl coverage coveralls coveralls-merge
- python setup.py build --fcompiler=gfortran
- python setup.py install
- cp .coveragerc $HOME
- pwd
- sourcedir=$PWD
# build the c++ tests
- cd cpp_tests
- cpp_test_dir=$PWD
- ./get_gtest.sh
- cppbuild=$PWD/build
- mkdir $cppbuild && cd $cppbuild
- cmake ../source -DCMAKE_BUILD_TYPE=Coverage
- make
script:
# avoid running in the checkout directory so nose finds built modules..
- rundir=$HOME
- cd $rundir
- nosetests -v --with-coverage pele
# do the c++ tests
- cd $cppbuild
- ./test_main
after_success:
# generate the cpp coverage report
- cd $cppbuild
- lcov --capture --directory . -b . --output-file coverage.info
# Artificially change the directory of the c++ source files to the python
# site-packages directory. This is purely so that it has the same root
# directory as the python files so that the coveralls website can find the
# source on github. This is an ugly hack, there must be a better way.
- site_packages_dir=$(dirname `python -c "import pele; print pele.__file__"`)
- site_packages_dir=$(readlink -f $site_packages_dir/..) # go one dir higher and clean up the dir name
- sed -i "s=$sourcedir=$site_packages_dir=g" coverage.info
# coverall-lcov requires the source files to exist, so copy them over
- cp -r $sourcedir/source $site_packages_dir
# remove unwanted directories from the coverage report
- lcov --remove coverage.info 'tests/*' '/usr/*' --output-file coverage.info.cleaned
- coveralls-lcov -v -n coverage.info.cleaned > coverage.c.json
- cat coverage.c.json # testing
# need to be in source directory to call coverage
- cd $sourcedir # not sure if this is necessary
- cp $rundir/.coverage .
- coveralls-merge $cppbuild/coverage.c.json