diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3d3a896e35241f53e6d558aa387604a26bb9f7d..908f4c7a48c9fda34f3365196fabef64fcbd6a16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,33 +35,39 @@ variables: - stack variables: COMMAND_OPTIONS_SBATCH: ${slurm_options} - APPTAINER_EXEC_OPTIONS: ${apptainer_options} --bind ${BUILDCACHE}:/buildcache:rw --bind ${SPACK_PATH}:/spack:rw --bind ${STACK_PATH}:/stack:rw --writable-tmpfs + APPTAINER_EXEC_OPTIONS: ${apptainer_options} --bind ${BUILDCACHE}:/buildcache:rw --bind ${STACK_PATH}:/stack:rw --writable-tmpfs SPACK_DISABLE_LOCAL_CONFIG: "true" SPACK_USER_CACHE_PATH: "/tmp/spack_cache_${CI_JOB_ID}" SPACK_SITE_CONFIG_PATH: "/stack/spack/etc" BUILDCACHE: "/work/scitas-ge/richart/ci/buildcache" - SPACK_PATH: "/work/scitas-ge/richart/ci/${environment}/spack" STACK_PATH: "/work/scitas-ge/richart/ci/${environment}/stack" + +.spack_cache: + - key: ${environment}-spack-cache + policy: pull-push + untracked: true + # ------------------------------------------------------------------------------ spack:setup: stage: environment extends: + - .spack_cache - .parallel_job script: - SPACK_VERSION=$(jq -r .spack.version config.json) - | - if [ ! -d /spack/spack ]; then - git clone https://github.com/spack/spack.git -b $SPACK_VERSION /spack/spack + if [ ! -d spack ]; then + git clone https://github.com/spack/spack.git -b $SPACK_VERSION spack else - cd /spack/spack + cd spack git fetch git checkout $SPACK_VERSION cd - fi - - /spack/spack/bin/spack gpg trust $GPG_PRIVATE_KEY + - spack/bin/spack gpg trust $GPG_PRIVATE_KEY - | mkdir -p /stack/extra_repos/ @@ -86,7 +92,7 @@ spack:setup: - | if [ ! -d /buildcache/build_cache ]; then - /spack/spack/bin/spack gpg publish -d /buildcache + spack/bin/spack gpg publish -d /buildcache fi - mkdir -p /stack/spack/etc @@ -103,19 +109,20 @@ spack:setup: spack:install_compilers: stage: compilers extends: + - .spack_cache - .parallel_job script: - COMPILER_LIST_SPECS=$(jq -r '.stack | .core_compiler as $core | .compilers | map("\(.spec)@\(.version) %\($core)")[]' config.json) - echo "Compilers to install ${COMPILER_LIST_SPECS}" - - /spack/spack/bin/spack spec + - spack/bin/spack spec --install-status --namespaces --long --types ${COMPILER_LIST_SPECS} - - /spack/spack/bin/spack install + - spack/bin/spack install --log-file spack-install.xml --log-format junit --fail-fast @@ -123,7 +130,7 @@ spack:install_compilers: --use-cache ${COMPILER_LIST_SPECS} - - /spack/spack/bin/spack buildcache create + - spack/bin/spack buildcache create --update-index --key EDC904DCE3D2E84E /buildcache ${COMPILER_LIST_SPECS} @@ -131,12 +138,12 @@ spack:install_compilers: - | echo 'definitions: [ compilers: [' ${COMPILER_LIST_SPECS} ']]' > compiler_definitions.yaml - - /spack/spack/bin/spack compiler find --scope site /usr + - spack/bin/spack compiler find --scope site /usr - | while read -r compiler do - /spack/spack/bin/spack compiler find --scope site $(/spack/spack/bin/spack location -i ${compiler}) + spack/bin/spack compiler find --scope site $(spack/bin/spack location -i ${compiler}) done <<< $(echo "${COMPILER_LIST_SPECS}") artifacts: reports: @@ -147,9 +154,10 @@ spack:install_compilers: spack:concretize: stage: concretize extends: + - .spack_cache - .parallel_job script: - - /spack/spack/bin/spack -e . concretize + - spack/bin/spack -e . concretize needs: - job: spack:install_compilers artifacts: @@ -159,9 +167,10 @@ spack:concretize: spack:install: stage: install extends: + - .spack_cache - .parallel_job script: - - /spack/spack/bin/spack -e . install + - spack/bin/spack -e . install --log-file spack-install.xml --log-format junit --only-concrete