Skip to content
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
75 changes: 5 additions & 70 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# travis-ci.org build & test configuration
language: python

virtualenv:
system_site_packages: true
python:
- "2.7"
#- "3.2"
Expand All @@ -10,72 +11,6 @@ env:
- ROOT=5-34-18
- ROOT=6-00-00

install:
# Check if we are running Python 2 or 3. This is needed for the apt-get package names
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then export PYTHON_SUFFIX="3"; fi

# This is needed for the docs
- git submodule init
- git submodule update

# Use system python, not virtualenv, because building the dependencies from source takes too long
- deactivate # the virtualenv

# add repositories for gcc 4.8 and clang 3.5
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository --yes 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
# Needed because sometimes travis' repositories get out of date
- time sudo apt-get update -qq

# Install the dependencies we need
- time sudo apt-get -qq install clang-3.5 libclang-3.5-dev gcc-4.8 g++-4.8
- time sudo apt-get install -qq python${PYTHON_SUFFIX}-numpy python${PYTHON_SUFFIX}-sphinx python${PYTHON_SUFFIX}-nose
# matplotlib and PyTables are not available for Python 3 as packages from the main repo yet.
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then time sudo apt-get install -qq python${PYTHON_SUFFIX}-matplotlib python${PYTHON_SUFFIX}-tables; fi

# Install a ROOT binary that we custom-built in a 64-bit Ubuntu VM
# for the correct python / ROOT version
- time wget --no-check-certificate https://copy.com/s3BcYu1drmZa/ci/root_builds/root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION}.tar.gz
- time tar zxf root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION}.tar.gz
- mv root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION} root
- source root/bin/thisroot.sh
# setup newer compilers for ROOT 6
- if [[ $ROOT == '6-00-00' ]]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50; fi
- if [[ $ROOT == '6-00-00' ]]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50; fi
- if [[ $ROOT == '6-00-00' ]]; then sudo update-alternatives --set gcc /usr/bin/gcc-4.8; sudo update-alternatives --set g++ /usr/bin/g++-4.8; fi

# setup vpython with all packages
- source setup_standalone.sh
# add base path from setup_standalone to PYTHONPATH
- export PYTHONPATH=$PYTHONPATH:$base

script:

# Check if root and PyROOT work ok
- time root -l -q
- time python -c 'import ROOT; ROOT.TBrowser()'

# Check that rootpy can be imported
- time python -c 'import rootpy'
# What if ROOT already been initialized
- time python -c "from ROOT import kTRUE; import rootpy"

# Give user write access to shared memory to make multiprocessing semaphores work
# https://github.com/rootpy/rootpy/pull/176#issuecomment-13712313
- ls -la /dev/shm
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
#- sudo chmod a+w /dev/shm
- ls -la /dev/shm

# Now run the actual tests (from the installed version, not the local build dir)
- time python test/config_XSectionConfig.py
- time python test/cross_section_measurement_00_pick_bins.py
- time python test/fix_overflow.py
- time python test/tools_Calculation.py
- time python test/tools_Fitting_FitData.py
- time python test/tools_Fitting_Minuit.py
- time python test/tools_Fitting_RooFitFit.py
- time python test/tools_hist_utilities.py
- time python test/tools_Unfolding.py
- time python test/Integral_GetBinContent_consistency.py
install: source ci/install.sh
script: bash ci/test.sh
cache: apt
107 changes: 107 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash
# This script is meant to be called by the "install" step defined in
# .travis.yml. See http://docs.travis-ci.com/ for more details.
# The behavior of the script is controlled by environment variabled defined
# in the .travis.yml in the top level folder of the project.

set -e

# Check if we are running Python 2 or 3. This is needed for the apt-get package names
if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then
export PYTHON_SUFFIX="3";
fi

# add repositories for gcc 4.8 and clang 3.5
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
sudo add-apt-repository --yes 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
# Needed because sometimes travis' repositories get out of date
time sudo apt-get update -qq

# Install the dependencies we need
time sudo apt-get -qq install clang-3.5 libclang-3.5-dev gcc-4.8 g++-4.8
time sudo apt-get install -qq python${PYTHON_SUFFIX}-numpy python${PYTHON_SUFFIX}-sphinx python${PYTHON_SUFFIX}-nose python${PYTHON_SUFFIX}-pip cython${PYTHON_SUFFIX}
# matplotlib and PyTables are not available for Python 3 as packages from the main repo yet.
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then
time sudo apt-get install -qq python-matplotlib python-tables;
fi

# Install a ROOT binary that we custom-built in a 64-bit Ubuntu VM
# for the correct python / ROOT version
time wget --no-check-certificate https://copy.com/s3BcYu1drmZa/ci/root_builds/root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION}.tar.gz
time tar zxf root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION}.tar.gz
mv root_v${ROOT}_python_${TRAVIS_PYTHON_VERSION} root
source root/bin/thisroot.sh

# test ROOT install
# Check if ROOT and PyROOT work
root -l -q
python -c "import ROOT; ROOT.TBrowser()"

# setup newer compilers for ROOT 6
if [[ $ROOT == '6-00-00' ]]; then
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50;
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50;
sudo update-alternatives --set gcc /usr/bin/gcc-4.8; sudo update-alternatives --set g++ /usr/bin/g++-4.8;
fi

# setup vpython with all packages
# being standalone.sh
#DailyPythonTools location
export base=`pwd`

# package list from FinalStateAnalysis
# (https://github.com/uwcms/FinalStateAnalysis/blob/master/recipe/install_python.sh)
echo "Installing yolk"
time sudo pip install -U yolk
echo "Installing ipython"
time sudo pip install -U ipython
echo "Installing termcolor"
time sudo pip install -U termcolor
echo "Installing uncertainties <-- awesome error propagation"
time sudo pip install -U uncertainties
echo "Install progressbar"
time sudo pip install -U progressbar
echo "Installing argparse"
time sudo pip install -U argparse
echo "Installing pudb <-- interactive debugging"
time sudo pip install -U pudb
echo "Installing dateutil"
time sudo pip install python-dateutil
echo "Installing PrettyTable"
time sudo pip install PrettyTable

echo "Installing rootpy"
time pip install --user -e $base/external/rootpy

echo "Installing root_numpy"
git clone https://github.com/rootpy/root_numpy.git && (cd root_numpy && python setup.py install --user)
cd $base

if [ ! -d "$base/external/lib" ]; then
mkdir $base/external/lib
echo "Building RooUnfold"
cd $base/external/RooUnfold/
make -j4
#remove tmp folder
rm -fr $base/external/RooUnfold/tmp
mv $base/external/RooUnfold/libRooUnfold.so $base/external/lib/.
echo "Updating RooUnfold config"
cat $base/config/RooUnfold_template.py > $base/config/RooUnfold.py
echo "library = '$base/external/lib/libRooUnfold.so'" >> $base/config/RooUnfold.py

echo "Building TopAnalysis"
cd $base/external/TopAnalysis/
make -j4
# remove tmp folder
rm -fr $base/external/TopAnalysis/tmp
mv $base/external/TopAnalysis/libTopSVDUnfold.so $base/external/lib/.
echo "Updating TopSVDUnfold config"
echo "library = '$base/external/lib/libTopSVDUnfold.so'" > $base/config/TopSVDUnfold.py
fi

cd $base
export PATH=$PATH:$base/bin
# end standalone.sh
# add base path from setup_standalone to PYTHONPATH
export PYTHONPATH=$PYTHONPATH:$base
37 changes: 37 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# This script is meant to be called by the "script" step defined in
# .travis.yml. See http://docs.travis-ci.com/ for more details.
# The behavior of the script is controlled by environment variabled defined
# in the .travis.yml in the top level folder of the project.

set -e

python --version
python -c "import numpy; print('numpy %s' % numpy.__version__)"

# Check if ROOT and PyROOT work
root -l -q
python -c "import ROOT; ROOT.TBrowser()"

# Check that rootpy can be imported
time python -c 'import rootpy'
# What if ROOT has already been initialized?
time python -c 'from ROOT import kTRUE; import rootpy'

# Give user write access to shared memory to make multiprocessing semaphares work
# https://github.com/rootpy/rootpy/pull/176#issuecomment-13712313
ls -la /dev/shm
sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
#- sudo chmod a+w /dev/shm
ls -la /dev/shm

time python test/config_XSectionConfig.py
time python test/cross_section_measurement_00_pick_bins.py
time python test/fix_overflow.py
time python test/tools_Calculation.py
time python test/tools_Fitting_FitData.py
time python test/tools_Fitting_Minuit.py
time python test/tools_Fitting_RooFitFit.py
time python test/tools_hist_utilities.py
time python test/tools_Unfolding.py
time python test/Integral_GetBinContent_consistency.py