diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3aea0e42aae024e1f3336d280c457a7fbc11682b..2fed2c94e76d31991e3a884bee9a08c376f6a5ae 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,3 +10,15 @@ include:
 variables:
   GIT_SUBMODULE_STRATEGY: normal
   GIT_SUBMODULE_DEPTH: 1
+
+documentation:
+  before_script:
+    - apt-get update && apt-get install -y libgl1-mesa-glx > /dev/null
+    - export OMP_NUM_THREADS=1
+    - !reference [.snippets, doc-prepare]
+
+tests:
+  before_script:
+    - if [ "$TAG" == "docker" ]; then apt-get update && apt-get install -y libgl1-mesa-glx > /dev/null; fi
+    - if [ "$TAG" == "docker" ]; then export OMP_NUM_THREADS=1; fi # Set the number of threads used to 1
+    - !reference [.snippets, test-prepare]