##################################################################################### # (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations # # # # This software is distributed under the terms of the Apache version 2 licence, # # copied verbatim in the file "LICENSE". # # # # In applying this licence, CERN does not waive the privileges and immunities # # granted to it by virtue of its status as an Intergovernmental Organization # # or submit itself to any jurisdiction. # ##################################################################################### stages: - pre-build-checks - build - test - deploy variables: LCG_VERSION: "100" CMAKE_GENERATOR: 'Ninja' # default build system NO_LBLOGIN: "1" # prevent lbdocker containers to start LbLogin/LbEnv TARGET_BRANCH: master # All the configuration default: image: gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build before_script: # Add Ninja and CMake to the PATH - export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:/cvmfs/sft.cern.ch/lcg/contrib/ninja/1.10.0/Linux-x86_64:$PATH" - export CCACHE_DIR=$PWD/.ccache # Job templates .build: &template_build stage: build tags: - cvmfs script: - git clone https://gitlab.cern.ch/lhcb-core/lcg-toolchains.git - cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=lcg-toolchains/LCG_${LCG_VERSION}/${CI_JOB_NAME}.cmake -DGAUDI_USE_INTELAMPLIFIER:BOOL=TRUE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - ccache -z # pre-heat ccache cache for GaudiKernel - jobs=$(nproc) - while [[ $jobs -ge 1 ]] ; do - cmake --build build -j $jobs --target GaudiKernel && break || true - jobs=$(( $jobs / 2 )) - done # build from scratch - cmake --build build --target clean - cmake --build build 2>&1 | tee build/build.log - ccache -s artifacts: paths: - build - lcg-toolchains expire_in: 1 week cache: key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" paths: - .ccache .build-check: &template_build_check stage: test script: - ci-utils/build-check build/build.log allow_failure: true .test: &template_test stage: test tags: - cvmfs script: - find build -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake - cd build - if ctest -T test -j $(nproc) --repeat until-pass:3 --no-compress-output ; then result=success ; else result=failure ; fi - cp Testing/$(head -1 Testing/TAG)/Test.xml .. - cd .. - xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml - echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml" - test "$result" = "success" artifacts: paths: - Test.xml reports: junit: - results.xml when: always expire_in: 1 week ### Build x86_64-centos7-gcc10-opt: <<: *template_build x86_64-centos7-gcc10-dbg: <<: *template_build view-gcc8: <<: *template_build script: - . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh # Override CMake from the view (too old in LCG 97a) - export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:$PATH" - PYTHON_MAJOR_VERSION=$(python -c "import sys; print(sys.version_info[0])") # Ignore .confdb file from Gaudi installation in LCG view - export CONFIGURABLE_DB_IGNORE=/cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/lib/Gaudi.confdb - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGAUDI_USE_PYTHON_MAJOR=${PYTHON_MAJOR_VERSION} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - ccache -z # pre-heat ccache cache for GaudiKernel - jobs=$(nproc) - while [[ $jobs -ge 1 ]] ; do - cmake --build build -j $jobs --target GaudiKernel && break || true - jobs=$(( $jobs / 2 )) - done # build from scratch - cmake --build build --target clean - cmake --build build 2>&1 | tee build/build.log - ccache -s lhcb-gcc10: <<: *template_build variables: BINARY_TAG: x86_64_v2-centos7-gcc10-opt script: - . /cvmfs/lhcb.cern.ch/lib/LbEnv - lb-project-init --overwrite - ccache -z - mkdir build.${BINARY_TAG} # pre-heat ccache cache for GaudiKernel - jobs=$(nproc) - while [[ $jobs -ge 1 ]] ; do - make BUILDFLAGS=-j$jobs GaudiKernel && break || true - jobs=$(( $jobs / 2 )) - done # build from scratch - make clean - make 2>&1 | tee build.${BINARY_TAG}/build.log - ccache -s artifacts: paths: - build.${BINARY_TAG} expire_in: 1 week ### Tests x86_64-centos7-gcc10-opt:test: <<: *template_test needs: - job: "x86_64-centos7-gcc10-opt" artifacts: true x86_64-centos7-gcc10-dbg:test: <<: *template_test needs: - job: "x86_64-centos7-gcc10-dbg" artifacts: true view-gcc8:test: <<: *template_test needs: - job: "view-gcc8" artifacts: true before_script: - . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh # Override CMake from the view (too old in LCG 97a) - export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:$PATH" lhcb-gcc10:test: <<: *template_test needs: - job: "lhcb-gcc10" artifacts: true variables: BINARY_TAG: x86_64_v2-centos7-gcc10-opt script: - . /cvmfs/lhcb.cern.ch/lib/LbEnv - lb-project-init --overwrite - find build.${BINARY_TAG} -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake - if make test ARGS="-j $(nproc) --repeat until-pass:3 --no-compress-output" ; then result=success ; else result=failure ; fi - cp build.${BINARY_TAG}/Testing/$(head -1 build.${BINARY_TAG}/Testing/TAG)/Test.xml . - mv build.${BINARY_TAG}/html . - xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml - echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml" - test "$result" = "success" artifacts: paths: - Test.xml - html reports: junit: - results.xml when: always expire_in: 1 day ### Check build outputs x86_64-centos7-gcc10-opt:build-check: <<: *template_build_check needs: - job: "x86_64-centos7-gcc10-opt" artifacts: true x86_64-centos7-gcc10-dbg:build-check: <<: *template_build_check needs: - job: "x86_64-centos7-gcc10-dbg" artifacts: true view-gcc8:build-check: <<: *template_build_check needs: - job: "view-gcc8" artifacts: true lhcb-gcc10:build-check: <<: *template_build_check needs: - job: "lhcb-gcc10" artifacts: true variables: BINARY_TAG: x86_64_v2-centos7-gcc10-opt script: - ci-utils/build-check build.${BINARY_TAG}/build.log ### Misc checks x86_64-centos7-gcc10-opt:check-unused: stage: test needs: - job: "x86_64-centos7-gcc10-opt" artifacts: true script: - ci-utils/check-sources build/build.ninja allow_failure: true pre-commit-checks: stage: pre-build-checks image: registry.cern.ch/docker.io/library/python:3.8 variables: PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit cache: paths: - ${PRE_COMMIT_HOME} before_script: - | python -m venv ${CI_PROJECT_DIR}/.cache/pre-commit-venv . ${CI_PROJECT_DIR}/.cache/pre-commit-venv/bin/activate pip install pre-commit git fetch origin $TARGET_BRANCH git config user.name "Gitlab CI" git config user.email "noreply@cern.ch" script: - | if ! pre-commit run --show-diff-on-failure --from-ref FETCH_HEAD --to-ref HEAD ; then echo "" echo "Generating patch file..." git commit -a -m "pre-commit fixes patch generated by ${CI_JOB_URL}" > /dev/null git format-patch HEAD~ cat <<EOF ======================================= You can apply these changes with: curl ${CI_JOB_URL}/artifacts/raw/0001-pre-commit-fixes.patch | git am ======================================= EOF exit 1 fi artifacts: paths: - 0001-pre-commit-fixes.patch when: on_failure expire_in: 1 week allow_failure: true check-copyright: stage: pre-build-checks image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7 script: - curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/-/raw/master/LbDevTools/SourceTools.py?inline=false" - python lb-check-copyright --exclude lhcbproject.yml origin/${TARGET_BRANCH} allow_failure: true website: stage: build image: python script: - rm -rf public - mkdir -p public - cd docs - pip install -r source/requirements.txt - make html - cp -a build/html/. ../public/. allow_failure: true artifacts: paths: - public expire_in: 1 day doxygen: stage: test tags: - cvmfs needs: - job: "view-gcc8" artifacts: true script: - . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh # Override CMake from the view (too old in LCG 97a) - export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:$PATH" - find build -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake - cmake --build build --target doc - rm -rf public - mkdir -p public/doxygen - cp -r GaudiRelease/web_helpers/. public/doxygen/. - mv build/doxygen/html ${CI_COMMIT_REF_SLUG} - zip -r -q public/doxygen/${CI_COMMIT_REF_SLUG}.zip ${CI_COMMIT_REF_SLUG} artifacts: paths: - public expire_in: 1 day # see https://gitlab.cern.ch/gitlabci-examples/deploy_eos for the details # of the configuration deploy-website: stage: deploy needs: - job: "website" artifacts: true - job: "doxygen" artifacts: true rules: - if: $CI_COMMIT_BRANCH == "master" - if: $CI_COMMIT_TAG image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest script: - test -z "$EOS_ACCOUNT_USERNAME" -o -z "$EOS_ACCOUNT_PASSWORD" -o -z "$EOS_PATH" && exit 0 || true # Script that performs the deploy to EOS. Makes use of the variables defined in the project # It will copy the generated content to the folder in EOS - export CI_OUTPUT_DIR=public/ - deploy-eos # do not run any globally defined before_script or after_script for this step before_script: [] after_script: []