.gitlab-ci.yml 9.88 KB
Newer Older
Whitney Armstrong's avatar
Whitney Armstrong committed
1
2
3
4
5
6
7
8
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"'
9
    - if: '$CI_COMMIT_BRANCH == "acadia"'
Whitney Armstrong's avatar
Whitney Armstrong committed
10
11
12
13
    - if: '$CI_COMMIT_TAG'

default:
  before_script:
14
    - source .local/bin/env.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
15
  artifacts:
16
    expire_in: 1 week 
Whitney Armstrong's avatar
Whitney Armstrong committed
17
    paths:
18
19
20
21
22
23
24
25
26
27
      - .local/detector
      - .local/lib
      - .local/bin
      - .local/include
      - .local/share
      - results
      - config
      - images
      - doc
      - juggler.env
28
      - geo
Whitney Armstrong's avatar
Whitney Armstrong committed
29
30
31
32
33
34
    reports:
      dotenv: juggler.env

stages:
  - config
  - build
35
  - test
Whitney Armstrong's avatar
Whitney Armstrong committed
36
  - docs
37
  - collect
Whitney Armstrong's avatar
Whitney Armstrong committed
38
39
40
  - finalize 
  - deploy

41
42
43
44
45
46
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
47
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
48
    - export JUGGLER_DETECTOR="athena"
Whitney Armstrong's avatar
Whitney Armstrong committed
49
    - |
Sylvester Joosten's avatar
Sylvester Joosten committed
50
      #      if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event"  || "$CI_COMMIT_BRANCH" == "master" ]]; then
Whitney Armstrong's avatar
Whitney Armstrong committed
51
        export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}"
52
53
        echo "BEAMLINE_CONFIG          = ${BEAMLINE_CONFIG}"
        echo "BEAMLINE_CONFIG_VERSION  = ${BEAMLINE_CONFIG_VERSION}"
Whitney Armstrong's avatar
Whitney Armstrong committed
54
55
56
57
        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
Sylvester Joosten's avatar
Sylvester Joosten committed
58
        #fi
59
    - source setup/bin/env.sh && ./setup/bin/install_common.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
60

61
common:detector:
62
63
64
  stage: build
  needs: 
    - common:setup
65
  script:
66
67
    #- source .local/bin/env.sh && build_detector.sh
    - build_detector.sh
68
69
70
    - mkdir -p results
    - mkdir -p config
    - mkdir -p doc
Whitney Armstrong's avatar
Whitney Armstrong committed
71
    - mkdir -p geo
72
    - print_env.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
73

74
build:simple:
Whitney Armstrong's avatar
Whitney Armstrong committed
75
76
  stage: build
  script:
Whitney Armstrong's avatar
Whitney Armstrong committed
77
    - mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install  && cd ..
Whitney Armstrong's avatar
Whitney Armstrong committed
78
79
    - echo "Build successful."

80

Whitney Armstrong's avatar
Whitney Armstrong committed
81
82
.views:
  stage: docs
83
84
  tags:
    - phy-scratch
85
86
  before_script:
    - source .local/bin/env.sh
87
    - env
88
    - pip3 install psutil
Whitney Armstrong's avatar
Whitney Armstrong committed
89
  needs:
90
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
91
92

include:
93
  - local: 'views/generate_prim_files.yml'
Whitney Armstrong's avatar
Whitney Armstrong committed
94
95
96
97
98
  - local: 'views/view1.yml'
  - local: 'views/view2.yml'
  - local: 'views/view3.yml'
  - local: 'views/view6.yml'
  - local: 'views/view7.yml'
Whitney Armstrong's avatar
Whitney Armstrong committed
99
100
101
102
103
  - 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
104
  - local: 'views/view20.yml'
Whitney Armstrong's avatar
Whitney Armstrong committed
105

Sylvester Joosten's avatar
Sylvester Joosten committed
106
107
108
109
110
dump_geometry:
  stage: test
  needs:
    - common:detector
  script:
111
    - echo "dumping geometry"
112
113
114
115
116
    ## DEBUG
    - echo "LD_LIBRARY_PATH - $LD_LIBRARY_PATH"
    - echo "PATH - $PATH"
    - print_env.sh
    ## DEBUG
117
118
    - mkdir -p geo
    - |
119
      sed -i -e '/<detectors>/,/<\/detectors>/d' ${DETECTOR_PATH}/compact/tracking_config*.xml
120
      mv ${DETECTOR_PATH}/compact/display_geoviewer.xml ${DETECTOR_PATH}/compact/display.xml
121
      for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
122
        echo $xml
123
124
125
126
        geo_name=`basename $xml .xml`_geo.root
        cp $xml ${DETECTOR_PATH}/geo.xml
        dd_web_display --output geo/${geo_name} ${DETECTOR_PATH}/geo.xml
      done
127
    ## Lower-resolution display of the pfRICH sensors for global views
128
    - sed -i 's/_default"\/>/_lores"\/>/' ${DETECTOR_PATH}/compact/pfrich.xml
129
130
131
132
    ## full geo with downstream beamline
    - dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/athena.xml
    ## only central detector geo
    - sed -i '/forward_ion_beamline/d' ${DETECTOR_PATH}/athena.xml
133
134
    - sed -i '/beampipe_hadron_B0/d' ${DETECTOR_PATH}/athena.xml
    - sed -i '/B0_/d' ${DETECTOR_PATH}/athena.xml
135
136
    - sed -i '/far_forward_offM/d' ${DETECTOR_PATH}/athena.xml
    - sed -i '/far_forward_detectors/d' ${DETECTOR_PATH}/athena.xml
137
    - sed -i '/roman_pots/d' ${DETECTOR_PATH}/athena.xml
138
    - sed -i '/inner_vacuum_FF_magnets/d' ${DETECTOR_PATH}/athena.xml
139
140
141
142
    - dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/athena.xml
    ## print some useful output
    - |
      echo "Geometry viewer at:"
143
144
145
      echo "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=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all"
      echo " - Central detector view at: "
      echo "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.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all"
146
147
148
      for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
        geo_name=`basename $xml .xml`_geo.root
        echo " - Subsystem view for `basename $xml .xml` at:"
149
        echo "   https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/${geo_name}?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all"
150
      done
Sylvester Joosten's avatar
Sylvester Joosten committed
151

152
153
154
155
156
157
158
159
160
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
161
      #  xmllint --format --xpath '//comment/text()' ${DETECTOR_PATH}/ip6/definitions.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
162
163
164
165
      #  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
166
167
168
169
report:
  stage: finalize
  needs: 
    - view_01
170
171
172
173
    - view_02
    - view_03
    - view_06
    - view_07
174
175
176
177
178
    - view_11
    - view_12
    - view_13
    - view_14
    - view_15
Whitney Armstrong's avatar
Whitney Armstrong committed
179
    - view_20
Whitney Armstrong's avatar
Whitney Armstrong committed
180
    - dump_constants
181
    - dump_geometry
182
    - dump_gdml
Whitney Armstrong's avatar
Whitney Armstrong committed
183
184
185
  script:
    - pip3 install jinja2 &&  ls -lrth
    - ./bin/make_images > doc/dawn_views.md
186
    - 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
187

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

195
overlap_check_tgeo:
Whitney Armstrong's avatar
Whitney Armstrong committed
196
197
  stage: test
  needs: 
198
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
199
  script:
200
201
    ## disable fibers in ECAL for normal overlap check
    - sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
202
    - sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
203
204
205
206
    - 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

207
overlap_check_geant4:full_fast:
208
209
210
211
  stage: test
  needs: 
    - ["common:detector"]
  script:
212
213
    ## disable fibers in ECAL for normal overlap check
    - sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
214
    - sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
215
    ## reduce the number of fibers in Hadron EMCal for overlap check
216
217
    ## not needed, as we are running with a different setup now
    #- sed -i 's/radius="EcalEndcapP_FiberRadius"/radius="EcalEndcapP_FiberRadius*10"/' ${DETECTOR_PATH}/compact/ci_ecal_scfi.xml
218
219
220
    - 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
221

222
223
## TODO: add real full overlap check as child pipeline to run on branches only

224
225
226
227
228
229
230
231
232
233
overlap_check_geant4:inner_detector:
  stage: test
  needs: 
    - ["common:detector"]
  script:
    - cp ${DETECTOR_PATH}/compact/subsystem_views/inner_detector.xml ${DETECTOR_PATH}/inner_detector.xml
    - python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/inner_detector.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

234
dump_gdml:
235
236
237
238
239
  stage: test
  needs: 
    - ["common:detector"]
  script:
    - mkdir -p geo
240
241
242
243
244
245
246
    - |
      python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/athena.xml --output geo/athena.gdml
      for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
        cp $xml ${DETECTOR_PATH}/geo.xml
        gdml_name=`basename $xml .xml`.gdml
        python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/geo.xml --output geo/${gdml_name}
      done
247

Whitney Armstrong's avatar
Whitney Armstrong committed
248
249
250
251
252
tracking_geometry_debug:
  stage: test
  needs: 
    - ["common:detector"]
  script:
253
    - root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/athena.xml\")" | tee geo/tracking_geometry_debug.out 
254
    - ./bin/acts_geo_check geo/tracking_geometry_debug.out
Whitney Armstrong's avatar
Whitney Armstrong committed
255

256
detector:config_testing:
Whitney Armstrong's avatar
Whitney Armstrong committed
257
258
  stage: test
  needs: 
259
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
260
  script:
Sylvester Joosten's avatar
Sylvester Joosten committed
261
    - checkOverlaps -o 's' -c ${DETECTOR_PATH}/athena.xml  | tee doc/overlap_check.out | wc -l
Whitney Armstrong's avatar
Whitney Armstrong committed
262
    - cat doc/overlap_check.out
263
264
265
266
267
268
269
270
271

benchmarks:detector:
  stage: deploy
  variables:
    JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
    JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
  trigger:
    project: EIC/benchmarks/detector_benchmarks
    strategy: depend
272
  needs: 
273
    - overlap_check_geant4:full_fast
274
    - common:detector