diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d72e6b..e3d282d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,500 +1,488 @@ # --------------------------------- # - General Setup - # --------------------------------- stages: - build - test - FOG:build - FOG:test - clean_code - long_test - - extra:build - - extra:test - publish variables: # build directories HEJ_BUILD_DIR: tmp_HEJ/HEJ_build HEJ_INSTALL_DIR: tmp_HEJ/HEJ_installed FOG_BUILD_DIR: tmp_HEJ/FOG_build FOG_INSTALL_DIR: ${HEJ_INSTALL_DIR} # docker images DOCKER_BASIC: hejdock/hepenv DOCKER_HEPMC3: "hejdock/hepmc3env:centos7" DOCKER_QCDLOOP: hejdock/qcdloopenv # includes rivet DOCKER_RIVET: hejdock/rivetenv DOCKER_HIGHFIVE: "hejdock/highfiveenv:centos7" DOCKER_RIVET3: maheil/full_rivet3 DOCKER_RIVET3H2: maheil/hepmc2_rivet3 # default name of cmake CMAKE: cmake CTEST: ctest OVERWRITE_BOOST: "" # ----------- Macros ----------- after_script: - date .tags_template: tags: &tags_def - docker # default pipeline triggers .only_template: only: &only_def - branches - tags - merge_requests # save complete history of failed tests .save_failure: artifacts: &artifacts_failed when: on_failure untracked: true expire_in: 3d # --------------------------------- # - Script Templates - # --------------------------------- # ----------- Build ----------- .HEJ_build: tags: *tags_def only: *only_def stage: build before_script: - date - source /cvmfs/pheno.egi.eu/HEJ/HEJ_env.sh || exit 1 # prepare build - t_HEJ_DIR=${PWD} - t_HEJ_INSTALL_DIR=${PWD}/${HEJ_INSTALL_DIR} - t_HEJ_BUILD_DIR=${PWD}/${HEJ_BUILD_DIR} # hack to allow setting "variable in variable" - t_CMAKE_FLAGS="" - if [[ -n ${OVERWRITE_BOOST} ]]; then declare -n t_boost_root=${OVERWRITE_BOOST}; t_CMAKE_FLAGS="-DBOOST_ROOT=${t_boost_root}"; fi - echo ${t_CMAKE_FLAGS} - mkdir -p ${t_HEJ_BUILD_DIR} - cd ${t_HEJ_BUILD_DIR} - ${CMAKE} ${t_HEJ_DIR} -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=${t_HEJ_INSTALL_DIR} ${t_CMAKE_FLAGS} script: - make -j $(nproc --ignore=1) - make install dependencies: [] artifacts: # save build and installed folder name: build expire_in: 1d paths: - ${HEJ_INSTALL_DIR} - ${HEJ_BUILD_DIR} # ----------- Test ----------- .HEJ_test: tags: *tags_def only: *only_def stage: test before_script: - date - source /cvmfs/pheno.egi.eu/HEJ/HEJ_env.sh || exit 1 # load HEJ - t_HEJ_DIR=${PWD} - t_HEJ_INSTALL_DIR=${PWD}/${HEJ_INSTALL_DIR} - export LD_LIBRARY_PATH=${t_HEJ_INSTALL_DIR}/lib:${LD_LIBRARY_PATH} - export PATH=${t_HEJ_INSTALL_DIR}/bin:${PATH} - cd ${HEJ_BUILD_DIR} - ${CMAKE} ${t_HEJ_DIR} # rerun cmake to create all test configure files script: - ${CTEST} --output-on-failure -j $(nproc --ignore=1) artifacts: *artifacts_failed ## ----------- FOG build ----------- .FOG_build: tags: *tags_def only: *only_def stage: FOG:build before_script: - date - source /cvmfs/pheno.egi.eu/HEJ/HEJ_env.sh || exit 1 # load HEJ - t_HEJ_INSTALL_DIR=${PWD}/${HEJ_INSTALL_DIR} - export LD_LIBRARY_PATH=${t_HEJ_INSTALL_DIR}/lib:${LD_LIBRARY_PATH} - export PATH=${t_HEJ_INSTALL_DIR}/bin:${PATH} # prepare build - t_FOG_DIR=${PWD}/FixedOrderGen - t_FOG_INSTALL_DIR=${PWD}/${FOG_INSTALL_DIR} - t_FOG_BUILD_DIR=${PWD}/${FOG_BUILD_DIR} # hack to allow setting "variable in variable" - t_CMAKE_FLAGS="" - if [[ -n ${OVERWRITE_BOOST} ]]; then declare -n t_boost_root=${OVERWRITE_BOOST}; t_CMAKE_FLAGS="-DBOOST_ROOT=${t_boost_root}"; fi - mkdir -p ${t_FOG_BUILD_DIR} - cd ${t_FOG_BUILD_DIR} - ${CMAKE} ${t_FOG_DIR} -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=${t_FOG_INSTALL_DIR} ${t_CMAKE_FLAGS} script: - make -j $(nproc --ignore=1) - make install artifacts: # save build and installed folder name: FOG_build expire_in: 1d paths: - ${HEJ_INSTALL_DIR} - ${FOG_INSTALL_DIR} - ${FOG_BUILD_DIR} ## ----------- FOG test ----------- .FOG_test: tags: *tags_def only: *only_def stage: FOG:test before_script: - date - source /cvmfs/pheno.egi.eu/HEJ/HEJ_env.sh || exit 1 # load HEJ - t_FOG_DIR=${PWD}/FixedOrderGen - t_HEJ_INSTALL_DIR=${PWD}/${HEJ_INSTALL_DIR} - t_FOG_INSTALL_DIR=${PWD}/${FOG_INSTALL_DIR} - export LD_LIBRARY_PATH=${t_HEJ_INSTALL_DIR}/lib:${LD_LIBRARY_PATH} - export PATH=${t_HEJ_INSTALL_DIR}/bin:${t_FOG_INSTALL_DIR}/bin:${PATH} - t_FOG_BUILD_DIR=${PWD}/${FOG_BUILD_DIR} - cd ${t_FOG_BUILD_DIR} - ${CMAKE} ${t_FOG_DIR} # rerun cmake to create all test configure files script: - ${CTEST} --output-on-failure -j $(nproc --ignore=1) artifacts: *artifacts_failed # --------------------------------- # - Build & Test - # --------------------------------- # ----------- basic ----------- build:basic: image: ${DOCKER_BASIC} extends: .HEJ_build test:basic: image: ${DOCKER_BASIC} extends: .HEJ_test dependencies: - build:basic FOG:build:basic: image: ${DOCKER_BASIC} extends: .FOG_build dependencies: - build:basic FOG:test:basic: image: ${DOCKER_BASIC} extends: .FOG_test dependencies: - FOG:build:basic # ----------- HighFive/hdf5 ----------- build:HighFive: image: ${DOCKER_HIGHFIVE} extends: .HEJ_build variables: CMAKE: cmake3 test:HighFive: image: ${DOCKER_HIGHFIVE} extends: .HEJ_test variables: CMAKE: cmake3 CTEST: ctest3 dependencies: - build:HighFive # ----------- QCDloop ----------- build:qcdloop: image: ${DOCKER_QCDLOOP} extends: .HEJ_build test:qcdloop: image: ${DOCKER_QCDLOOP} extends: .HEJ_test dependencies: - build:qcdloop # ----------- rivet3 & HepMC3 ----------- build:rivet3: image: ${DOCKER_RIVET3} extends: .HEJ_build variables: OVERWRITE_BOOST: boost_ROOT_DIR test:rivet3: image: ${DOCKER_RIVET3} extends: .HEJ_test dependencies: - build:rivet3 script: - ${CTEST} --output-on-failure -j $(nproc --ignore=1) - bash -c '[ -f t/tst.yoda ]' && echo "found rivet output" - rivet-cmphistos t/tst.yoda - bash -c '[ -f MC_XS_XS.dat ]' && echo "yoda not empty" -# --------------------------------- -# - Clean Code - -# --------------------------------- - -No_tabs: - stage: clean_code - tags: *tags_def - only: *only_def - image: hejdock/git - dependencies: [] - script: - - date - - check_tabs - artifacts: # don't save anything - -# ----------- No gcc warnings ----------- - -.Warning_build: - extends: .HEJ_build - stage: clean_code - script: - - ${CMAKE} ${t_HEJ_DIR} -DCMAKE_CXX_FLAGS="-Werror" - -DCMAKE_BUILD_TYPE=RelWithDebInfo - - make -j $(nproc --ignore=1) - artifacts: # don't save anything - -.Warning_FOG: - extends: .FOG_build - stage: clean_code - script: - - ${CMAKE} ${t_FOG_DIR} -DCMAKE_CXX_FLAGS="-Werror" ${t_CMAKE_FLAGS} - -DCMAKE_BUILD_TYPE=RelWithDebInfo - - make -j $(nproc --ignore=1) - artifacts: # don't save anything - -No_Warning:basic: - image: ${DOCKER_BASIC} - extends: .Warning_build - -No_Warning:basic:FOG: - image: ${DOCKER_BASIC} - extends: .Warning_FOG - dependencies: - - build:basic - -# --------------------------------- -# - Long tests - -# --------------------------------- - -.HEJ_test_long: - extends: .HEJ_build - stage: long_test - script: - - ${CMAKE} ${t_HEJ_DIR} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${t_CMAKE_FLAGS} - -DTEST_ALL=TRUE - - make -j $(nproc --ignore=1) install - - ${CTEST} --output-on-failure -j $(nproc --ignore=1) - only: # only run on specific branches - - master - - /^v\d+\.\d+$/ - - merge_requests - -# allow triggering long test manually -.HEJ_test_long:manual: - extends: .HEJ_test_long - when: manual - only: # default only - - branches - - tags - -# ----------- QCDloop ----------- - -Long_test:qcdloop: - image: ${DOCKER_QCDLOOP} - extends: .HEJ_test_long - dependencies: - - build:qcdloop - -manual:Long_test:qcdloop: - image: ${DOCKER_QCDLOOP} - extends: .HEJ_test_long:manual - dependencies: - - build:qcdloop - -# --------------------------------- -# - Different Setups - -# --------------------------------- - -# ----------- HepMC 3 ----------- +# ----------- HepMC 3 (optional) ----------- # HepMC 3 already in rivet3 build:hepmc3: image: ${DOCKER_HEPMC3} extends: .HEJ_build - stage: extra:build variables: CMAKE: cmake3 only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:build:hepmc3: extends: build:hepmc3 when: manual only: # default only - branches - tags test:hepmc3: image: ${DOCKER_HEPMC3} extends: .HEJ_test - stage: extra:test variables: CMAKE: cmake3 CTEST: ctest3 dependencies: - build:hepmc3 only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:test:hepmc3: extends: test:hepmc3 when: manual only: # default only - branches - tags -# ----------- rivet ----------- +# ----------- rivet (optional) ----------- # rivet2 already in qcdloop build:rivet: image: ${DOCKER_RIVET} extends: .HEJ_build - stage: extra:build only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:build:rivet: extends: build:rivet when: manual only: # default only - branches - tags test:rivet: image: ${DOCKER_RIVET} extends: .HEJ_test - stage: extra:test dependencies: - build:rivet script: - ${CTEST} --output-on-failure -j $(nproc --ignore=1) - bash -c '[ -f t/tst.yoda ]' && echo "found rivet output" - rivet-cmphistos t/tst.yoda - bash -c '[ -f MC_XS_XS.dat ]' && echo "yoda not empty" only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:test:rivet: extends: test:rivet when: manual only: # default only - branches - tags -# ----------- rivet3 & HepMC2 ----------- +# ----------- rivet3 & HepMC2 (optional) ----------- # This shouldn't change too often build:rivet3h2: image: ${DOCKER_RIVET3H2} extends: .HEJ_build - stage: extra:build variables: OVERWRITE_BOOST: boost_ROOT_DIR only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:build:rivet3h2: extends: build:rivet3h2 when: manual only: # default only - branches - tags test:rivet3h2: image: ${DOCKER_RIVET3H2} extends: .HEJ_test - stage: extra:test dependencies: - build:rivet3h2 script: - ${CTEST} --output-on-failure -j $(nproc --ignore=1) - bash -c '[ -f t/tst.yoda ]' && echo "found rivet output" - rivet-cmphistos t/tst.yoda - bash -c '[ -f MC_XS_XS.dat ]' && echo "yoda not empty" only: # only run on specific branches - master - /^v\d+\.\d+$/ - merge_requests manual:test:rivet3h2: extends: test:rivet3h2 when: manual only: # default only - branches - tags # --------------------------------- +# - Clean Code - +# --------------------------------- + +No_tabs: + stage: clean_code + tags: *tags_def + only: *only_def + image: hejdock/git + dependencies: [] + script: + - date + - check_tabs + artifacts: # don't save anything + +# ----------- No gcc warnings ----------- + +.Warning_build: + extends: .HEJ_build + stage: clean_code + script: + - ${CMAKE} ${t_HEJ_DIR} -DCMAKE_CXX_FLAGS="-Werror" + -DCMAKE_BUILD_TYPE=RelWithDebInfo + - make -j $(nproc --ignore=1) + artifacts: # don't save anything + +.Warning_FOG: + extends: .FOG_build + stage: clean_code + script: + - ${CMAKE} ${t_FOG_DIR} -DCMAKE_CXX_FLAGS="-Werror" ${t_CMAKE_FLAGS} + -DCMAKE_BUILD_TYPE=RelWithDebInfo + - make -j $(nproc --ignore=1) + artifacts: # don't save anything + +No_Warning:basic: + image: ${DOCKER_BASIC} + extends: .Warning_build + +No_Warning:basic:FOG: + image: ${DOCKER_BASIC} + extends: .Warning_FOG + dependencies: + - build:basic + +# --------------------------------- +# - Long tests - +# --------------------------------- + +.HEJ_test_long: + extends: .HEJ_build + stage: long_test + script: + - ${CMAKE} ${t_HEJ_DIR} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${t_CMAKE_FLAGS} + -DTEST_ALL=TRUE + - make -j $(nproc --ignore=1) install + - ${CTEST} --output-on-failure -j $(nproc --ignore=1) + only: # only run on specific branches + - master + - /^v\d+\.\d+$/ + - merge_requests + +# allow triggering long test manually +.HEJ_test_long:manual: + extends: .HEJ_test_long + when: manual + only: # default only + - branches + - tags + +# ----------- QCDloop ----------- + +Long_test:qcdloop: + image: ${DOCKER_QCDLOOP} + extends: .HEJ_test_long + dependencies: + - build:qcdloop + +manual:Long_test:qcdloop: + image: ${DOCKER_QCDLOOP} + extends: .HEJ_test_long:manual + dependencies: + - build:qcdloop + +# --------------------------------- # - Publish - # --------------------------------- Publish_version: stage: publish tags: *tags_def image: hejdock/git dependencies: [] artifacts: # don't save anything only: - /^v\d+\.\d+$/ except: - tags when: on_success before_script: - mkdir -p .ssh/ && echo "${SSH_KEY}" > .ssh/id_rsa && chmod 0600 .ssh/id_rsa - rm -rf ~/.ssh/id_rsa; mkdir -p ~/.ssh/ - ln -s $PWD/.ssh/id_rsa ~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa - ssh -T ${PUBLIC_GIT_PREFIX} -o "StrictHostKeyChecking no" || echo "added ssh" script: - git remote add public ${PUBLIC_GIT_PREFIX}${PUBLIC_GIT_POSTFIX} - git checkout $CI_COMMIT_REF_NAME - git branch - git pull - git push public - git push public --tags after_script: - rm -f /root/.ssh/id_rsa && rm -fr .ssh - git remote rm public