From 5ba8e10e51fbf32a25f924f9adb4a7529cb6e78a Mon Sep 17 00:00:00 2001
From: acrovato <a.crovato@uliege.be>
Date: Mon, 5 Oct 2020 10:23:17 +0200
Subject: [PATCH] Update gitlab CI

---
 .gitlab-ci.yml      | 37 +++++++++++++++++++++++++++++--------
 fpm/src/fSolver.cpp |  3 ++-
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 819c9ef..fed5e65 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,24 +14,45 @@ stages:
     - build
     - test
 
-build:
+waves:
     <<: *global_tag_def
-    stage: build
+    stage: .pre
     script:
+        - pwd
         - printenv | sort
         - cd ..
         - rm -rf waves
-        - wget -q https://gitlab.uliege.be/am-dept/waves/-/archive/feature_fpm/waves-feature_fpm.tar.bz2
-        - tar xf waves-feature_fpm.tar.bz2
-        - rm waves-feature_fpm.tar.bz2
-        - mv waves-feature_fpm waves
+        - wget -q https://gitlab.uliege.be/am-dept/waves/-/archive/master/waves-master.tar.bz2
+        - tar xf waves-master.tar.bz2
+        - rm waves-master.tar.bz2
+        - mv waves-master waves
         - cd waves
         - mkdir build
         - cd build
         - cmake -Wno-dev -C ../CMake/disable-trilinos.cmake ..
         - make -j $(nproc)
-        - cd ../../fpm
-        - rm -rf build workspace
+
+format:
+    <<: *global_tag_def
+    stage: build
+    script:
+        - clang-format --version # we use clang-format-10 exclusively
+        - pwd
+        - ./${CI_PROJECT_DIR}/../waves/scripts/format_code.py
+        - mkdir -p patches
+        - if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
+    artifacts:
+        paths:
+            - patches/
+        expire_in: 1 day
+        when: on_failure
+    allow_failure: true
+
+build:
+    <<: *global_tag_def
+    stage: build
+    script:
+        - pwd
         - mkdir build
         - cd build
         - cmake -DCMAKE_PREFIX_PATH=${CI_PROJECT_DIR}/../waves -Wno-dev ..
diff --git a/fpm/src/fSolver.cpp b/fpm/src/fSolver.cpp
index a9905ea..51066d4 100644
--- a/fpm/src/fSolver.cpp
+++ b/fpm/src/fSolver.cpp
@@ -95,7 +95,8 @@ void Solver::run()
     std::cout << "Computing flow and loads on bodies... " << std::flush;
     computeFlow(mu, tau, sigma);
     computeLoad();
-    std::cout << "done!" << std::endl << std::endl;
+    std::cout << "done!" << std::endl
+              << std::endl;
 }
 
 /**
-- 
GitLab