Skip to content

Commit

Permalink
Merge pull request #129 from rest-for-physics/cmake-ctest
Browse files Browse the repository at this point in the history
Support for testing framework
  • Loading branch information
lobis authored Mar 28, 2022
2 parents 58970c5 + 6f85645 commit b05be52
Show file tree
Hide file tree
Showing 16 changed files with 342 additions and 288 deletions.
199 changes: 74 additions & 125 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ stages:
# Basic checks to verify correctness of code
- pre-build

# Build and run tests
- test

# Project compilation validation
- build

Expand Down Expand Up @@ -41,22 +44,16 @@ stages:
before_script:
- pwd
- export USER="test"
# - export GIT_SSL_NO_VERIFY=1
- echo $CI_SERVER_HOST
- echo $CRONJOB
# We redefine the HOME
- export HOME=${CI_PROJECT_DIR}/install_latest/
- if [ -d $HOME/.rest ]; then rm -Rf $HOME/.rest; fi
- if [ -f "/opt/root/install/bin/thisroot.sh" ]; then source /opt/root/install/bin/thisroot.sh; fi
- export HOME=${CI_PROJECT_DIR}/install/
- rm -rf $HOME/.rest
# Check versions
- root-config --version
- if [ -f "/opt/geant4/install/bin/geant4.sh" ]; then source /opt/geant4/install/bin/geant4.sh; fi
- geant4-config --version
- if [ -d "/opt/garfieldpp/install" ]; then export GARFIELD_HOME=/opt/garfieldpp/install; fi
- if [ -d "/opt/garfieldpp/install" ]; then export HEED_DATABASE=$GARFIELD_HOME/Heed/heed++/database; fi
- if [ -d "/opt/garfieldpp/install" ]; then export LD_LIBRARY_PATH=$GARFIELD_HOME/lib:$LD_LIBRARY_PATH; fi
- ls $GARFIELD_HOME
- echo $GARFIELD_INSTALL
- python3 --version
- apt update && apt install -y wget

clang-format:
stage: pre-build
Expand All @@ -72,127 +69,78 @@ clang-format:
- $CRONJOB
- $CRONJOB == "YES"

validateCode:
Validate Code:
stage: pre-build
script:
- cd ${CI_PROJECT_DIR}/
- python3 pull-submodules.py --force --dontask
- python3 pipeline/validateProcesses.py source/libraries/

#axionLib:
# stage: libraries
# script:
# - "curl -k -X POST -F token=bd53c38cdd1395ffeb14d297ebe202 -F ref=master https://lfna.unizar.es/api/v4/projects/31/trigger/pipeline"
# only:
# variables:
# - $CI_SERVER_HOST == "lfna.unizar.es"

#modelLib:
# stage: libraries
# script:
# - "curl -k -X POST -F token=a244698329647e96d55908d75f3f0e -F ref=master https://lfna.unizar.es/api/v4/projects/11/trigger/pipeline"
# only:
# variables:
# - $CI_SERVER_HOST == "lfna.unizar.es"

#build:
# type: build
# script:
# - cd ${CI_PROJECT_DIR}/
# - python3 pull-submodules.py --force --dontask
# - if [ -d ${CI_PROJECT_DIR}/build ]; then rm -Rf ${CI_PROJECT_DIR}/build; fi
# - mkdir ${CI_PROJECT_DIR}/build && cd ${CI_PROJECT_DIR}/build/
# - if [ -d ${CI_PROJECT_DIR}/install ]; then rm -Rf ${CI_PROJECT_DIR}/install; fi
# - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install
# - make install -j2
# # - . ${CI_PROJECT_DIR}/install/thisREST.sh
# except:
# variables:
# - $CRONJOB == "YES"
# artifacts:
# paths:
# - ${CI_PROJECT_DIR}/install
# expire_in: 1 day
#
build_latest:
Build and Test:
type: test
script:
- cd ${CI_PROJECT_DIR}
- python3 pull-submodules.py --force --dontask --latest:${CI_COMMIT_BRANCH}
- mkdir ${CI_PROJECT_DIR}/build && cd ${CI_PROJECT_DIR}/build
- cmake ${CI_PROJECT_DIR}
-DTEST=ON -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON
- make -j2
- ctest --verbose -O ${CI_PROJECT_DIR}/build/Testing/summary.txt

artifacts:
name: "Testing"
paths:
- ${CI_PROJECT_DIR}/build/Testing
expire_in: 1 day

Build and Install:
type: build
script:
- cd ${CI_PROJECT_DIR}/
- cd ${CI_PROJECT_DIR}
- python3 pull-submodules.py --force --dontask --latest:${CI_COMMIT_BRANCH}
- if [ -d ${CI_PROJECT_DIR}/build_latest ]; then rm -Rf ${CI_PROJECT_DIR}/build_latest; fi
- mkdir ${CI_PROJECT_DIR}/build_latest && cd ${CI_PROJECT_DIR}/build_latest/
- if [ -d ${CI_PROJECT_DIR}/install_latest ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest; fi
- cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest
- rm -rf ${CI_PROJECT_DIR}/build && mkdir ${CI_PROJECT_DIR}/build && cd ${CI_PROJECT_DIR}/build
- rm -rf ${CI_PROJECT_DIR}/install
- cmake ${CI_PROJECT_DIR} -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install
-DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DREST_WELCOME=OFF
- make install -j2
# - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh

artifacts:
name: "Install"
paths:
- ${CI_PROJECT_DIR}/install_latest
- ${CI_PROJECT_DIR}/install
expire_in: 1 day

#build_latest_root622_geant4v1042:
# image: lobis/root-geant4-garfieldpp:cxx14_ROOTv6-22-08_Geant4v10.4.2
# type: build
# script:
# - cd ${CI_PROJECT_DIR}/
# - python3 pull-submodules.py --force --dontask --latest
# - if [ -d ${CI_PROJECT_DIR}/build_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/build_latest2; fi
# - mkdir ${CI_PROJECT_DIR}/build_latest2 && cd ${CI_PROJECT_DIR}/build_latest2/
# - if [ -d ${CI_PROJECT_DIR}/install_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest2; fi
# - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest2
# - make install -j2
# - . ${CI_PROJECT_DIR}/install_latest2/thisREST.sh
# except:
# variables:
# - $CRONJOB == "YES"

#build_nkx:
# image: nkx1231/root6-geant4-garfield:0.6
# type: build
# script:
# - cd ${CI_PROJECT_DIR}/
# - python3 pull-submodules.py --force --dontask
# - if [ -d ${CI_PROJECT_DIR}/build_nkx ]; then rm -Rf ${CI_PROJECT_DIR}/build_nkx; fi
# - mkdir ${CI_PROJECT_DIR}/build_nkx && cd ${CI_PROJECT_DIR}/build_nkx/
# - if [ -d ${CI_PROJECT_DIR}/install_nkx]; then rm -Rf ${CI_PROJECT_DIR}/install_nkx; fi
# - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_nkx
# - make install -j2
# - cat ${CI_PROJECT_DIR}/install_nkx/thisREST.sh
# - . ${CI_PROJECT_DIR}/install_nkx/thisREST.sh
# except:
# variables:
# - $CRONJOB == "YES"

loadRESTLibs:
Load REST Libraries:
type: install
script:
- cat ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- echo ${CI_PROJECT_DIR}/install/thisREST.sh
- cat ${CI_PROJECT_DIR}/install/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- restRoot -b -q

listRESTMacros:
List REST Macros:
type: install
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- restManager ListMacros

01_NLDBD:
type: restG4
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/install_latest/examples/restG4/01.NLDBD/
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/01.NLDBD/
- restG4 NLDBD.rml
- geant4-config --version
- restRoot -b -q Validate.C'("Run00001_NLDBD_Test.root")'
artifacts:
paths:
- ${CI_PROJECT_DIR}/install_latest/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root
- ${CI_PROJECT_DIR}/install/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root
expire_in: 1 day

02_PandaXiiiMC:
type: restG4
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC
- restG4 Xe136bb0n.rml
- restRoot -b -q ValidateG4.C'("Xe136bb0n_n2E06.root")'
Expand All @@ -201,20 +149,20 @@ listRESTMacros:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/Xe136bb0n_n2E06.root
expire_in: 1 day

LoadGas:
Load Gas:
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/
- restRoot -b -q LoadGasFromServerAndValidate.C
only:
variables:
- $CI_SERVER_HOST == "lfna.unizar.es"

GenerateGas:
Generate Gas:
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/
- restRoot -b -q GenerateDummyGas.C
only:
Expand All @@ -224,46 +172,47 @@ GenerateGas:
AnalysisTree:
type: core
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/analysistree/
- restRoot -b -q simpleTree.cpp

GenerateReadout:
Generate Readout:
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/readout/
- restManager --c generateReadout.rml --o readout.root
- restRoot -b -q PrintReadout.C'("readout.root")' > /dev/null

# We need to introduce basic validation here
# - diff validation.txt print.txt

BasicReadout:
Basic Readout:
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/projects/basic-readouts/
- ls
- git status
- git log
- restRoot --m 1 -b -q GenerateReadouts.C'("basic.root")'
- restRoot -b -q BasicValidation.C'("basic.root", "pixelDecoding")'

testMeta:
Test Metadata:
type: restManager_generate
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/install_latest/examples
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples
- restManager --c saveMetadataFile.rml --o meta.root
artifacts:
paths:
- ${CI_PROJECT_DIR}/install_latest/examples/meta.root
- ${CI_PROJECT_DIR}/install/examples/meta.root
expire_in: 1 day

trexDM_data_latest:
TREX-DM Latest Data:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/trex
- wget https://sultan.unizar.es/trexdm-readouts/readouts_v2.3.root
- restManager --c 01_raw.rml --f R01928_tagTest_Vm_250_Vd_160_Pr_6_Gain_0x0_Shape_0xF_Clock_0x4-068.aqs
Expand All @@ -279,10 +228,10 @@ trexDM_data_latest:
- ${CI_PROJECT_DIR}/pipeline/trex/Hits_01928.root
expire_in: 1 day

pandaXIII_Topological:
PandaXIII Topological:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC
- restManager --c AllProcesses.rml --i testInput.root --o testOutput.root --j 1 --e 10
- restRoot -b -q ../MakeBasicTree.C'("testOutput.root")'
Expand All @@ -293,10 +242,10 @@ pandaXIII_Topological:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/trackParameter.png
expire_in: 1 week

pandaXIII_Topological_fromG4:
PandaXIII Topological from Geant4:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC
- echo "using just-generated g4 file"
- restManager --c AllProcesses.rml --i Xe136bb0n_n2E06.root --o testOutput.root --j 1 --e 10
Expand All @@ -307,10 +256,10 @@ pandaXIII_Topological_fromG4:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/testOutput.root
expire_in: 1 week

pandaXIII_data:
PandaXIII Data:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/pandaxiii_data
- restManager --c P3AutoChain.rml --i CoBo_AsAd0_2019-03-15.graw --o testOutput.root --j 1
- restRoot -b -q ../MakeBasicTree.C'("testOutput.root")'
Expand All @@ -320,12 +269,12 @@ pandaXIII_data:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_data/TriggerRate.png
expire_in: 1 week

EventSelection:
Event Selection:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/selection
- restManager --c g4Analysis.rml --f "${CI_PROJECT_DIR}/install_latest/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root"
- restManager --c g4Analysis.rml --f "${CI_PROJECT_DIR}/install/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root"
- restManager --c g4OnSelection.rml --f Run00001_NLDBD_Test_g4Analysis.root
- restRoot -b -q Validate.C'("Run00001_NLDBD_Test_EvSelection.root")'

Expand All @@ -337,25 +286,25 @@ EventSelection:
AnalysisPlot:
type: postProcessing
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/analysisPlot/
- restManager --c summary.rml --f ${CI_PROJECT_DIR}/pipeline/trex/Hits_01928.root

AnalysisPlot2:
type: postProcessing
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/analysisPlot/
- restManager --batch --c classify.rml
- restRoot -b -q ValidateClassify.C

deploy:
Deploy:
type: deploy
only:
- tags
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- source ${CI_PROJECT_DIR}/install/thisREST.sh
- rest-config --welcome
artifacts:
paths:
- ${CI_PROJECT_DIR}/install_latest
- ${CI_PROJECT_DIR}/install
Loading

0 comments on commit b05be52

Please sign in to comment.