image: ubuntu:bionic

variables:
  GIT_SSL_NO_VERIFY: "1"

before_script:
  - apt-get update --yes
  - apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran

build:
  stage: build
  tags:
    - run1
  script:
    - mkdir build
    - cd build
    - cmake ..
    - cmake --build .
    - ctest -V

code_quality:
  image: docker:stable
  variables:
    DOCKER_DRIVER: overlay2
  allow_failure: true
  services:
    - docker:stable-dind
  script:
    - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
    - docker run
        --env SOURCE_CODE="$PWD"
        --volume "$PWD":/code
        --volume /var/run/docker.sock:/var/run/docker.sock
        "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
  artifacts:
    reports:
      codequality: gl-code-quality-report.json