From 63cdae8e8f70eaee7ed60f0e41496a20890c2d63 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Wed, 24 Jan 2024 19:06:40 +0100
Subject: [PATCH] Adding compilers to build cache

---
 .gitlab-ci.yml | 3 ++-
 config.json    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e0bd25a..4957480 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -97,7 +97,7 @@ spack:install_compilers:
   extends:
     - .parallel_job
   script:
-    - COMPILER_LIST_SPECS=$(jq -r '.stack.compilers | map("\(.spec)@\(.version)")[]' config.json)
+    - COMPILER_LIST_SPECS=$(jq -r '.stack | .core_compiler as $core | .compilers | map("\(.spec)@\(.version) %\($core)")[]' config.json)
     - /spack/spack/bin/spack install
       --log-file spack-install.xml
       --log-format junit
@@ -106,6 +106,7 @@ spack:install_compilers:
       --use-cache
       ${COMPILER_LIST_SPECS}
 
+    - /spack/spack/bin/spack buildcache create --update-index --signed scitas-buildcache ${COMPILER_LIST_SPECS}
     - |
       echo 'definitions: [ compilers: [' ${COMPILER_LIST_SPECS} ']]' > compiler_definitions.yaml
 
diff --git a/config.json b/config.json
index 5d0022a..f18db4e 100644
--- a/config.json
+++ b/config.json
@@ -13,6 +13,7 @@
         }
     },
     "stack": {
+        "core_compiler": "gcc@11.4.1 arch=linux-rhel9-x86_64_v2",
         "compilers": {
             "gcc": { "spec": "gcc", "version": "12.2.0" },
             "intel": { "spec": "intel-oneapi-compilers", "version": "2023.2.1" }
-- 
GitLab