From 559a95834cfbe06133a38d13cdbc7b059f054c78 Mon Sep 17 00:00:00 2001
From: Marko Petric <marko.petric@cern.ch>
Date: Thu, 15 Sep 2016 17:06:29 +0200
Subject: [PATCH] [master] Enable Travis CI (#1)

* Add Travil yml file

* Import docker image

* Start docker move DD4hep to subfolder

* Remove obsolete +

* Debug travis

* Debug travis

* Run container

* Fix typo in ls

* Check if parrot mount work

* Test cernvm docker

* fix typo in cernvm docker test

* cernvm docker test

* Try to run everything

* Try to run everything

* Debug docker script execution

* Debug docker script execution

* Debug docker script execution

* Debug docker script execution

* Debug docker script execution

* Test if all folders are moved corectly

* Test if all folders are moved corectly

* Test if all folders are moved corectly

* Test if all folders are moved corectly

* Test if all folders are moved corectly

* test

* Try full test

* Fix boost setup in examples

* Let's see if Release if faster then Debug

* Refactor testing enviroment

* Fix typo in filename

* Fix error from refactoring

* Fix badges for travis-ci

* Make example test parallel and update README

* Disable e-mail notifications

* Explicit run enviroment

* Remove gitlab config files

* Change docker to allocate a pseudo-tty
---
 .gitlab-ci.yml                                | 103 ------------------
 .travis-ci.d/compile_and_test.sh              |  23 ++++
 {.gitlab-ci.d => .travis-ci.d}/init_x86_64.sh |   0
 .travis.yml                                   |  24 ++++
 README.md                                     |   7 +-
 5 files changed, 50 insertions(+), 107 deletions(-)
 delete mode 100644 .gitlab-ci.yml
 create mode 100755 .travis-ci.d/compile_and_test.sh
 rename {.gitlab-ci.d => .travis-ci.d}/init_x86_64.sh (100%)
 create mode 100644 .travis.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 5883e6bfd..000000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,103 +0,0 @@
-slc6-gcc48:
-  tags:
-    - docker
-  image: clicdp/slc6-base
-  script:
-    - export GCC_VERSION="4.8.5"
-    - export BUILD_TYPE="opt"
-    - source .gitlab-ci.d/init_x86_64.sh
-    - mkdir build 
-    - cd build
-    - cmake -GNinja -D DD4HEP_USE_GEANT4=ON -D DD4HEP_USE_BOOST=ON -DBoost_NO_BOOST_CMAKE=ON -D DD4HEP_USE_LCIO=ON -D BUILD_TESTING=ON  -D Geant4_DIR=$G4INSTALL/lib64/Geant4-10.2.2 -D DD4HEP_USE_CXX11=ON -DCMAKE_BUILD_TYPE=Debug ..
-    - ninja
-    - ninja install
-    - . ../bin/thisdd4hep.sh
-    - ctest --output-on-failure -j4
-    - cd ../examples/
-    - mkdir build
-    - cd build
-    - cmake -GNinja ..
-    - ninja
-    - ninja install
-    - ctest --output-on-failure
-    - cd ../..
-    - rm -rf .git
-    - sshpass -p $CLICTEL_PASS rsync -arv -e ssh --delete . clictel@lxplus:/afs/cern.ch/eng/clic/software/DD4hep/x86_64-slc6-gcc48-dbg
-
-
-slc6-gcc49:
-  tags:
-    - docker
-  image: clicdp/slc6-base
-  script:
-    - export GCC_VERSION="4.9.3"
-    - export BUILD_TYPE="opt"
-    - source .gitlab-ci.d/init_x86_64.sh
-    - mkdir build
-    - cd build
-    - cmake -GNinja -D DD4HEP_USE_GEANT4=ON -D DD4HEP_USE_BOOST=ON -DBoost_NO_BOOST_CMAKE=ON -D DD4HEP_USE_LCIO=ON -D BUILD_TESTING=ON -D Geant4_DIR=$G4INSTALL/lib64/Geant4-10.2.2 -D DD4HEP_USE_CXX11=ON -DCMAKE_BUILD_TYPE=Debug ..
-    - ninja
-    - ninja install
-    - . ../bin/thisdd4hep.sh
-    - ctest --output-on-failure -j4
-    - cd ../examples/
-    - mkdir build
-    - cd build
-    - cmake -GNinja ..
-    - ninja
-    - ninja install
-    - ctest --output-on-failure
-    - cd ../..
-    - rm -rf .git
-    - sshpass -p $CLICTEL_PASS rsync -arv -e ssh --delete . clictel@lxplus:/afs/cern.ch/eng/clic/software/DD4hep/x86_64-slc6-gcc49-dbg
-
-
-
-slc6-gcc49-XERCESC:
-  tags:
-    - docker
-  image: clicdp/slc6-base
-  script:
-    - export GCC_VERSION="4.9.3"
-    - export BUILD_TYPE="opt"
-    - source .gitlab-ci.d/init_x86_64.sh
-    - mkdir build 
-    - cd build
-    - cmake -GNinja -D DD4HEP_USE_GEANT4=ON -D DD4HEP_USE_BOOST=ON -DBoost_NO_BOOST_CMAKE=ON -D DD4HEP_USE_LCIO=ON -D BUILD_TESTING=ON -D Geant4_DIR=$G4INSTALL/lib64/Geant4-10.2.2 -D DD4HEP_USE_CXX11=ON -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_USE_XERCESC=ON ..
-    - ninja
-    - ninja install
-    - . ../bin/thisdd4hep.sh
-    - ctest --output-on-failure -j4
-    - cd ../examples/
-    - mkdir build
-    - cd build
-    - cmake -GNinja ..
-    - ninja
-    - ninja install
-    - ctest --output-on-failure
-
-centos7-gcc49:
-  tags:
-    - docker
-  image: clicdp/cc7-base
-  script:
-    - export GCC_VERSION="4.9.3"
-    - export BUILD_TYPE="opt"
-    - source .gitlab-ci.d/init_x86_64.sh
-    - mkdir build 
-    - cd build
-    - cmake -GNinja -D DD4HEP_USE_GEANT4=ON -D DD4HEP_USE_BOOST=ON -DBoost_NO_BOOST_CMAKE=ON -D DD4HEP_USE_LCIO=ON -D BUILD_TESTING=ON -D Geant4_DIR=$G4INSTALL/lib64/Geant4-10.2.2 -D DD4HEP_USE_CXX11=ON -DCMAKE_BUILD_TYPE=Debug ..
-    - ninja
-    - ninja install
-    - . ../bin/thisdd4hep.sh
-    - ctest --output-on-failure -j4
-    - cd ../examples/
-    - mkdir build
-    - cd build
-    - cmake -GNinja ..
-    - ninja
-    - ninja install
-    - ctest --output-on-failure
-    - cd ../..
-    - rm -rf .git
-    - sshpass -p $CLICTEL_PASS rsync -arv -e ssh --delete . clictel@lxplus:/afs/cern.ch/eng/clic/software/DD4hep/x86_64-centos7-gcc49-dbg
diff --git a/.travis-ci.d/compile_and_test.sh b/.travis-ci.d/compile_and_test.sh
new file mode 100755
index 000000000..15fccc432
--- /dev/null
+++ b/.travis-ci.d/compile_and_test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+export GCC_VERSION="4.8.5"
+export BUILD_TYPE="opt"
+
+source /DD4hep/.travis-ci.d/init_x86_64.sh
+
+
+cd /DD4hep
+mkdir build
+cd build
+cmake -GNinja -D DD4HEP_USE_GEANT4=ON -D DD4HEP_USE_BOOST=ON -DBoost_NO_BOOST_CMAKE=ON -D DD4HEP_USE_LCIO=ON -D BUILD_TESTING=ON  -D Geant4_DIR=$G4INSTALL/lib64/Geant4-10.2.2 -D DD4HEP_USE_CXX11=ON -DCMAKE_BUILD_TYPE=Release ..
+ninja
+ninja install
+. ../bin/thisdd4hep.sh
+ctest --output-on-failure -j4
+cd ../examples/
+mkdir build
+cd build
+cmake -GNinja -DBoost_NO_BOOST_CMAKE=ON ..
+ninja
+ninja install
+ctest --output-on-failure -j2
diff --git a/.gitlab-ci.d/init_x86_64.sh b/.travis-ci.d/init_x86_64.sh
similarity index 100%
rename from .gitlab-ci.d/init_x86_64.sh
rename to .travis-ci.d/init_x86_64.sh
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..9310de1cf
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+sudo: required
+dist: trusty
+
+services:
+  - docker
+
+# command to install dependencies
+install:
+  - shopt -s extglob dotglob
+  - mkdir DD4hep
+  - mv !(DD4hep) DD4hep
+  - shopt -u dotglob
+  - export DD4hepDIR=${PWD}/DD4hep
+  - cat $DD4hepDIR/.travis-ci.d/compile_and_test.sh
+  - curl -O http://cernvm.cern.ch/releases/production/cvm-docker-3.6.5.1.tar
+  - cat cvm-docker-3.6.5.1.tar | docker import - cernvm
+
+# command to run tests
+script:
+  - docker run -t -v $DD4hepDIR:/DD4hep cernvm /init /DD4hep/.travis-ci.d/compile_and_test.sh
+
+# Don't send e-mail notifications
+notifications:
+  email: false
\ No newline at end of file
diff --git a/README.md b/README.md
index c8942cb37..5d06b3179 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,10 @@
 # DD4hep (Detector Description for High Energy Physics)
-![Build status](https://gitlab.cern.ch/CLICdp/DD4hep/badges/master/build.svg)
+[![Build Status](https://travis-ci.org/AIDASoft/DD4hep.svg?branch=master)](https://travis-ci.org/AIDASoft/DD4hep)
 
 DD4hep is a software framework for providing a complete solution for full detector description
 (geometry, materials, visualization, readout, alignment, calibration, etc.) for the full experiment life cycle (detector concept development, detector optimization, construction, operation). It offers a consistent description through a single source of detector information for simulation, reconstruction, analysis, etc. It distributed under the [GPLv3 License](http://www.gnu.org/licenses/gpl-3.0.en.html)
 
-![License](http://www.gnu.org/graphics/gplv3-127x51.png)
-
+[![License](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0.en.html)
 
 ## Package Contents
 -------------------
@@ -111,7 +110,7 @@ or
 
  - running the build 
 
-   For each commit all tests are run through **gitlab CI**. DD4hep is tested against gcc 4.8 and 4.9 on SLC6 and with gcc 4.9 on CC7. Build results can be observed [here](https://gitlab.cern.ch/CLICdp/DD4hep/builds) and the status is indicated by the badge ![Build status](https://gitlab.cern.ch/CLICdp/DD4hep/badges/master/build.svg) 
+   For each commit all tests are run through **Travis CI**. DD4hep is tested against gcc 4.8 on SLC6. Build results can be observed [here](https://travis-ci.org/AIDASoft/DD4hep) and the status is indicated by the badge [![Build Status](https://travis-ci.org/AIDASoft/DD4hep.svg?branch=master)](https://travis-ci.org/AIDASoft/DD4hep)
 
 
  - running individual tests with output (e.g. in case of failed tests):
-- 
GitLab