Skip to content

Commit de3d964

Browse files
author
Dilawar Singh
committed
Changes from master branch.
Test on macosx as well as linux.
1 parent 9156b89 commit de3d964

File tree

5 files changed

+171
-45
lines changed

5 files changed

+171
-45
lines changed

.travis.yml

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
sudo: required
2-
dist: trusty
31
language: cpp
2+
dist: trusty
3+
sudo: required
44
compiler:
55
- gcc
66
- clang
77
os:
88
- linux
9+
- osx
910
notifications:
1011
email:
1112
recipients:
1213
13-
14-
15-
1614
on_success: change
1715
on_failure: always
1816

@@ -21,47 +19,17 @@ env:
2119
cache: apt
2220

2321
matrix:
24-
allow_failures:
25-
compiler:
26-
- clang
27-
28-
before_script:
29-
- sudo apt-get install -qq libxml2-dev libbz2-dev
30-
- sudo apt-get install -qq libhdf5-serial-dev
31-
- sudo apt-get install -qq make cmake
32-
- sudo apt-get install -qq python-numpy python-matplotlib python-networkx
33-
- sudo apt-get install -qq python3-numpy python3-matplotlib python3-dev
34-
- sudo apt-get install -qq libboost-all-dev
35-
- sudo apt-get install -qq libgsl0-dev
36-
- sudo apt-get install -qq python-pip python3-pip
37-
- sudo apt-get install -qq libgraphviz-dev
38-
#- sudo pip install python-libsbml
39-
#- sudo pip3 install python-libsbml
40-
#- sudo pip3 install pygraphviz
41-
42-
install:
43-
- echo "nothing to do here"
22+
allow_failure:
23+
os: osx
24+
25+
before_script :
26+
- echo "OSX related"
27+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi
28+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi
4429

4530
script:
4631
- # checking if any python3 incompatible file is in the source tree.
4732
- python2 -m compileall -q .
48-
- python3 -m compileall -q .
49-
- # Then run the old make scripts
50-
- make
51-
- ## CMAKE based flow
52-
- mkdir -p _GSL_BUILD && cd _GSL_BUILD && cmake -DDEBUG=ON -DPYTHON_EXECUTABLE=/usr/bin/python ..
53-
- make && ctest --output-on-failure
54-
- cd .. # Now with boost.
55-
- mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE=/usr/bin/python ..
56-
- make && ctest --output-on-failure
57-
- cd ..
58-
- echo "Python3 support. Removed python2-networkx and install python3"
59-
- sudo apt-get remove -qq python-networkx
60-
- sudo apt-get install -qq python3-networkx
61-
- mkdir -p _GSL_BUILD2 && cd _GSL_BUILD2 && cmake -DDEBUG=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
62-
- make && ctest --output-on-failure
63-
- cd .. # Now with BOOST and python3
64-
- mkdir -p _BOOST_BUILD2 && cd _BOOST_BUILD2 && cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
65-
- make && ctest --output-on-failure
66-
- cd ..
67-
- echo "All done. Phew"
33+
- if type python3 -c 'import sys' > /dev/null; then python3 -m compileall -q . ; fi
34+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi
35+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi

.travis/travis_build_linux.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: travis_build_linux.sh
5+
#
6+
# USAGE: ./travis_build_linux.sh
7+
#
8+
# DESCRIPTION: Build on linux environment.
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: Dilawar Singh (), [email protected]
15+
# ORGANIZATION: NCBS Bangalore
16+
# CREATED: 01/02/2017 10:11:46 AM
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
set -e
22+
23+
PYTHON2="/usr/bin/python2"
24+
PYTHON3="/usr/bin/python3"
25+
#MAKEFLAGS="-j 4"
26+
27+
# Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
28+
# many not be available. Therefore, it is neccessary to use fixed path for
29+
# python executable.
30+
31+
(
32+
# Old makefile based flow.
33+
python2 -m compileall -q .
34+
if type python3 -c 'import sys' > /dev/null; then python3 -m compileall -q . ; fi
35+
# Traditional make.
36+
make
37+
## CMAKE based flow
38+
mkdir -p _GSL_BUILD && cd _GSL_BUILD && \
39+
cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
40+
make && ctest --output-on-failure
41+
cd .. # Now with boost.
42+
mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && \
43+
cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
44+
make && ctest --output-on-failure
45+
cd ..
46+
47+
# This is only applicable on linux build.
48+
echo "Python3 support. Removed python2-networkx and install python3"
49+
if type $PYTHON3 -c 'import os' > /dev/null; then
50+
sudo apt-get remove -qq python-networkx
51+
sudo apt-get install -qq python3-networkx
52+
mkdir -p _GSL_BUILD2 && cd _GSL_BUILD2 && \
53+
cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON3" ..
54+
make && ctest --output-on-failure
55+
cd .. # Now with BOOST and python3
56+
mkdir -p _BOOST_BUILD2 && cd _BOOST_BUILD2 && \
57+
cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON3" ..
58+
make && ctest --output-on-failure
59+
cd .. && echo "All done"
60+
else
61+
echo "Python3 is not found. Build disabled"
62+
fi
63+
)

.travis/travis_build_osx.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: travis_build_linux.sh
5+
#
6+
# USAGE: ./travis_build_linux.sh
7+
#
8+
# DESCRIPTION: Build on linux environment.
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: Dilawar Singh (), [email protected]
15+
# ORGANIZATION: NCBS Bangalore
16+
# CREATED: 01/02/2017 10:11:46 AM
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
set -e
22+
23+
(
24+
mkdir -p _GSL_BUILD && cd _GSL_BUILD && cmake -DDEBUG=ON -DPYTHON_EXECUTABLE=`which python` ..
25+
make && ctest --output-on-failure
26+
cd .. # Now with boost.
27+
mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE=`which python` ..
28+
make && ctest --output-on-failure
29+
cd ..
30+
)

.travis/travis_prepare_linux.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: travis_prepare_linux.sh
5+
#
6+
# USAGE: ./travis_prepare_linux.sh
7+
#
8+
# DESCRIPTION: Prepare linux build environment on travis.
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: Dilawar Singh (), [email protected]
15+
# ORGANIZATION: NCBS Bangalore
16+
# CREATED: 01/02/2017 10:10:02 AM
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
set +e # Let installation fail in some command
22+
23+
apt-get install -qq libxml2-dev libbz2-dev
24+
apt-get install -qq libhdf5-serial-dev
25+
apt-get install -qq make cmake
26+
apt-get install -qq python-numpy python-matplotlib python-networkx
27+
apt-get install -qq python3-numpy python3-matplotlib python3-dev
28+
apt-get install -qq libboost-all-dev
29+
apt-get install -qq libgsl0-dev
30+
apt-get install -qq python-pip python3-pip
31+
apt-get install -qq libgraphviz-dev

.travis/travis_prepare_osx.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: travis_prepare_osx.sh
5+
#
6+
# USAGE: ./travis_prepare_osx.sh
7+
#
8+
# DESCRIPTION: Script to prepare OSX build on Travis CI.
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: Dilawar Singh (), [email protected]
15+
# ORGANIZATION: NCBS Bangalore
16+
# CREATED: 01/02/2017 10:09:00 AM
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
set +e
22+
brew update
23+
#brew outdated cmake || brew install cmake
24+
brew install gsl
25+
brew outdated hdf5 || brew install homebrew/science/hdf5
26+
brew outdated libsbml || brew install homebrew/science/libsbml
27+
#brew outdated python || brew install python
28+
#brew outdated numpy || brew install homebrew/python/numpy
29+
#brew unlink numpy && brew link numpy || echo "Failed to link numpy"
30+
# Numpy caveats
31+
mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
32+
echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth
33+
pip install matplotlib
34+

0 commit comments

Comments
 (0)