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

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:
  before_script:
    - source .local/bin/env.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
  artifacts:
    expire_in: 1 week 
Whitney Armstrong's avatar
Whitney Armstrong committed
    paths:
      - .local/detector
      - .local/lib
      - .local/bin
      - .local/include
      - .local/share
      - results
      - config
      - images
      - doc
      - juggler.env
Whitney Armstrong's avatar
Whitney Armstrong committed
    reports:
      dotenv: juggler.env

stages:
  - config
Whitney Armstrong's avatar
Whitney Armstrong committed
  - build
  - docs
  - test 
Whitney Armstrong's avatar
Whitney Armstrong committed
  - finalize 
  - deploy

common:setup:
  stage: config
  rules:
    - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' 
  before_script:
    - git clone https://eicweb.phy.anl.gov/EIC/benchmarks/common_bench.git setup 
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
    - export JUGGLER_DETECTOR="athena"
Whitney Armstrong's avatar
Whitney Armstrong committed
    - |
      if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event"  || "$CI_COMMIT_BRANCH" == "master" ]]; then
        export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}"
        echo "BEAMLINE_CONFIG          = ${BEAMLINE_CONFIG}"
        echo "BEAMLINE_CONFIG_VERSION  = ${BEAMLINE_CONFIG_VERSION}"
Whitney Armstrong's avatar
Whitney Armstrong committed
        echo "JUGGLER_DETECTOR         = ${JUGGLER_DETECTOR}"
        echo "JUGGLER_DETECTOR_VERSION = ${CI_COMMIT_REF_NAME}"
        echo "JUGGLER_DETECTOR_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env
        echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
      fi
    - source setup/bin/env.sh && ./setup/bin/install_common.sh
Whitney Armstrong's avatar
Whitney Armstrong committed

common:detector:
  stage: initialize
  needs: ["common:setup"]
  script:
    - source .local/bin/env.sh && build_detector.sh
    - mkdir_local_data_link sim_output
    - mkdir -p results
    - mkdir -p config
    - mkdir -p doc
    - print_env.sh
Whitney Armstrong's avatar
Whitney Armstrong committed

compile:
  stage: build
  needs:
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
    - mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install  && cd ..
Whitney Armstrong's avatar
Whitney Armstrong committed
    - echo "Build successful."

.views:
  stage: docs
  needs:
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed

include:
  - local: 'views/view1.yml'
  - local: 'views/view2.yml'
  - local: 'views/view3.yml'
  - local: 'views/view6.yml'
  - local: 'views/view7.yml'
  - local: 'views/view11.yml'
  - local: 'views/view12.yml'
  - local: 'views/view13.yml'
  - local: 'views/view14.yml'
  - local: 'views/view15.yml'
Whitney Armstrong's avatar
Whitney Armstrong committed

dump_geometry:
  stage: test
  needs:
    - common:detector
  script:
   - echo "dumping geometry"
   - mkdir -p geo
   ## full geo with downstream beamline
Sylvester Joosten's avatar
Sylvester Joosten committed
   - dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/athena.xml
   ## only central detector geo
Sylvester Joosten's avatar
Sylvester Joosten committed
   - sed -i '/forward_ion_beamline/d' ${DETECTOR_PATH}/athena.xml
   - sed -i '/far_forward/d' ${DETECTOR_PATH}/athena.xml
   - dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/athena.xml
Whitney Armstrong's avatar
Whitney Armstrong committed
report:
  stage: finalize
  needs: 
    - view_01
    - view_11
    - view_12
    - view_13
    - view_14
    - view_15
Whitney Armstrong's avatar
Whitney Armstrong committed
    - dump_constants
    - dump_geometry
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
    - pip3 install jinja2 &&  ls -lrth
    - ./bin/make_images > doc/dawn_views.md

Whitney Armstrong's avatar
Whitney Armstrong committed
dump_constants:
  stage: test
  needs: 
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
    - npdet_info dump ${DETECTOR_PATH}/athena.xml  | tee doc/constants.out 
Whitney Armstrong's avatar
Whitney Armstrong committed

overlap_check:
  stage: test
  needs: 
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
    - checkOverlaps -c ${DETECTOR_PATH}/athena.xml  | tee doc/overlap_check.out 
Whitney Armstrong's avatar
Whitney Armstrong committed
    - echo "$(cat doc/overlap_check.out | grep ovlp | wc -l) overlaps..."
    - if [[ "$(cat doc/overlap_check.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
Whitney Armstrong's avatar
Whitney Armstrong committed

detector:config_testing:
Whitney Armstrong's avatar
Whitney Armstrong committed
  stage: test
  needs: 
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
    - checkOverlaps -o 's' -c ${DETECTOR_PATH}/athena.xml  | tee doc/overlap_check.out | wc -l
Whitney Armstrong's avatar
Whitney Armstrong committed
    - cat doc/overlap_check.out

benchmarks:detector:
  stage: deploy
  variables:
    JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
    JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
  trigger:
    project: EIC/benchmarks/detector_benchmarks
    strategy: depend
  needs: ["overlap_check","report"]
Whitney Armstrong's avatar
Whitney Armstrong committed
  allow_failure: true

    #benchmarks:reconstruction:
    #  stage: deploy
    #  variables:
    #    JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
    #    JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
    #  trigger:
    #    project: EIC/benchmarks/reconstruction_benchmarks
    #    strategy: depend
    #  needs: ["env","overlap_check","report"]
    #  
    #
    #benchmarks:physics:
    #  stage: deploy
    #  variables:
    #    JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
    #    JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
    #  trigger:
    #    project: EIC/benchmarks/physics_benchmarks
    #    strategy: depend
    #  needs: ["env","overlap_check","report"]
Whitney Armstrong's avatar
Whitney Armstrong committed