image: localhost:5000/ubuntu_gcc
#before_script:
#  - apt-get update
#  - apt-get -y install cmake g++-7 gcovr bc
#  - apt-get -y upgrade

cache:
  key: "$CI_COMMIT_REF_SLUG"
  paths:
    - build/
  untracked: true

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - mkdir -p build
    - cd build
    - CXX=g++-7 CC=gcc-7 cmake .. -DCMAKE_BUILD_TYPE=Coverage
    - make pastis

tests:
  stage: test
  script:
    - ls > /dev/null # seems necessary to ensure build is here...
    - cd build
    - make unit_tests
    - make coverage-report

pages:
  stage: deploy
  dependencies:
    - tests
  script:
    - ls > /dev/null # seems necessary to ensure build is here...
    - rm -rf public/
    - mv build/coverage/ public/
  artifacts:
    paths:
      - public
    expire_in: 30 days
