diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a3e731462bdebaf88852cc63f0a0b4a644dfe71..02b605eb5d942790ac55724aff67d89c1486d8a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,6 +69,15 @@ common:detector: - print_env.sh - ls -lrth +common:eicrecon: + stage: initialize + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: ["common:setup"] + script: + - source .local/bin/env.sh && build_eicrecon.sh + + detector_benchmarks: stage: benchmarks rules: @@ -85,7 +94,9 @@ detector_benchmarks: DETECTOR_CONFIG: 'epic_arches' DETECTOR_VERSION: 'main' DETECTOR_REPOSITORYURL: 'https://github.com/eic/epic.git' + EICRECON_REPOSITORYURL: 'https://github.com/eic/EICrecon.git' - DETECTOR: 'epic' DETECTOR_CONFIG: 'epic_brycecanyon' DETECTOR_VERSION: 'main' DETECTOR_REPOSITORYURL: 'https://github.com/eic/epic.git' + EICRECON_REPOSITORYURL: 'https://github.com/eic/EICrecon.git' diff --git a/bin/build_eicrecon.sh b/bin/build_eicrecon.sh new file mode 100755 index 0000000000000000000000000000000000000000..14851c57400c4e0d2c632a07d30297a5c2dc2d40 --- /dev/null +++ b/bin/build_eicrecon.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +## ============================================================================= +## Build and install the EICrecon package into our local prefix +## ============================================================================= + +## ============================================================================= +## Load the environment variables. To build the detector we need the following +## variables: +## +## - LOCAL_PREFIX: location where local packages should be installed + +if [ -n "${LOCAL_PREFIX}" ] ; then + source .local/bin/env.sh +else + source ${LOCAL_PREFIX}/bin/env.sh +fi + + +## ============================================================================= +## Step 1: download/update the detector definitions (if needed) +pushd "$(mktemp -d)" + +echo "Fetching EICrecon" +if [ -n "${DETECTOR_DEPLOY_TOKEN_USERNAME:-}" -a -n "${DETECTOR_DEPLOY_TOKEN_PASSWORD:-}" ]; then + DEPLOY_TOKEN="${DETECTOR_DEPLOY_TOKEN_USERNAME}:${DETECTOR_DEPLOY_TOKEN_PASSWORD}@" + echo "Deploy token for ${DETECTOR_DEPLOY_TOKEN_USERNAME} is masked in the next line." +else + DEPLOY_TOKEN="" +fi +echo "git clone -b ${EICRECON_VERSION} --depth 1 ${EICRECON_REPOSITORYURL:-https://eicweb.phy.anl.gov/EIC/eicrecons/EICrecon.git} EICrecon" +git clone -b ${EICRECON_VERSION} --depth 1 ${EICRECON_REPOSITORYURL:-https://${DEPLOY_TOKEN}eicweb.phy.anl.gov/EIC/eicrecons/EICrecon.git} EICrecon +rm -rf "EICrecon/.git" + +## ============================================================================= +## Step 2: Compile and install the detector definition +echo "Building and installing the ${DETECTOR} package" + +cd EICrecon +cmake -DCMAKE_INSTALL_PREFIX=${LOCAL_PREFIX} && make -j$(($(nproc)/4+1)) install || exit 1 +TO_REMOVE="$PWD" +popd +rm -rf "$TO_REMOVE" +unset TO_REMOVE + +## ============================================================================= +## Step 3: That's all! +echo "Detector build/install complete!" diff --git a/bin/env.sh b/bin/env.sh index e1c9e1fa01f73278e4644d28c5a191c9a7a74f34..190931b574d4d82bb89de93b53ef9f00c469a6e8 100755 --- a/bin/env.sh +++ b/bin/env.sh @@ -127,6 +127,12 @@ echo "LOCAL_DATA_PATH=${LOCAL_DATA_PATH}" >> .env echo "Adding LOCAL_PREFIX to PATH and LD_LIBRARY_PATH" export PATH=${LOCAL_PREFIX}/bin:${PATH} export LD_LIBRARY_PATH=${LOCAL_PREFIX}/lib:${LD_LIBRARY_PATH} +if [ -d "${LOCAL_PREFIX}/lib/EICrecon/plugins" ]; then + echo "Using EICrecon plugins from ${LOCAL_PREFIX}/lib/EICrecon/plugins" + export JANA_PLUGIN_PATH=${LOCAL_PREFIX}/lib/EICrecon/plugins +else + echo "The ${LOCAL_PREFIX}/lib/EICrecon/plugins doesn't exist" +fi # Local field maps mkdir -p ${LOCAL_DATA_PATH}/fieldmaps