From 147f5e937241cf835c1d86f4a5b196aff3990762 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franck=20P=C3=A9rignon?= <franck.perignon@imag.fr>
Date: Wed, 11 May 2016 18:46:02 +0200
Subject: [PATCH] CI : add docker config

---
 .gitlab-ci.yml                       | 66 +++++++++++++++++++---------
 ci/config.sh                         |  4 ++
 ci/docker_images/debian/Dockerfile   | 44 +++++++++++++++++++
 ci/docker_images/ubuntu/#Dockerfile# | 58 ++++++++++++++++++++++++
 ci/docker_images/ubuntu/Dockerfile   | 43 ++++++++++++++++++
 5 files changed, 195 insertions(+), 20 deletions(-)
 create mode 100644 ci/config.sh
 create mode 100644 ci/docker_images/debian/Dockerfile
 create mode 100644 ci/docker_images/ubuntu/#Dockerfile#
 create mode 100644 ci/docker_images/ubuntu/Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8cf9d75ef..9ae745229 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,39 +1,65 @@
 stages:
+  - configure
   - build
   - test
   - install
   - uninstall
 
 
-build_job:
+config-debian:
+  image: fperignon/hysop:debian
+  stage: configure
+  script: "sh ci/config.sh"
+
+build-debian:
+  image: fperignon/hysop:debian
   stage: build
   script:
-    - apt-get update -qq && apt-get install -y -qq python cmake python-dev libblas-dev liblapacke-dev libatlas-base-dev libatlas-dev gcc libgfortran3 libgcc1 libgcc-4.9-dev gfortran python-pip openmpi-bin libopenmpi-dev libhdf5-openmpi-dev python-numpy python-scipy python-pyopencl python-scitools libfftw3-dev libfftw3-mpi-dev python-pytest cython
-    - pip install --upgrade pip
-    - pip install --upgrade setuptools
-    - pip install mpi4py
-    - pip install sphinx
-    - pip install wheel
-    - wget https://pypi.python.org/packages/22/82/64dada5382a60471f85f16eb7d01cc1a9620aea855cd665609adf6fdbb0d/h5py-2.6.0.tar.gz
-    - tar -zxvf h5py-2.6.0.tar.gz
-    - cd h5py-2.6.0
-    - export CC=mpicc
-    - python setup.py configure --mpi --hdf5=/usr/
-    - python setup.py install
-    - cd ..
-    - mkdir build/
     - cd build
-    - cmake -D CMAKE_BUILD_TYPE=Debug -DWITH_LIB_CXX=OFF ..
     - make
   artifacts:
     paths:
     - build/
 
+test-debian:
+  image: fperignon/hysop:debian
+  stage: build
+  script:
+    - cd build
+    - make test
+  artifacts:
+    paths:
+    - build/
+
+deploy-debian:
+  image: fperignon/hysop:debian
+  stage: install
+  script:
+    - cd build
+    - make install
+    - cd
+    - python -c 'import hysop'
+
+
+config-ubuntu:
+  image: fperignon/hysop:ubuntu
+  stage: configure
+  script: "sh ci/config.sh"
 
-test_job:
-  stage: test
+build-ubuntu:
+  image: fperignon/hysop:ubuntu
+  stage: build
+  script: "sh ci/build.sh"
+  artifacts:
+    paths:
+    - build/
+
+test-ubuntu:
+  image: fperignon/hysop:ubuntu
+  stage: build
   script:
     - cd build
     - make test
-  dependencies:
-    - build_job
\ No newline at end of file
+  artifacts:
+    paths:
+    - build/
diff --git a/ci/config.sh b/ci/config.sh
new file mode 100644
index 000000000..d35c62a46
--- /dev/null
+++ b/ci/config.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+mkdir build
+cd build
+cmake  -D CMAKE_BUILD_TYPE=Debug -DWITH_LIB_CXX=OFF  ..
diff --git a/ci/docker_images/debian/Dockerfile b/ci/docker_images/debian/Dockerfile
new file mode 100644
index 000000000..1ca6d8e5c
--- /dev/null
+++ b/ci/docker_images/debian/Dockerfile
@@ -0,0 +1,44 @@
+# Test docker for gitlab-ci
+FROM debian:latest
+MAINTAINER Franck.Perignon@imag.fr
+# we need cmake, python ...
+RUN apt-get update && apt-get install -y \
+	cmake\
+	python-dev\
+	libblas-dev\
+        python\
+        liblapacke-dev\
+ 	libatlas-base-dev\
+	libatlas-dev\
+	gcc\
+	libgfortran3\
+	libgcc1\
+	libgcc-4.9-dev\
+	gfortran\
+	python-pip\
+	openmpi-bin\
+	libopenmpi-dev\
+	libhdf5-openmpi-dev\
+	python-numpy\
+	python-scipy\
+	python-pyopencl\
+	python-scitools\
+	libfftw3-dev\
+	libfftw3-mpi-dev\
+	python-pytest\
+	cython\
+	wget
+RUN pip install --upgrade pip
+RUN pip install --upgrade setuptools
+RUN pip install mpi4py
+RUN pip install sphinx
+RUN pip install wheel
+RUN wget https://pypi.python.org/packages/22/82/64dada5382a60471f85f16eb7d01cc1a9620aea855cd665609adf6fdbb0d/h5py-2.6.0.tar.gz
+RUN tar -zxvf h5py-2.6.0.tar.gz
+RUN cd h5py-2.6.0
+RUN export CC=mpicc
+RUN python setup.py configure --mpi --hdf5=/usr/
+RUN python setup.py install
+RUN cd ..
+
+CMD ["/bin/bash"]
diff --git a/ci/docker_images/ubuntu/#Dockerfile# b/ci/docker_images/ubuntu/#Dockerfile#
new file mode 100644
index 000000000..7b4d9a437
--- /dev/null
+++ b/ci/docker_images/ubuntu/#Dockerfile#
@@ -0,0 +1,58 @@
+FROM ubuntu:14.04.2
+MAINTAINER guido.stevens@cosent.net
+# we need ruby>2.0.0 for jekyll>3.0.0
+RUN apt-get update && apt-get install -y software-properties-common && apt-add-repository -y ppa:brightbox/ruby-ng
+RUN apt-get update && apt-get install -y \
+    curl \
+        firefox \
+	    gcc \
+	        gettext \
+		    ghostscript \
+		        git-core \
+			    graphicsmagick \
+			        jed \
+				    libenchant-dev \
+				        libffi-dev \
+					    libfreetype6-dev \
+					        libjpeg-dev \
+						    libreoffice \
+						        libxslt1-dev \
+							    make \
+							        pdftk \
+								    poppler-data \
+								        poppler-utils \
+									    python-dev \
+									        python-gdbm \
+										    python-lxml \
+										        python-pip \
+											    python-tk \
+											        python-virtualenv \
+												    redis-server \
+												        ruby2.3 \
+													    ruby2.3-dev \
+													        wget \
+														    xvfb \
+														        zlib1g-dev
+															RUN gem install docsplit
+															RUN locale-gen en_US.UTF-8 nl_NL@euro
+															COPY buildout.d /tmp/buildout.d
+															COPY buildout.cfg /tmp/
+															COPY requirements.txt /tmp/
+															RUN cd /tmp && \
+															    wget https://launchpad.net/plone/5.0/5.0.4/+download/Plone-5.0.4-UnifiedInstaller.tgz && \
+															        tar xzf Plone-5.0.4-UnifiedInstaller.tgz && \
+																    tar xjf Plone-5.0.4-UnifiedInstaller/packages/buildout-cache.tar.bz2 && \
+																        mv buildout-cache/* /var/tmp/ && \
+																	    mkdir /var/tmp/extends && \
+																	        rm -rf Plone* buildout-cache
+																		RUN mkdir /tmp/build && cd /tmp/build && \
+																		    cp -r /tmp/buildout.* /tmp/requirements.txt . && \
+																		        virtualenv -p python2.7 . && \
+																			    bin/pip install -r requirements.txt && \
+																			        bin/buildout -c buildout.cfg && \
+																				    chmod -R a+rwX /var/tmp/eggs /var/tmp/downloads /var/tmp/extends && \
+																				        cd /tmp && rm -rf /tmp/build
+																					CMD ["/bin/bash"]# This is a comment
+FROM ubuntu:14.04
+MAINTAINER Franck Pérignon <Franck.Perignon@imag.fr>
+RUN apt-get update && apt-get install -y cmake
\ No newline at end of file
diff --git a/ci/docker_images/ubuntu/Dockerfile b/ci/docker_images/ubuntu/Dockerfile
new file mode 100644
index 000000000..01fda919a
--- /dev/null
+++ b/ci/docker_images/ubuntu/Dockerfile
@@ -0,0 +1,43 @@
+# Test docker for gitlab-ci
+FROM ubuntu:latest
+MAINTAINER Franck.Perignon@imag.fr
+# we need cmake, python ...
+RUN apt-get update && apt-get install -y \
+	cmake\
+	python-dev\
+	libblas-dev\
+        python\
+        liblapacke-dev\
+ 	libatlas-base-dev\
+	libatlas-dev\
+	gcc\
+	libgfortran3\
+	libgcc1\
+	libgcc-4.9-dev\
+	gfortran\
+	python-pip\
+	openmpi-bin\
+	libopenmpi-dev\
+	libhdf5-openmpi-dev\
+	python-numpy\
+	python-scipy\
+	python-pyopencl\
+	python-scitools\
+	libfftw3-dev\
+	libfftw3-mpi-dev\
+	python-pytest\
+	cython
+RUN pip install --upgrade pip
+RUN pip install --upgrade setuptools
+RUN pip install mpi4py
+RUN pip install sphinx
+RUN pip install wheel
+RUN wget https://pypi.python.org/packages/22/82/64dada5382a60471f85f16eb7d01cc1a9620aea855cd665609adf6fdbb0d/h5py-2.6.0.tar.gz
+RUN tar -zxvf h5py-2.6.0.tar.gz
+RUN cd h5py-2.6.0
+RUN export CC=mpicc
+RUN python setup.py configure --mpi --hdf5=/usr/
+RUN python setup.py install
+RUN cd ..
+
+CMD ["/bin/bash"]
-- 
GitLab