Skip to content

Commit

Permalink
CI: simplify sections
Browse files Browse the repository at this point in the history
  • Loading branch information
rbberger committed Aug 29, 2023
1 parent 7d99e5a commit ea44c51
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ variables:
SINGULARITY_EOS_CUDA_VERSION: "11.6.0"
SINGULARITY_EOS_BUILD_TYPE: "RelWithDebInfo"
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+mpi+hdf5+python+tests%gcc@${SINGULARITY_EOS_GCC_VERSION} ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"
COLOR_CYAN: '\033[1;36m'
COLOR_PLAIN: '\033[0m'
COLOR_CYAN: "\e[1;36m"
COLOR_PLAIN: "\e[0m"
# set to different spack upstream for testing
SINGULARITY_EOS_TEMP_SPACK_DIR: ""
# uncomment for debugging the CI and persist the Spack installation
# SPACK_USER_CACHE_PATH: "${CI_PROJECT_DIR}/spack-local"
# DEVEL_SPACK_CHECKOUT: "${CI_PROJECT_DIR}/spack"

before_script:
- echo "Running on $(hostname)"
- section() { echo $'\e[0K'"section_$1:$(date +%s):$2"$'\r\e[0K'"${3+${COLOR_CYAN}$3${COLOR_PLAIN}}"; }
- export PYTHONNOUSERSITE=1
- export SPACK_DISABLE_LOCAL_CONFIG=true
- export SPACK_USER_CACHE_PATH=${SPACK_USER_CACHE_PATH:-/tmp/spack-local}
- export DEVEL_SPACK_CHECKOUT=${DEVEL_SPACK_CHECKOUT:-/tmp/spack}
- export SINGULARITY_EOS_SPACK_DIR=${SINGULARITY_EOS_TEMP_SPACK_DIR:=$XCAP_OSS_SPACK_DIR}
- echo -e "\e[0Ksection_start:`date +%s`:spack_init[collapsed=true]\r\e[0K${COLOR_CYAN}Creating Spack instance at ${DEVEL_SPACK_CHECKOUT}${COLOR_PLAIN}"
- section start "spack_init[collapsed=true]" "Creating Spack instance at ${DEVEL_SPACK_CHECKOUT}"
- |
rsync -rpl \
--exclude=".git" \
Expand All @@ -39,7 +41,7 @@ before_script:
- source ${DEVEL_SPACK_CHECKOUT}/share/spack/setup-env.sh
- spack --version
- spack compiler list
- echo -e "\e[0Ksection_end:`date +%s`:spack_init\r\e[0K"
- section end spack_init

##########################
# Build Matrix Variables #
Expand Down Expand Up @@ -109,17 +111,17 @@ before_script:
- |
if [[ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]];
then
echo -e "\e[0Ksection_start:`date +%s`:spack_build[collapsed=true]\r\e[0K${COLOR_CYAN}Building via Spack${COLOR_PLAIN}"
section start "spack_build[collapsed=true]" "Building via Spack"
mkdir -p spack_build_env
spack env create spack_build_env
spack env activate spack_build_env
spack repo add spack-repo
spack config add upstreams:default:install_tree:${SINGULARITY_EOS_SPACK_DIR}/opt/spack/
spack dev-build -j $(nproc) ${SINGULARITY_EOS_SPACK_SPEC}
spack env deactivate
echo -e "\e[0Ksection_end:`date +%s`:spack_build\r\e[0K"
section end spack_build
fi
- echo -e "\e[0Ksection_start:`date +%s`:spack_env[collapsed=true]\r\e[0K${COLOR_CYAN}Creating Spack environment${COLOR_PLAIN}"
- section start "spack_env[collapsed=true]" "Creating Spack environment"
- mkdir -p spack_env
- spack env create spack_env
- spack env activate spack_env
Expand All @@ -128,7 +130,7 @@ before_script:
- spack spec -I ${SINGULARITY_EOS_SPACK_SPEC}
- spack add ${SINGULARITY_EOS_SPACK_SPEC}
- spack install -j $(nproc) --show-log-on-error --no-checksum --yes-to-all -u cmake
- echo -e "\e[0Ksection_end:`date +%s`:spack_env\r\e[0K"
- section end spack_env
- |
if [[ -n ${SINGULARITY_USE_CUDA} ]];
then
Expand Down

0 comments on commit ea44c51

Please sign in to comment.