From 083a5c9692c4ce821932b37f662f6d474d7b030f Mon Sep 17 00:00:00 2001
From: Simon Praetorius <simon.praetorius@tu-dresden.de>
Date: Thu, 13 Oct 2016 18:37:31 +0200
Subject: [PATCH] gitlab-ci and a simple readme added

---
 .gitignore                    | 17 ++++++++++++
 .gitlab-ci.yml                | 41 ++++++++++++++++++++++++++++
 README.md                     |  7 +++++
 tools/build_amdis.sh          | 44 ++++++++++++++++++++++++++++++
 tools/build_parallel_amdis.sh | 51 +++++++++++++++++++++++++++++++++++
 tools/install_boost.sh        | 24 +++++++++++++++++
 tools/install_petsc.sh        | 29 ++++++++++++++++++++
 7 files changed, 213 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 README.md
 create mode 100755 tools/build_amdis.sh
 create mode 100755 tools/build_parallel_amdis.sh
 create mode 100755 tools/install_boost.sh
 create mode 100755 tools/install_petsc.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..8f0154aa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+# ignore generated .vtu and .pvd files,
+*.vtu
+*.pvd
+*.pvtu
+
+# ignore ARH files
+*.arh
+*.parh
+*.tarh
+
+*.kate-swp
+*.tmp
+
+# ignore build directories
+build*/
+install*/
+output*/
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..69db3489
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,41 @@
+---
+cache:
+  paths:
+  - install/boost
+  - install/petsc
+
+before_script:
+  - tools/install_boost.sh
+  - tools/install_petsc.sh
+
+build:9-debug-gcc:
+  stage: build
+  image: duneci/base:9
+  script:
+  - tools/build_amdis.sh Debug
+  only:
+  - master
+
+build:9-release-gcc:
+  stage: build
+  image: duneci/base:9
+  script:
+  - tools/build_amdis.sh Release
+  only:
+  - master
+
+build:9-parallel-debug-gcc:
+  stage: build
+  image: duneci/base:9
+  script:
+  - tools/build_parallel_amdis.sh Debug
+  only:
+  - master
+
+build:9-parallel-release-gcc:
+  stage: build
+  image: duneci/base:9
+  script:
+  - tools/build_parallel_amdis.sh Release
+  only:
+  - master
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..e1ab10df
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+AMDiS (Adaptive MultiDimensional Simulations) is a C++ library to solve a broad class of partial differential equations (PDE) using adaptive finite elements.
+
+Install AMDiS by using cmake:
+```
+cmake AMDiS
+make && make install
+```
diff --git a/tools/build_amdis.sh b/tools/build_amdis.sh
new file mode 100755
index 00000000..efdea80b
--- /dev/null
+++ b/tools/build_amdis.sh
@@ -0,0 +1,44 @@
+#! /bin/bash
+
+ROOT=${PWD}
+POSTFIX="rel"
+CONFIURATION="Release"
+
+if [ "$1" == "Debug" ]; then
+  POSTFIX="dbg"
+  CONFIURATION="Debug"
+fi
+
+# at first build AMDiS
+cmake -E make_directory ${ROOT}/build_${POSTFIX}
+cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \
+      -DUSE_NEW_CMAKE:BOOL=ON \
+      -DCMAKE_INSTALL_PREFIX=${ROOT}/install_${POSTFIX} \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DENABLE_CXX11:BOOL=ON \
+      -DENABLE_COMPRESSION:BOOL=OFF \
+      -DENABLE_UMFPACK:BOOL=OFF \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+       ${ROOT}/AMDiS
+cmake --build ${ROOT}/build_${POSTFIX} --target install
+
+# now build the demos
+BASEDIR=${ROOT}/demo
+cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
+cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
+      -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+       ${BASEDIR}
+cmake --build ${BASEDIR}/build_${POSTFIX}
+
+# now build and run the test_suite
+BASEDIR=${ROOT}/tools/test_suite
+cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
+cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
+      -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+       ${BASEDIR}
+cmake --build ${BASEDIR}/build_${POSTFIX}
+cmake --build ${BASEDIR}/build_${POSTFIX} --target test
diff --git a/tools/build_parallel_amdis.sh b/tools/build_parallel_amdis.sh
new file mode 100755
index 00000000..c7fa5f56
--- /dev/null
+++ b/tools/build_parallel_amdis.sh
@@ -0,0 +1,51 @@
+#! /bin/bash
+
+set -e
+set -x
+
+ROOT=${PWD}
+POSTFIX="par_rel"
+CONFIURATION="Release"
+
+if [ "$1" == "Debug" ]; then
+  POSTFIX="par_dbg"
+  CONFIURATION="Debug"
+fi
+
+# at first build AMDiS
+cmake -E make_directory ${ROOT}/build_${POSTFIX}
+cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \
+      -DUSE_NEW_CMAKE:BOOL=ON \
+      -DCMAKE_INSTALL_PREFIX=${ROOT}/install_${POSTFIX} \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DENABLE_CXX11:BOOL=ON \
+      -DENABLE_COMPRESSION:BOOL=OFF \
+      -DENABLE_UMFPACK:BOOL=OFF \
+      -DENABLE_PARALLEL_DOMAIN:BOOL=ON \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+      -DPETSC_DIR:PATH=${ROOT}/install/petsc \
+       ${ROOT}/AMDiS
+cmake --build ${ROOT}/build_${POSTFIX} --target install
+
+# now build the demos
+BASEDIR=${ROOT}/demo
+cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
+cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
+      -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+      -DPETSC_DIR:PATH=${ROOT}/install/petsc \
+       ${BASEDIR}
+cmake --build ${BASEDIR}/build_${POSTFIX}
+
+# now build and run the test_suite
+BASEDIR=${ROOT}/tools/test_suite
+cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
+cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
+      -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \
+      -DCMAKE_BUILD_TYPE=${CONFIURATION} \
+      -DBOOST_ROOT:PATH=${ROOT}/install/boost \
+      -DPETSC_DIR:PATH=${ROOT}/install/petsc \
+       ${BASEDIR}
+cmake --build ${BASEDIR}/build_${POSTFIX}
+cmake --build ${BASEDIR}/build_${POSTFIX} --target test
diff --git a/tools/install_boost.sh b/tools/install_boost.sh
new file mode 100755
index 00000000..6bcfb161
--- /dev/null
+++ b/tools/install_boost.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+set -e
+set -x
+
+ROOT=${PWD}
+
+if [ ! -d install/ ]; then
+   mkdir -p install
+fi
+cd install
+
+#install current boost version
+if [ ! -d boost ]; then
+   curl -o boost.tar.gz "http://netcologne.dl.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz"
+   mkdir boost_tmp
+   tar --strip-components=1 -xf boost.tar.gz -C boost_tmp
+   rm boost.tar.gz
+   cd boost_tmp
+   ./bootstrap.sh --prefix=${ROOT}/install/boost --with-libraries=system,iostreams,filesystem,program_options,date_time
+   ./b2 -s NO_BZIP2=1 cxxflags="-std=c++11" --build-type=minimal install
+   cd ${ROOT}/install
+   rm -rf boost_tmp
+fi
\ No newline at end of file
diff --git a/tools/install_petsc.sh b/tools/install_petsc.sh
new file mode 100755
index 00000000..bca6bde8
--- /dev/null
+++ b/tools/install_petsc.sh
@@ -0,0 +1,29 @@
+#! /bin/bash
+
+set -e
+set -x
+
+ROOT=${PWD}
+
+if [ ! -d install/ ]; then
+   mkdir -p install
+fi
+cd install
+
+# install petsc
+if [ ! -d petsc ]; then
+   curl -o petsc.tar.gz "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.5.4.tar.gz"
+   mkdir petsc_tmp
+   tar --strip-components=1 -xf petsc.tar.gz -C petsc_tmp
+   rm petsc.tar.gz
+   cd petsc_tmp
+   # minimal petsc configuration, just for test purposes
+   ./configure --prefix=${ROOT}/install/petsc --with-pic=1 --with-debugging=0 \
+               --with-clanguage=c++ --with-cxx-dialect=c++11 \
+               --with-metis=1 --download-metis=yes \
+               --with-parmetis=1 --download-parmetis=yes \
+               --with-fblaslapack=1 --download-fblaslapack=yes
+   make && make install
+   cd ${ROOT}/install
+   rm -rf petsc_tmp
+fi
-- 
GitLab