From a9a0b9c29868cb199b42d3a9ce99b094661ab4de Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Wed, 6 Dec 2017 11:49:08 +0100
Subject: [PATCH] merge build and test jobs, simplify, factorize, use ctest and
 publish on the inria cdash server

---
 .gitlab-ci.yml | 159 ++++++++++++++++++++-----------------------------
 1 file changed, 64 insertions(+), 95 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 60b72b934..403e434ab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,132 +1,102 @@
 image: hpclib/hiepacs
 
 stages:
-  - build
-  - test
+  - buildtest
   - analysis
   - doc
 
-build_starpu_cuda_mpi:
-  stage: build
-  artifacts:
-    name: starpu_cuda_mpi_build
-    expire_in: 48 hours
-    paths:
-      - build
-      - chameleon-build-starpu.log
-  script:
-    - source .gitlab-ci-env.sh
-    - git submodule update --init --recursive
-    - mkdir -p build
-    - cd build
-    - cmake ..
-            -DCHAMELEON_USE_CUDA=ON
-            -DCHAMELEON_USE_MPI=ON
-            -DCMAKE_INSTALL_PREFIX=${PWD}/install
-            -DCMAKE_VERBOSE_MAKEFILE=ON
-            -DMORSE_ENABLE_WARNING=ON
-            -DMORSE_ENABLE_COVERAGE=ON
-    - make -j5 | tee ../chameleon-build-starpu.log
-    - make install | tee -a ../chameleon-build-starpu.log && rm install/ -r
-
-build_starpu_simgrid:
-  stage: build
-  artifacts:
-    name: starpu_simgrid_build
-    expire_in: 48 hours
-    paths:
-      - build
-      - chameleon-build-starpu-simgrid.log
-  script:
-    - source .gitlab-ci-env.sh simu
-    - git submodule update --init --recursive
-    - mkdir -p build
-    - cd build
-    - cmake .. -DCHAMELEON_SIMULATION=ON -DCHAMELEON_USE_CUDA=ON -DCHAMELEON_USE_MPI=OFF -DCMAKE_INSTALL_PREFIX=${PWD}/install -DCMAKE_VERBOSE_MAKEFILE=ON -DMORSE_ENABLE_WARNING=ON -DMORSE_ENABLE_COVERAGE=ON
-    - make -j5 | tee ../chameleon-build-starpu-simgrid.log
-    - make install | tee -a ../chameleon-build-starpu-simgrid.log && rm install/ -r
+before_script:
+  - git submodule update --init --recursive
+  - source .gitlab-ci-env.sh
+  - mkdir -p build
 
-build_quark:
-  stage: build
+starpu_cuda_mpi:
+  stage: buildtest
   artifacts:
-    name: quark_build
+    name: starpu_cuda_mpi
     expire_in: 48 hours
     paths:
       - build
-      - chameleon-build-quark.log
-  script:
-    - source .gitlab-ci-env.sh
-    - git submodule update --init --recursive
-    - mkdir -p build
-    - cd build
-    - cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}/install -DCMAKE_VERBOSE_MAKEFILE=ON -DMORSE_ENABLE_WARNING=ON -DMORSE_ENABLE_COVERAGE=ON -DCHAMELEON_SCHED_QUARK=ON
-    - make -j5 | tee ../chameleon-build-quark.log
-    - make install | tee -a ../chameleon-build-quark.log && rm install/ -r
-
-test_starpu_mpi:
-  stage: test
-  dependencies:
-    - build_starpu_cuda_mpi
-  artifacts:
-    name: starpu_mpi_test
-    expire_in: 48 hours
-    paths:
+      - chameleon-build-starpu.log
       - chameleon_starpu_mpi.lcov
   script:
-    - source .gitlab-ci-env.sh
-    - git submodule update --init --recursive
     - (cd build &&
-       ctest --no-compress-output
+       cmake -C ../cmake_modules/gitlab-ci-initial-cache.cmake ..
+             -DCHAMELEON_USE_CUDA=ON
+             -DCHAMELEON_USE_MPI=ON &&
+        ctest --no-compress-output -V -j 5
              -R test_shm_s
+             -R mpi_s
              -D ExperimentalBuild
              -D ExperimentalTest
              -D ExperimentalCoverage
              -D ExperimentalSubmit
-             || /usr/bin/true &&
-       ctest --no-compress-output
-             -R mpi_s
+             | tee ../chameleon-build-starpu.log
              || /usr/bin/true)
     - lcov --directory build --capture --output-file chameleon_starpu_mpi.lcov
+    - (cd build &&
+       make install | tee -a ../chameleon-build-starpu.log &&
+       rm install/ -r)
 
-test_starpu_simgrid:
-  stage: test
-  dependencies:
-    - build_starpu_simgrid
+starpu_simgrid:
+  stage: buildtest
   artifacts:
-    name: starpu_simgrid_test
+    name: starpu_simgrid
     expire_in: 48 hours
     paths:
+      - build
+      - chameleon-build-starpu-simgrid.log
       - chameleon_starpu_simgrid.lcov
   script:
-    - source .gitlab-ci-env.sh simu
-    - git submodule update --init --recursive
-    - (cd build && ctest --no-compress-output -V || /usr/bin/true)
+    - (cd build &&
+       cmake -C ../cmake_modules/gitlab-ci-initial-cache.cmake ..
+             -DCHAMELEON_SIMULATION=ON
+             -DCHAMELEON_USE_CUDA=ON
+             -DCHAMELEON_USE_MPI=OFF &&
+       ctest --no-compress-output -V -j 5
+            -D ExperimentalBuild
+            -D ExperimentalTest
+            -D ExperimentalCoverage
+            -D ExperimentalSubmit
+            | tee ../chameleon-build-starpu-simgrid.log
+            || /usr/bin/true)
     - lcov --directory build --capture --output-file chameleon_starpu_simgrid.lcov
+    - (cd build &&
+       make install | tee -a ../chameleon-build-starpu-simgrid.log &&
+       rm install/ -r)
 
-test_quark:
-  stage: test
-  dependencies:
-    - build_quark
+quark:
+  stage: buildtest
   artifacts:
-    name: quark_test
+    name: quark
     expire_in: 48 hours
     paths:
+      - build
+      - chameleon-build-quark.log
       - chameleon_quark.lcov
   script:
-    - source .gitlab-ci-env.sh
-    - git submodule update --init --recursive
-    - (cd build && ctest --no-compress-output -R test_shm_s)
+    - (cd build &&
+       cmake -C ../cmake_modules/gitlab-ci-initial-cache.cmake ..
+            -DCHAMELEON_SCHED_QUARK=ON &&
+       ctest --no-compress-output -V -j 5
+             -R test_shm_s
+             -D ExperimentalBuild
+             -D ExperimentalTest
+             -D ExperimentalCoverage
+             -D ExperimentalSubmit
+             | tee ../chameleon-build-quark.log
+             || /usr/bin/true)
     - lcov --directory build --capture --output-file chameleon_quark.lcov
+    - (cd build &&
+       make install | tee -a ../chameleon-build-quark.log &&
+       rm install/ -r)
 
 sonar:
   stage: analysis
   dependencies:
-    - build_starpu_cuda_mpi
-    - build_starpu_simgrid
-    - build_quark
-    - test_starpu_mpi
-    - test_starpu_simgrid
-    - test_quark
+    - starpu_cuda_mpi
+    - starpu_simgrid
+    - quark
   artifacts:
     name: chameleon_analysis
     expire_in: 1 week
@@ -137,8 +107,10 @@ sonar:
       - chameleon-rats.xml
       - sonar.log
   script:
-    - source .gitlab-ci-env.sh
-    - lcov -a $PWD/chameleon_starpu_mpi.lcov -a $PWD/chameleon_starpu_simgrid.lcov -a $PWD/chameleon_quark.lcov -o $PWD/chameleon.lcov
+    - lcov -a $PWD/chameleon_starpu_mpi.lcov
+           -a $PWD/chameleon_starpu_simgrid.lcov
+           -a $PWD/chameleon_quark.lcov
+           -o $PWD/chameleon.lcov
     - lcov_cobertura.py chameleon.lcov --output chameleon-coverage.xml
     - ./tools/analysis.sh
   only:
@@ -153,9 +125,6 @@ doc:
       - build/doc/doxygen
       - build/doc/orgmode
   script:
-    - source .gitlab-ci-env.sh
-    - git submodule update --init --recursive
-    - mkdir -p build
     - cd build
     - cmake .. -DCHAMELEON_ENABLE_DOC=ON
     - make doc -j5
-- 
GitLab