Skip to content
Snippets Groups Projects
.gitlab-ci.yml 8.06 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
    - mkdir -p geo
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
  before_script:
    - source .local/bin/env.sh
      #    - sed -i 's?<support inside?<\!--support inside?' compact/ecal_barrel_hybrid.xml 
      #    - sed -i 's?</support>?</support-->?' compact/ecal_barrel_hybrid.xml
      #    - sed -i 's?<fiber material?<\!--fiber material?' compact/ecal_barrel_interlayers.xml 
      #    - sed -i 's?</fiber>?</fiber-->?' compact/ecal_barrel_interlayers.xml
      #    - echo $DETECTOR_PATH
      #    - cp compact/ecal_barrel_interlayers.xml ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
Whitney Armstrong's avatar
Whitney Armstrong committed
  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

ce_ecal_placement:
  stage: test
  needs:
    - common:detector
  script:
    - python scripts/ce_ecal_placement.py --save ce_ecal_crystal_glass.xml
    - mv ce_ecal_placement.png doc/ce_ecal_placement.png
    - if ! diff ce_ecal_crystal_glass.xml compact/ce_ecal_crystal_glass.xml ; then echo "ce_ecal_crystal_glaxs.xml not reproducible" && false ; fi
    - echo "EndcapN layout at https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/ce_ecal_placement.png"

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
   - echo "Geometry viewer at https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo_full.root?job=dump_geometry&item=default;1&opt=clipxyz;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&"
detector_documentation:
  stage: docs
  needs:
    - common:detector
  script:
    - mkdir -p doc
    - bash bin/build_documentation | tee doc/detector.md
      #- |
      #  xmllint --format --xpath '//comment/text()' ${DETECTOR_PATH}/athena.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee  doc/detector.md
      #  xmllint --format --xpath '//comment/text()' ${DETECTOR_PATH}/ip6/ip6_defs.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
      #  for afile in ${DETECTOR_PATH}/compact/*.xml ; do
      #    xmllint --format --xpath '//comment/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
      #  done

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
    - ce_ecal_placement
Whitney Armstrong's avatar
Whitney Armstrong committed
  script:
    - pip3 install jinja2 &&  ls -lrth
    - ./bin/make_images > doc/dawn_views.md
    - echo "Geometry viewer at https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo_full.root?job=finalize&item=default;1&opt=clipxyz;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&"
Whitney Armstrong's avatar
Whitney Armstrong committed

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

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

convert_to_gdml:
  stage: test
  needs: 
    - ["common:detector"]
  script:
    - mkdir -p geo
    - python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/athena.xml --output geo/athena.gdml

tracking_geometry_debug:
  stage: test
  needs: 
    - ["common:detector"]
  script:
    - root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/athena.xml\")" | tee geo/tracking_geometry_debug.out 
    - ./bin/acts_geo_check geo/tracking_geometry_debug.out
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_tgeo","report"]
Whitney Armstrong's avatar
Whitney Armstrong committed

    #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_tgeo","overlap_check_geant4","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_tgeo","overlap_check_geant4","report"]
Whitney Armstrong's avatar
Whitney Armstrong committed