Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.75 KiB
Newer Older
###############################################################################
# (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.                                       #
###############################################################################
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:
  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
Eduardo Rodrigues's avatar
Eduardo Rodrigues committed

check-formatting:
  tags:
    - cvmfs
  image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
Eduardo Rodrigues's avatar
Eduardo Rodrigues committed
  script:
    - . /cvmfs/lhcb.cern.ch/lib/LbEnv.sh
Eduardo Rodrigues's avatar
Eduardo Rodrigues committed
    - 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:
Eduardo Rodrigues's avatar
Eduardo Rodrigues committed
  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}
    - lb-project-init
    - make CMAKEFLAGS=-DLOKI_BUILD_FUNCTOR_CACHE=OFF
    - ln -s ./build.$BINARY_TAG/run run
    - sudo chown -R root:root $CI_PROJECT_DIR
  # Allow failure as the nightly slot we depend on may have itself failed
  allow_failure: true
  artifacts:
    untracked: true
    expire_in: 1 hr

build-docs:
  stage: docs
  image: gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build:latest
  tags:
    - cvmfs
  # Change pip's cache directory so we can cache it
  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  before_script:
    # As the previous stage is allowed to fail, skip this stage if the previous
    # did not complete successfully (i.e. did not create the `run` symlink)
    - test -L run || { echo "WARNING build job failed, stopping"; exit 77; }
  script:
    # First try producing just the graphs (gaudirun.py). If that fails, Moore
    # is likely incompatible with the last nightly, so fail with a warning.
    - ./run make -C doc graphs || { echo "WARNING build is incompatible with last nightly, stopping"; exit 77; }
    #- reasons=
    #- ./run python doc/make_functor_docs.py "${CI_COMMIT_SHA:0:8}" "master" > doc/selection/thor_functors_reference.generated.rst || reasons+='ERROR failed functor docs build\n'
    - ./run make -C doc linkcheck || reasons+='ERROR failed link check\n'
    - ./run make -C doc html || reasons+='ERROR failed html generation\n'
    - if [ -n "$reasons" ]; then echo -e $reasons; exit 1; fi
  allow_failure:
    exit_codes: 77
  artifacts:
    untracked: false
    expire_in: 30 days
    paths:
     - doc/_build/html/
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .cache/pip

pages:
  stage: deploy
  needs: [build-docs]
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
   - mv doc/_build/html public
  artifacts:
    untracked: false
    expire_in: 30 days
    paths:
     - public

  # image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer
  # rules:
  #   - if: '$CI_COMMIT_REF_PROTECTED == "true"'
  # variables:
  #   # Need to ensure that the path up to $CI_COMMIT_REF_NAME exists (the
  #   # deployment script does `mkdir`, not `mkdir -p`)
  #   EOS_PATH: "/eos/user/m/mamartin/www/davincidocs/$CI_COMMIT_REF_NAME"
  #   #EOS_PATH: "/eos/project/l/lhcbwebsites/www/projects/moore/$CI_COMMIT_REF_NAME"
  #   CI_OUTPUT_DIR: "doc/_build/html"
  #   # Makes sure files on the remote are deleted if missing from the source
  #   METHOD: "rsync"
  # before_script:
  #   # As the previous stage is allowed to fail, skip this stage if the previous
  #   # did not complete successfully (i.e. did not create the html directory)
  #   - test -d $CI_OUTPUT_DIR || { echo "WARNING docs not built, stopping"; exit 77; }
  # script:
  #   #- deploy-eos && echo -e "Deployed at\n\n\thttps://lhcbdoc.web.cern.ch/lhcbdoc/moore/$CI_COMMIT_REF_NAME/index.html"
  #   - deploy-eos && echo -e "Deployed at\n\n\thttps://mamartin.web.cern.ch/davincidocs/$CI_COMMIT_REF_NAME/index.html"
  # allow_failure:
  #   exit_codes: 77


Christoph Hasse's avatar
Christoph Hasse committed
include:
  - project: 'lhcb-rta/reference-update-bot'
    file: 'templates/ref-bot-ci-trigger-template.yml'