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

Docker #393

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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
76 changes: 27 additions & 49 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ env:
- TEST_SUITE=pbl

matrix:
include:
- os: osx
sudo: false
- os: linux
sudo: required
services:
- docker
exclude:
- os: osx
compiler: gcc
Expand All @@ -25,14 +32,6 @@ matrix:

- compiler: clang
env: TEST_SUITE=UWLCM # UWLCM is not tested on clang yet
addons:
apt:
packages:
- g++-6
- clang-4.0
sources: &sources
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0

osx_image: xcode8

Expand All @@ -42,30 +41,21 @@ before_install:
- if [[ $TRAVIS_OS_NAME == 'linux' && $CXX == 'g++' ]]; then export COMPILER=g++; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then export COMPILER=clang++; fi # only clang on osx

# to avoid python lib/interpreter mismatch; https://github.com/travis-ci/travis-ci/issues/5326
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g"); fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty main universe multiverse"; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo apt-get update; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then export apt_get_install="apt-get install --no-install-recommends -t trusty -y"; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then export apt_get_install="apt-get install --no-install-recommends -y"; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew tap homebrew/science; fi

# fixing broken OSX gzip tools
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then export PATH=/usr/local/bin:$PATH; fi # so that brew-installed ones are first
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew tap homebrew/dupes; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install gzip; fi

# to avoid problems with plotting by paraview on Travis
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then unset DISPLAY; fi

# you may not believe it, but GCC (4.8.2) is giving ICEs otherwise!
- export make_j="make -j 2"
- if [[ $COMPILER == 'g++' ]]; then export make_j="make"; fi

# testing both Python 2 and 3 on Linux (unrelated to compiler choice!)
- export PY3DEB=""
- if [[ $TRAVIS_OS_NAME == 'linux' && $COMPILER == 'g++' ]]; then PY3DEB=3; fi
- if [[ $PY3DEB != '' ]]; then sudo apt-get install python3-dev; fi
- export PYVER="2"
- if [[ $TRAVIS_OS_NAME == 'linux' && $COMPILER == 'g++' && $TEST_SUITE != 'UWLCM' ]]; then PYVER=3; fi

install:
# silence the gazillion warnings coming from blitz headers when using the osx clang
Expand All @@ -75,65 +65,53 @@ install:
- if [[ $TRAVIS_OS_NAME == 'linux' && $COMPILER == 'clang++' ]]; then export CXX=clang++-4.0; fi
- if [[ $TRAVIS_OS_NAME == 'linux' && $COMPILER == 'g++' ]]; then export CXX=g++-6; fi

# boost
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install libboost1.55-all-dev; fi

# cmake
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install cmake; fi

# blitz
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install blitz; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install libblitz0-dev; fi

# hdf5
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" libpango-1.0-0 libpangocairo-1.0-0 libhdf5-dev; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install hdf5-tools; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install hdf5 --with-cxx; fi

# gnuplot-iostream
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install gnuplot-nox; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install gnuplot; fi
- sudo wget -O /usr/local/include/gnuplot-iostream.h https://raw.githubusercontent.com/dstahlke/gnuplot-iostream/master/gnuplot-iostream.h
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then sudo wget -O /usr/local/include/gnuplot-iostream.h https://raw.githubusercontent.com/dstahlke/gnuplot-iostream/master/gnuplot-iostream.h; fi

# h5py
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install python$PY3DEB-h5py; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then sudo pip install h5py; fi

# scipy
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install python$PY3DEB-scipy; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then sudo pip install scipy; fi

# matplotlib
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install python$PY3DEB-matplotlib; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then sudo pip install matplotlib; fi

# make Python 3 the default if requested
- if [[ $PY3DEB != '' ]]; then sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10; fi

before_script:
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then docker build --build-arg PYVER=$PYVER -t libmpdataxx .; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then export docker_run="docker run -e apt_get_install -e make_j -e CXX -e COMPILER -e TRAVIS_OS_NAME -t libmpdataxx"; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then export docker_run=""; fi
script:
# libmpdata++
- cd libmpdata++
- mkdir build
- cd build
- cmake ..
- cd ../..
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cd libmpdata++; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then mkdir build; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cd build; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cmake ..; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cd ../..; fi

# compiling and running all unit tests in Debug & Release modes
- if [[ $TEST_SUITE == 'unit' ]]; then . ./.travis_scripts/unit.sh; fi
- if [[ $TEST_SUITE == 'unit' ]]; then $docker_run bash ./.travis_scripts/unit.sh; fi

# compiling and running selected paper tests in Debug mode
- if [[ $TEST_SUITE == 'paper' ]]; then . ./.travis_scripts/paper.sh; fi
- if [[ $TEST_SUITE == 'paper' ]]; then $docker_run bash ./.travis_scripts/paper.sh; fi

# compiling all sandbox tests in Release mode
- if [[ $TEST_SUITE == 'sandbox' ]]; then . ./.travis_scripts/sandbox.sh; fi
- if [[ $TEST_SUITE == 'sandbox' ]]; then $docker_run bash ./.travis_scripts/sandbox.sh; fi

- if [[ $TEST_SUITE == 'elliptic_drop' ]]; then . ./.travis_scripts/elliptic_drop.sh; fi
- if [[ $TEST_SUITE == 'elliptic_drop' ]]; then $docker_run bash ./.travis_scripts/elliptic_drop.sh; fi

# running tests from UWLCM in Release mode
- if [[ $TEST_SUITE == 'UWLCM' ]]; then . ./.travis_scripts/UWLCM.sh; fi # with '.' to pass env vars
- if [[ $TEST_SUITE == 'UWLCM' ]]; then $docker_run bash ./.travis_scripts/UWLCM.sh; fi # with '.' to pass env vars

# compiling and running tests from Nair & Jablonowski 2008 MWR paper in Release mode
- if [[ $TEST_SUITE == 'nair_jablonowski_2008' ]]; then . ./.travis_scripts/nair_jablonowski_2008.sh; fi
- if [[ $TEST_SUITE == 'nair_jablonowski_2008' ]]; then $docker_run bash ./.travis_scripts/nair_jablonowski_2008.sh; fi

# running pbl tests in Release mode
- if [[ $TEST_SUITE == 'pbl' ]]; then . ./.travis_scripts/pbl.sh; fi
- if [[ $TEST_SUITE == 'pbl' ]]; then $docker_run bash ./.travis_scripts/pbl.sh; fi
6 changes: 0 additions & 6 deletions .travis_scripts/UWLCM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ cd libmpdata++/build
sudo make install
cd ../..

# making Python 2 back the default if needed - TODO: support Python3 in libcloudph++
if [[ $PY3DEB != '' ]]; then sudo update-alternatives --remove python /usr/bin/python3; fi
if [[ $PY3DEB != '' ]]; then sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 10; fi

# libcloudph++'s dependencies
#if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install libboost-python-dev python-numpy; fi
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install python-numpy; fi
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install boost-python; fi
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then git clone --depth=1 git://github.com/thrust/thrust.git; fi
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then sudo ln -s `pwd`/thrust/thrust /usr/local/include/thrust; fi

# odeint
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then git clone --depth=1 https://github.com/boostorg/odeint.git; fi # get boost odeint > 1.58
Expand Down
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM ubuntu:16.04

ARG DEBIAN_FRONTEND=noninteractive


WORKDIR /usr/local/src/libmpdataxx

RUN apt-get update -qq \
&& apt-get install -yq --no-install-recommends \
sudo \
apt-utils \
build-essential \
pkg-config \
git \
cmake \
ca-certificates \
clang-4.0 \
software-properties-common \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update -qq \
&& apt-get install -yq --no-install-recommends \
libblitz0-dev \
libboost-all-dev \
gnuplot-nox \
wget \
libhdf5-dev \
hdf5-tools \
python-h5py \
python-scipy \
python-matplotlib \
gcc-6 g++-6 \
python3-dev \
python3-h5py \
python3-scipy \
python3-matplotlib \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG PYVER

RUN if [ "$PYVER" = 3 ]; then sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10; fi

RUN wget -O /usr/local/include/gnuplot-iostream.h https://raw.githubusercontent.com/dstahlke/gnuplot-iostream/master/gnuplot-iostream.h

COPY . .

WORKDIR /usr/local/src/libmpdataxx/libmpdata++/build

RUN cmake .. && make

WORKDIR /usr/local/src/libmpdataxx/