Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 5.75 KiB
###############################################################################
# (c) Copyright 2018-2022 CERN for the benefit of the LHCb Collaboration      #
#                                                                             #
# This software is distributed under the terms of the GNU General Public      #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
#                                                                             #
# 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:
  - check
  - build
  - docs
  - deploy

variables:
  TARGET_BRANCH: master
  # Parameters for downloading nightlies and building DaVinci
  BINARY_TAG: x86_64_v2-centos7-gcc11-opt
  LCG_VERSION: 101
  NO_LBLOGIN: "1" # prevent lbdocker containers to start LbLogin/LbEnv
  LB_NIGHTLY_SLOT: lhcb-master

check-copyright:
  stage: check
  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 origin/${TARGET_BRANCH} --exclude lhcbproject.yml

check-formatting:
  stage: check
  tags:
    - cvmfs
  image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
  script:
    - . /cvmfs/lhcb.cern.ch/lib/LbEnv.sh
    - if [ ! -e .clang-format ] ; then
    -   curl -o .clang-format "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/data/default.clang-format?inline=false"
    -   echo '.clang-format' >> .gitignore
    -   git add .gitignore
    - fi
    - curl -o lb-format "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/SourceTools.py?inline=false"
    - python lb-format --format-patch apply-formatting.patch origin/${TARGET_BRANCH}
  artifacts:
    paths:
      - apply-formatting.patch
    when: on_failure
    expire_in: 1 week

python-linting:
  stage: check
  tags:
    - cvmfs
  script:
    - . /cvmfs/lhcb.cern.ch/lib/LbEnv.sh
    # Only run the pyflakes linter and a few select pycodestyle errors
    - flake8 $(find . -name '*.py')

build:
  stage: build
  image: gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build:latest
  tags:
    - cvmfs
  script:
    - . /cvmfs/lhcb.cern.ch/lib/LbEnv.sh
    - . /cvmfs/lhcbdev.cern.ch/nightlies/${LB_NIGHTLY_SLOT}/latest/setupSearchPath.sh
    # setupSearchPath.sh only sets CMTPROJECTPATH but we need CMAKE_PREFIX_PATH
    - export CMAKE_PREFIX_PATH=${CMTPROJECTPATH}:${CMAKE_PREFIX_PATH}