From 370e149bd55ab98d15551b05f87a3faabae28bdd Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Thu, 14 Apr 2022 09:56:25 +0200
Subject: [PATCH] [gitlab-ci] Move common setup code in global before_script

Adapt the qa to not do everything that is there.
---
 .gitlab-ci.yml | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7a979c88..f82d3bf4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,6 +5,12 @@ variables:
   PRE_COMMIT_HOME: "${CI_PROJECT_DIR}/.cache/pre-commit"
 
 
+before_script:
+  - git config --global --add safe.directory ${CI_PROJECT_DIR}
+  - python3 ./bob/devtools/bootstrap.py -vv build
+  - source ${CONDA_ROOT}/etc/profile.d/conda.sh
+  - conda activate base
+
 # Definition of our build pipeline order
 stages:
   - qa
@@ -32,10 +38,6 @@ stages:
     - bob
     - docker
   image: quay.io/condaforge/linux-anvil-cos7-x86_64
-  before_script:
-    - python3 ./bob/devtools/bootstrap.py -vv build
-    - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    - conda activate base
   artifacts:
     paths:
       - dist/*.zip
@@ -54,10 +56,6 @@ stages:
     - bob
     - macos
     - intel
-  before_script:
-    - python3 ./bob/devtools/bootstrap.py -vv build
-    - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    - conda activate base
   artifacts:
     paths:
       - ${CONDA_ROOT}/conda-bld/osx-64/*.conda
@@ -71,10 +69,6 @@ stages:
   tags:
     - macos
     - arm
-  before_script:
-    - python3 ./bob/devtools/bootstrap.py -vv build
-    - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    - conda activate base
   artifacts:
     paths:
       - ${CONDA_ROOT}/conda-bld/osx-arm64/*.conda
@@ -93,10 +87,12 @@ code_quality:
     paths:
       - ${PRE_COMMIT_HOME}
 
+  before_script:
+    - git config --global --add safe.directory ${CI_PROJECT_DIR}
+
   script:
     - sudo yum install -y git python3-pip
     - pip3 install pre-commit
-    - git config --global --add safe.directory ${CI_PROJECT_DIR}
     - pre-commit run --all-files --show-diff-on-failure
 
 
-- 
GitLab