From bb5d7848f3dbfb9da4983199f9d096571a62c597 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Wed, 7 Feb 2024 22:30:34 +0100
Subject: [PATCH] preparing artifacts

---
 .gitlab-ci.yml | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 71310ae..6a4d3d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -49,6 +49,14 @@ variables:
       - spack/
       - compiler_definitions.yaml
 
+.stack_prepare_save:
+  before_script:
+    - if [ -e stack.tgz ]; then
+        tar -xvz -f stack.tgz -C /
+      fi
+  after_script:
+    - tar -cvzf stack.tgz /stack
+
 # ------------------------------------------------------------------------------
 spack:setup:
   stage: environment
@@ -59,21 +67,26 @@ spack:setup:
     - git config --global --add --bool advice.detachedHead false
   script:
     - ci/setup_spack.sh
+  after_script:
+    - !reference [.stack_prepare_save, after_script]
+  artifacts:
+    paths:
+      - stack.tgz
 
 spack:install_compilers:
   stage: compilers
   extends:
     - .spack_cache
     - .parallel_job
+    - .stack_prepare_save
   script:
     - ci/install_compilers.sh
     - spack/bin/spack -e . config blame compilers
-
   artifacts:
     reports:
       junit: spack-install.xml
     paths:
-      - /stack/**
+      - stack.tgz
 
   needs:
     - job: spack:setup
@@ -83,6 +96,7 @@ spack:concretize:
   extends:
     - .spack_cache
     - .parallel_job
+    - .stack_prepare_save
   script:
     - spack/bin/spack -e . config blame
     - spack/bin/spack -e . concretize
@@ -91,13 +105,14 @@ spack:concretize:
   artifacts:
     paths:
       - spack.lock
-      - /stack/**
+      - stack.tgz
 
 spack:install:
   stage: install
   extends:
     - .spack_cache
     - .parallel_job
+    - .stack_prepare_save
   script:
     - spack/bin/spack -e . install
           --log-file spack-install.xml
-- 
GitLab