# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileCopyrightText: 2019 CERN

---

include:
  - project: 'be-cem-edl/evergreen/gitlab-ci'
    ref: master
    file:
      - 'edl-gitlab-ci.yml'

cppcheck:
  stage: analyse
  image:
    name: gitlab-registry.cern.ch/coht/common-containers/static-analysis:latest
  script:
    - make cppcheck

build:
  stage: build
  script:
    - yum install -y kernel-devel
    - KERNELSRC=/usr/src/kernels/*/ make modules

documentation:
  stage: build
  image:
    name: gitlab-registry.cern.ch/coht/common-containers/documentation:latest
  script:
    - make -C Documentation/fmc html KERNELSRC=$(ls -1dr /linux-* | head -n 1)
    - mkdir -p $EDL_CI_EOS_OUTPUT_DIR
    - cp -a Documentation/fmc/_build/html/* $EDL_CI_EOS_OUTPUT_DIR
  artifacts:
    paths:
      - $EDL_CI_EOS_OUTPUT_DIR

build_dkms_rpm:
  stage: release
  script:
    - yum install -y dkms
    - make -C distribution dkms-rpm

build_srpm:
  stage: release
  script:
    - yum-builddep -y ${DIST_PATH}/*.spec
    - KERNELSRC=/usr/src/kernels/*/ make -C distribution srpm
  artifacts:
    paths:
      - distribution/build/SRPMS/${CI_PROJECT_NAME}*src.rpm
    expire_in: 1 day
