From 736af1f5678a484e94884a5c61fb05f5ef96f4a6 Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Tue, 13 Apr 2021 20:08:28 -0500
Subject: [PATCH] 	modified:   .gitlab-ci.yml

---
 .gitlab-ci.yml | 138 +++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 117 insertions(+), 21 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 804c834b..d62de6b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,79 +2,174 @@ image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:$JUGGLER_TAG
 
 default:
   artifacts:
-    expire_in: 20 weeks
+    expire_in: 120 mins
     paths:
       - results/
       - datasets/
       - sim_output/
       - data
-    reports:
-      dotenv: juggler.env
+        #    exclude:
+        #      - .git/
+        #      - datasets/.git/
   before_script:
     - git clone https://eicweb.phy.anl.gov/EIC/NPDet.git
-      #- git clone https://eicweb.phy.anl.gov/EIC/NPDet.git && mkdir NPDet/build && cd NPDet/build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 install && cd ../..
     - git clone https://eicweb.phy.anl.gov/EIC/detectors/topside.git && mkdir topside/build && cd topside/build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 install && cd ../..
-    - git clone https://eicweb.phy.anl.gov/EIC/detectors/accelerator.git && cd topside && ln -s ../accelerator/eic && cd ../.
+        #    - cd NPDet/build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j10 && make install
 
 stages:
+  - initialize
   - data_init
   - simulate
   - benchmarks
   - deploy
+    #- others
+
+detector:
+  stage: initialize
+  needs: []
+  timeout: 1 hours
+  cache:
+    key:
+      files:
+        - config/env.sh
+        - util/build_detector.sh
+      prefix: "$CI_COMMIT_REF_SLUG"
+    paths:
+      - .local/detector
+      - .local/lib
+  artifacts:
+    paths:
+      - .local/detector
+      - .local/lib
+      - results
+      - config
+  script:
+    - ./util/print_env.sh
+    - ./util/build_detector.sh
+    - ./util/print_env.sh
+    - mkdir -p results
+    - mkdir -p config
 
 get_data:
   stage: data_init
-  tags:
-    - silicon
+  needs: ["detector"]
   script:
-    - git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
+    - git clone --depth=1 https://eicweb.phy.anl.gov/EIC/datasets.git datasets
     - ln -s datasets/data
     - mkdir -p results
     - mkdir -p sim_output
 
+#generate_config:
+#  stage: ci_gen
+#  tags:
+#    - silicon
+#  script:
+#    - ./bin/gen_ci_config -p track_test_ -i trackers > results/trackers_config.yml
+#    - ./bin/gen_ci_config -p cal_test_   -i calorimeters > results/calorimeters_config.yml
+#    - ./bin/gen_ci_config -p pid_test_   -i pid > results/pid_config.yml
+
 roman_pot_simu:
   stage: simulate
   needs: 
-    - ["get_data"]
-  tags:
-    - silicon
+    - ["get_data","detector"]
   script:
     - cp NPDet/src/detectors/trackers/compact/elements.xml ./.
     - cp NPDet/src/detectors/trackers/compact/materials.xml ./.
-    - bash trackers/roman_pot_simu.sh
+    - bash benchmarks/trackers/roman_pot_simu.sh
 
 roman_pot_nhits:
   stage: benchmarks
   needs:
-    - ["roman_pot_simu"]
-  tags:
-    - silicon
+    - ["roman_pot_simu","detector"]
   script:
-    - root -b -q trackers/simple_tracking.cxx+
+    - root -b -q benchmarks/trackers/simple_tracking.cxx+
   allow_failure: true
 
 roman_pot_eta:
   stage: benchmarks
+  needs:
+    - ["roman_pot_simu","detector"]
+  script:
+    - root -b -q benchmarks/trackers/roman_pot_hit_eta.cxx+
+  allow_failure: true
+
+zdc_simulation:
+  stage: simulate
+  needs: 
+    - ["get_data","detector"]
+  script:
+    - cp NPDet/src/detectors/calorimeters/compact/elements.xml ./.
+    - cp NPDet/src/detectors/calorimeters/compact/materials.xml ./.
+    - bash benchmarks/calorimeters/run_simulation_zdc.sh
+
+cal_test_3_zdc_neutrons_reader:
+  stage: benchmarks
+  needs: 
+    - ["zdc_simulation","detector"]
+  script:
+    - root -b -q benchmarks/calorimeters/zdc_neutrons_reader.cxx
+  allow_failure: true
+
+
+zdc_benchmark:
+  stage: benchmarks
+  needs: 
+    - ["zdc_simulation","detector"]
+  script:
+    - ls -lrth sim_output
+    - root -b -q benchmarks/calorimeters/simple_checking.cxx+
+  allow_failure: true
+
+zdc_benchmark_info_histogram:
+  stage: benchmarks
+  needs: 
+    - ["zdc_simulation","detector"]
+  script:
+    - cp NPDet/src/detectors/calorimeters/compact/elements.xml calorimeters/
+    - cp NPDet/src/detectors/calorimeters/compact/materials.xml calorimeters/
+    - root -b -q benchmarks/calorimeters/simple_info_plot_histograms.cxx+
+  allow_failure: true
+
+crystal_emcal_simulation:
+  stage: simulate
+  needs: 
+    - ["get_data","detector"]
   tags:
     - silicon
+  script:
+    - cp NPDet/src/detectors/calorimeters/compact/elements.xml ./.
+    - cp NPDet/src/detectors/calorimeters/compact/materials.xml ./.
+    - bash benchmarks/calorimeters/run_simulation_crystal.sh
+
+crystal_benchmark:
+  stage: benchmarks
   needs:
-    - ["roman_pot_simu"]
+    - ["crystal_emcal_simulation","detector"]
   script:
-    - root -b -q trackers/roman_pot_hit_eta.cxx+
+    - ls -lrth sim_output
+    - root -b -q benchmarks/calorimeters/simple_checking_crystal.cxx+
   allow_failure: true
 
-include:
-  - local: 'calorimeters/calorimeters_config.yml'
+crystal_pion_simulation:
+  stage: simulate
+  needs:
+    - ["get_data","detector"]
+  tags:
+    - silicon
+  script:
+    - source options/env.sh
+    - npsim --runType batch --numberOfEvents 100 --compactFile ${DETECTOR_PATH}/topside.xml --inputFiles  data/emcal_electrons.hepmc  --outputFile  sim_output/output_emcal_electrons.root
 
 deploy_results:
   stage: deploy
   needs:
-    - ["ben_emcal_barrel_electrons"]
+    - ["zdc_benchmark","zdc_benchmark_info_histogram","detector"]
   tags:
     - silicon
   script:
     - echo "deploy results!"
 
+
 pages:
   stage: deploy
   rules:
@@ -89,3 +184,4 @@ pages:
     paths:
       - public
 
+
-- 
GitLab