.gitlab-ci.yml 4.89 KB
Newer Older
Whitney Armstrong's avatar
Whitney Armstrong committed
1
2
3
4
5
6
7
8
9
10
11
12
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:
13
    - source .local/bin/env.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
14
  artifacts:
15
    expire_in: 1 week 
Whitney Armstrong's avatar
Whitney Armstrong committed
16
    paths:
17
18
19
20
21
22
23
24
25
26
      - .local/detector
      - .local/lib
      - .local/bin
      - .local/include
      - .local/share
      - results
      - config
      - images
      - doc
      - juggler.env
27
      - geo
Whitney Armstrong's avatar
Whitney Armstrong committed
28
29
30
31
32
    reports:
      dotenv: juggler.env

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

41
42
43
44
common:setup:
  stage: config
  before_script:
    - git clone https://eicweb.phy.anl.gov/EIC/benchmarks/common_bench.git setup 
Whitney Armstrong's avatar
Whitney Armstrong committed
45
  script:
Jihee Kim's avatar
Jihee Kim committed
46
    - export JUGGLER_DETECTOR="reference_detector"
Whitney Armstrong's avatar
Whitney Armstrong committed
47
    - |
48
      if [[ "${CI_PIPELINE_SOURCE}" == "web"  || "${CI_PIPELINE_SOURCE}" == "webide"  || "${CI_PIPELINE_SOURCE}" == "merge_request_event"  || "$CI_COMMIT_BRANCH" == "master" ]]; then
Whitney Armstrong's avatar
Whitney Armstrong committed
49
        export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}"
50
51
        echo "BEAMLINE_CONFIG          = ${BEAMLINE_CONFIG}"
        echo "BEAMLINE_CONFIG_VERSION  = ${BEAMLINE_CONFIG_VERSION}"
Whitney Armstrong's avatar
Whitney Armstrong committed
52
53
54
55
56
        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
57
    - source setup/bin/env.sh && ./setup/bin/install_common.sh
Whitney Armstrong's avatar
Whitney Armstrong committed
58

59
60
61
62
63
64
65
66
67
68
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
69
70
71
72

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

.views:
  stage: docs
  needs:
81
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
82
83
84
85
86
87
88

include:
  - 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
89
90
91
92
93
  - 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
94

Sylvester Joosten's avatar
Sylvester Joosten committed
95
96
97
98
99
100
dump_geometry:
  stage: test
  needs:
    - common:detector
  script:
   - echo "dumping geometry"
101
102
103
104
105
106
107
   - mkdir -p geo
   ## full geo with downstream beamline
   - dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/reference_detector.xml
   ## only central detector geo
   - sed -i '/forward_ion_beamline/d' ${DETECTOR_PATH}/reference_detector.xml
   - sed -i '/far_forward/d' ${DETECTOR_PATH}/reference_detector.xml
   - dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/reference_detector.xml
Sylvester Joosten's avatar
Sylvester Joosten committed
108

Whitney Armstrong's avatar
Whitney Armstrong committed
109
110
111
112
report:
  stage: finalize
  needs: 
    - view_01
113
114
115
116
    - view_02
    - view_03
    - view_06
    - view_07
117
118
119
120
121
    - view_11
    - view_12
    - view_13
    - view_14
    - view_15
Whitney Armstrong's avatar
Whitney Armstrong committed
122
    - dump_constants
123
    - dump_geometry
Whitney Armstrong's avatar
Whitney Armstrong committed
124
125
126
127
  script:
    - pip3 install jinja2 &&  ls -lrth
    - ./bin/make_images > doc/dawn_views.md

Whitney Armstrong's avatar
Whitney Armstrong committed
128
129
130
dump_constants:
  stage: test
  needs: 
131
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
132
  script:
133
    - npdet_info dump ${DETECTOR_PATH}/reference_detector.xml  | tee doc/constants.out 
Whitney Armstrong's avatar
Whitney Armstrong committed
134
135
136
137

overlap_check:
  stage: test
  needs: 
138
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
139
  script:
140
    - checkOverlaps -c ${DETECTOR_PATH}/reference_detector.xml  | tee doc/overlap_check.out 
Whitney Armstrong's avatar
Whitney Armstrong committed
141
    - echo "$(cat doc/overlap_check.out | grep ovlp | wc -l) overlaps..."
142
    - 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
143

144
detector:config_testing:
Whitney Armstrong's avatar
Whitney Armstrong committed
145
146
  stage: test
  needs: 
147
    - ["common:detector"]
Whitney Armstrong's avatar
Whitney Armstrong committed
148
  script:
149
    - checkOverlaps -o 's' -c ${DETECTOR_PATH}/reference_detector.xml  | tee doc/overlap_check.out | wc -l
Whitney Armstrong's avatar
Whitney Armstrong committed
150
    - cat doc/overlap_check.out
151
152
153
154
155
156
157
158
159
160

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
161
162
  allow_failure: true

163

Whitney Armstrong's avatar
Whitney Armstrong committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
    #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
184