Skip to content
Snippets Groups Projects
.gitlab-ci.yml 7.12 KiB
Newer Older
image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:$JUGGLER_TAG
Whitney Armstrong's avatar
Whitney Armstrong committed

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_PIPELINE_SOURCE == "web"'
    - if: '$CI_PIPELINE_SOURCE == "webide"'
    - if: '$CI_COMMIT_BRANCH == "master"'
    - if: '$CI_COMMIT_TAG'

default:
  tags:
    - phy-scratch
  artifacts:
    expire_in: 72 hours 
    paths:
      - .local/detector
      - .local/lib
Whitney Armstrong's avatar
Whitney Armstrong committed
      - .local/bin
      - .local/include
      - .local/share
      - juggler.env
    reports:
      dotenv: juggler.env
stages:
  - status-pending
  - config
  - initialize
  - data_init
  - simulate
  - benchmarks
  - deploy
  script:
    - |
      if [ -n "${GITHUB_SHA}" ] ; then
        curl \
          -X POST \
          -H "Accept: application/vnd.github+json" \
          -H "Authorization: token ${GITHUB_REPO_STATUS_TOKEN}" \
          "https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
          -d '{"state":"'"${STATE}"'",
               "target_url":"'"${CI_PIPELINE_URL}"'",
               "description":"'"${DESCRIPTION}"'",
               "context":"eicweb/detector_benchmarks ('"$DETECTOR_CONFIG"')"

benchmarks:detector:pending:
  stage: status-pending
  extends: .status
  variables:
    STATE: "pending"
    DESCRIPTION: "The detector benchmarks are running..."
  when: always

Whitney Armstrong's avatar
Whitney Armstrong committed
common:setup:
Whitney Armstrong's avatar
Whitney Armstrong committed
      if [[ "${COMMON_BENCH_VERSION}" == "" ]] ; then
        export COMMON_BENCH_VERSION="master" 
      fi
      echo "COMMON_BENCH_VERSION = ${COMMON_BENCH_VERSION}" 
      git clone -b "${COMMON_BENCH_VERSION}" https://eicweb.phy.anl.gov/EIC/benchmarks/common_bench.git setup 
  script:
    - |
      if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event"  || "$CI_COMMIT_BRANCH" == "master" ]]; then
        echo "DETECTOR               = ${DETECTOR}"
        echo "DETECTOR_CONFIG        = ${DETECTOR_CONFIG}"
        echo "DETECTOR_VERSION       = ${DETECTOR_VERSION}"
        echo "DETECTOR_REPOSITORYURL = ${DETECTOR_REPOSITORYURL}"
        echo "DETECTOR=$DETECTOR" >> juggler.env
        echo "DETECTOR_CONFIG=$DETECTOR_CONFIG" >> juggler.env
        echo "DETECTOR_VERSION=$DETECTOR_VERSION" >> juggler.env
        echo "DETECTOR_REPOSITORYURL=$DETECTOR_REPOSITORYURL" >> juggler.env
        echo "DETECTOR_DEPLOY_TOKEN_USERNAME=${DEPLOY_TOKEN_USERNAME}" >> juggler.env
        echo "DETECTOR_DEPLOY_TOKEN_PASSWORD=${DEPLOY_TOKEN_PASSWORD}" >> juggler.env
Whitney Armstrong's avatar
Whitney Armstrong committed
        echo "COMMON_BENCH_VERSION=$COMMON_BENCH_VERSION" >> juggler.env
        if [[ "${DETECTOR}" == "" ]] ; then
          export DETECTOR="epic" 
        if [[ "${DETECTOR_CONFIG}" == "" ]] ; then
          export DETECTOR_CONFIG="${DETECTOR}"
        if [[ "${DETECTOR_VERSION}" == "" ]] ; then
          export DETECTOR_VERSION="main" 
        if [[ "${DETECTOR_REPOSITORYURL}" == "" ]] ; then
          export DETECTOR_REPOSITORYURL="https://github.com/eic/${DETECTOR}"
        fi
        echo "DETECTOR               = ${DETECTOR}"
        echo "DETECTOR_CONFIG        = ${DETECTOR_CONFIG}"
        echo "DETECTOR_VERSION       = ${DETECTOR_VERSION}"
        echo "DETECTOR_REPOSITORYURL = ${DETECTOR_REPOSITORYURL}"
        echo "DETECTOR=$DETECTOR" >> juggler.env
        echo "DETECTOR_CONFIG=$DETECTOR_CONFIG" >> juggler.env
        echo "DETECTOR_VERSION=$DETECTOR_VERSION" >> juggler.env
        echo "DETECTOR_REPOSITORYURL=$DETECTOR_REPOSITORYURL" >> juggler.env
        echo "COMMON_BENCH_VERSION=$COMMON_BENCH_VERSION" >> juggler.env
Whitney Armstrong's avatar
Whitney Armstrong committed
    - source setup/bin/env.sh && ./setup/bin/install_common.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
common:detector:
Whitney Armstrong's avatar
Whitney Armstrong committed
  needs: ["common:setup"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
Whitney Armstrong's avatar
Whitney Armstrong committed
    - source .local/bin/env.sh && build_detector.sh
    - mkdir_local_data_link sim_output
    - mkdir -p results
    - mkdir -p config
Whitney Armstrong's avatar
Whitney Armstrong committed
    - print_env.sh
get_data:
  stage: data_init
Whitney Armstrong's avatar
Whitney Armstrong committed
  needs: ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
    - source .local/bin/env.sh
    - ln -s "${LOCAL_DATA_PATH}/sim_output" sim_output
    - ln -s "${LOCAL_DATA_PATH}/datasets/data" data
    - cd ${LOCAL_DATA_PATH} && git clone --depth=1 https://eicweb.phy.anl.gov/EIC/datasets.git datasets
.det_benchmark:
  image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:$JUGGLER_TAG
Whitney Armstrong's avatar
Whitney Armstrong committed
  needs:
Whitney Armstrong's avatar
Whitney Armstrong committed
    - ["get_data","common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
    - source .local/bin/env.sh
    - ls -lrtha 
    - ln -s "${LOCAL_DATA_PATH}/sim_output" sim_output
    - ln -s "${LOCAL_DATA_PATH}/datasets/data" data
    - ls -lrtha
  retry:
    max: 2
    when:
      - runner_system_failure
Tom Polakovic's avatar
Tom Polakovic committed

  - local: 'benchmarks/tracking_detectors/config.yml'
  - local: 'benchmarks/barrel_ecal/config.yml'
  - local: 'benchmarks/barrel_hcal/config.yml'
  - local: 'benchmarks/roman_pots/config.yml'
  - local: 'benchmarks/zdc/config.yml'
  - local: 'benchmarks/crystal_calorimeter/config.yml'
  - local: 'benchmarks/material_maps/config.yml'
  - local: 'benchmarks/pid/config.yml'
  - local: 'benchmarks/timing/config.yml'
Whitney Armstrong's avatar
Whitney Armstrong committed
  - local: 'benchmarks/b0_tracker/config.yml'
  - local: 'benchmarks/others/config.yml'
deploy_results:
  stage: deploy
    - ["collect_results:zdc","collect_results:barrel_ecal","collect_results:barrel_hcal","collect_results:crystal_calorimeter","collect_results:materialscan"]
  script:
    - echo "deploy results!"

benchmarks:detector:success:
  stage: status-report
  extends: .status
  variables:
    STATE: "success"
    DESCRIPTION: "The detector benchmarks succeeded!"
  when: on_success

benchmarks:detector:failure:
  stage: status-report
  extends: .status
  variables:
    STATE: "failure"
    DESCRIPTION: "The detector benchmarks failed!"
  when: on_failure
benchmarks:reconstruction:
  stage: trigger
  variables:
    GITHUB_SHA: "${GITHUB_SHA}"
    GITHUB_REPOSITORY: "${GITHUB_REPOSITORY}"
    DETECTOR: "$DETECTOR"
    DETECTOR_CONFIG: "$DETECTOR_CONFIG"
    DETECTOR_VERSION: "$DETECTOR_VERSION"
    DETECTOR_REPOSITORYURL: "$DETECTOR_REPOSITORYURL"
    DETECTOR_DEPLOY_TOKEN_USERNAME: "${DETECTOR_DEPLOY_TOKEN_USERNAME}"
    DETECTOR_DEPLOY_TOKEN_PASSWORD: "${DETECTOR_DEPLOY_TOKEN_PASSWORD}"
  trigger:
    project: EIC/benchmarks/reconstruction_benchmarks
    strategy: depend
  needs: ["deploy_results"]

benchmarks:physics:
  stage: trigger
  variables:
    GITHUB_SHA: "${GITHUB_SHA}"
    GITHUB_REPOSITORY: "${GITHUB_REPOSITORY}"
    DETECTOR: "$DETECTOR"
    DETECTOR_CONFIG: "$DETECTOR_CONFIG"
    DETECTOR_VERSION: "$DETECTOR_VERSION"
    DETECTOR_REPOSITORYURL: "$DETECTOR_REPOSITORYURL"
    DETECTOR_DEPLOY_TOKEN_USERNAME: "${DETECTOR_DEPLOY_TOKEN_USERNAME}"
    DETECTOR_DEPLOY_TOKEN_PASSWORD: "${DETECTOR_DEPLOY_TOKEN_PASSWORD}"
  trigger:
    project: EIC/benchmarks/physics_benchmarks
    strategy: depend
  needs: ["deploy_results"]
Whitney Armstrong's avatar
Whitney Armstrong committed
pages:
  stage: deploy
  rules:
    - if: '$CI_COMMIT_BRANCH == "master" && $CI_SERVER_HOST != "eicweb.phy.anl.gov"'
  cache:
    paths:
      - node_modules/
  image: node:latest
  script:
    - mkdir public && cp doc/main.html public/index.html
  artifacts:
    paths:
      - public