-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
274 lines (253 loc) · 9.88 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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_BRANCH == "acadia"'
- if: '$CI_COMMIT_TAG'
default:
before_script:
- source .local/bin/env.sh
artifacts:
expire_in: 1 week
paths:
- .local/detector
- .local/lib
- .local/bin
- .local/include
- .local/share
- results
- config
- images
- doc
- juggler.env
- geo
reports:
dotenv: juggler.env
stages:
- config
- build
- test
- docs
- collect
- 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
script:
- export JUGGLER_DETECTOR="athena"
- |
# 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}"
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
common:detector:
stage: build
needs:
- common:setup
script:
#- source .local/bin/env.sh && build_detector.sh
- build_detector.sh
- mkdir -p results
- mkdir -p config
- mkdir -p doc
- mkdir -p geo
- print_env.sh
build:simple:
stage: build
script:
- mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install && cd ..
- echo "Build successful."
.views:
stage: docs
tags:
- phy-scratch
before_script:
- source .local/bin/env.sh
- env
- pip3 install psutil
needs:
- ["common:detector"]
include:
- local: 'views/generate_prim_files.yml'
- 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'
- local: 'views/view20.yml'
dump_geometry:
stage: test
needs:
- common:detector
script:
- echo "dumping geometry"
## DEBUG
- echo "LD_LIBRARY_PATH - $LD_LIBRARY_PATH"
- echo "PATH - $PATH"
- print_env.sh
## DEBUG
- mkdir -p geo
- |
sed -i -e '/<detectors>/,/<\/detectors>/d' ${DETECTOR_PATH}/compact/tracking_config*.xml
mv ${DETECTOR_PATH}/compact/display_geoviewer.xml ${DETECTOR_PATH}/compact/display.xml
for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
echo $xml
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
## Lower-resolution display of the pfRICH sensors for global views
- sed -i 's/_default"\/>/_lores"\/>/' ${DETECTOR_PATH}/compact/pfrich.xml
## 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
- sed -i '/beampipe_hadron_B0/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/B0_/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/far_forward_offM/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/far_forward_detectors/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/roman_pots/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/inner_vacuum_FF_magnets/d' ${DETECTOR_PATH}/athena.xml
- dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/athena.xml
## print some useful output
- |
echo "Geometry viewer 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_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"
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:"
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"
done
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/definitions.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
report:
stage: finalize
needs:
- view_01
- view_02
- view_03
- view_06
- view_07
- view_11
- view_12
- view_13
- view_14
- view_15
- view_20
- dump_constants
- dump_geometry
- dump_gdml
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&"
dump_constants:
stage: test
needs:
- ["common:detector"]
script:
- npdet_info dump ${DETECTOR_PATH}/athena.xml | tee doc/constants.out
overlap_check_tgeo:
stage: test
needs:
- ["common:detector"]
script:
## disable fibers in ECAL for normal overlap check
- sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
- sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
- 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:full_fast:
stage: test
needs:
- ["common:detector"]
script:
## disable fibers in ECAL for normal overlap check
- sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
- sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
## reduce the number of fibers in Hadron EMCal for overlap check
## 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
- 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
## TODO: add real full overlap check as child pipeline to run on branches only
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
dump_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
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
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:
stage: test
needs:
- ["common:detector"]
script:
- checkOverlaps -o 's' -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check.out | wc -l
- 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_geant4:full_fast
- common:detector