From 5b26b4225c014712def1481a2ac94e01ce510993 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Sat, 16 Apr 2022 10:55:44 +0200
Subject: [PATCH] Split the preliminary checks for better visualization of the
 issue

---
 .gitlab-ci.yml          | 10 ++++++++
 .gitlab/check_ci.sh     | 52 +++++++++++++++++++++++++++--------------
 .gitlab/common.yml      |  8 -------
 .gitlab/preliminary.yml | 15 ++++++++++++
 4 files changed, 60 insertions(+), 25 deletions(-)
 create mode 100644 .gitlab/preliminary.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 65fc90309..73c5407cc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,12 +5,22 @@ stages:
   - analyse
   - deploy
 
+# git config --global ahev been added to get around the issue related in
+# https://github.com/actions/checkout/issues/760 for github
+# Does not seem to be fixed for gitlab-runner yet
 before_script:
+  - git config --global --add safe.directory $CI_PROJECT_DIR
+  - git config --global --add safe.directory $CI_PROJECT_DIR/cmake_modules/morse_cmake
+  - git config --global --add safe.directory $CI_PROJECT_DIR/coreblas/hmat-oss
+  - git config --global --add safe.directory $CI_PROJECT_DIR/hqr
+  - git config --global --add safe.directory $CI_PROJECT_DIR/testing/test_fembem
+  - env 2>&1 > env.log
   - git submodule update --init --recursive
   - source .gitlab-ci-env.sh $SIMU
   - mkdir -p build-$VERSION
 
 include:
+  - .gitlab/preliminary.yml
   - .gitlab/common.yml
   - .gitlab/build.yml
   - .gitlab/test_starpu.yml
diff --git a/.gitlab/check_ci.sh b/.gitlab/check_ci.sh
index 76e9496ea..20be8e722 100755
--- a/.gitlab/check_ci.sh
+++ b/.gitlab/check_ci.sh
@@ -51,28 +51,46 @@ check_draft()
     return 0
 }
 
-echo "----------------------------------------------------"
-check_rebase
-
-echo ""
-echo "----------------------------------------------------"
-check_draft
+check_header()
+{
+    echo " Checking file headers: "
+    TOOLSDIR=$(dirname $0)/../tools
 
-echo ""
-echo "----------------------------------------------------"
-echo " Checking file headers: "
-TOOLSDIR=$(dirname $0)/../tools
+    $TOOLSDIR/check_header.sh
+    rc=$?
+    if [ $rc -eq 0 ]
+    then
+        echo "Check header: SUCCESS"
+    else
+        echo "Check header: FAILED"
+        success=0
+    fi
+}
 
-$TOOLSDIR/check_header.sh
-rc=$?
-if [ $rc -eq 0 ]
+if [ $# -lt 1 ]
 then
-    echo "Check header: SUCCESS"
-else
-    echo "Check header: FAILED"
-    success=0
+    echo "Usage: $0 [rebase|draft|header]"
+    exit 1
 fi
 
+echo ""
+echo "----------------------------------------------------"
+case $1 in
+    rebase)
+	check_rebase
+	;;
+    draft)
+	check_draft
+	;;
+    header)
+	check_header
+	;;
+    *)
+        echo "Usage: $0 [rebase|draft|header]"
+	exit 1
+	;;
+esac
+
 if [ $success -eq 0 ]
 then
     exit 1
diff --git a/.gitlab/common.yml b/.gitlab/common.yml
index 312eea9ad..2c597c65f 100644
--- a/.gitlab/common.yml
+++ b/.gitlab/common.yml
@@ -21,14 +21,6 @@
   except:
     - schedules
 
-preliminary_checks:
-  image: registry.gitlab.inria.fr/solverstack/docker/distrib
-  stage: .pre
-  script:
-    - .gitlab/check_ci.sh
-  only:
-    - merge_requests
-
 .build_script_template:
   extends: .only-branches
   stage: build
diff --git a/.gitlab/preliminary.yml b/.gitlab/preliminary.yml
new file mode 100644
index 000000000..331c55b37
--- /dev/null
+++ b/.gitlab/preliminary.yml
@@ -0,0 +1,15 @@
+#
+# This file list the preliminary checks done before trying to compile
+#
+---
+preliminary_checks:
+  image: registry.gitlab.inria.fr/solverstack/docker/distrib
+  stage: .pre
+  parallel:
+    matrix:
+      - TEST: [rebase, draft, header]
+  script:
+    - .gitlab/check_ci.sh $TEST
+  only:
+    - merge_requests
+
-- 
GitLab