image: "flowdalic/debian-dev:1.13"

before_script:
  - apt update && apt install -y pkg-config
  - apt install -y -t testing liburcu-dev
  - |
    readarray TOOLS <<EOF
    c++
    cc
    clang
    clang++
    clang-tidy
    doxygen
    g++
    gcc
    include-what-you-use
    meson
    nasm
    valgrind
    EOF
    for tool in ${TOOLS[@]}; do
      echo -n "$tool version: "
      $tool --version
    done

stages:
  - smoke-test
  - test

smoke-test:
  stage: smoke-test
  script: make smoke-test

variables:
  BUILDDTYPE: debugoptmized
  CC: gcc
  CXX: g++
  EXTRA_NINJA_ARGS: -v

.test:
  stage: test
  script:
    - make test

.gcc:
  variables:
    CC: gcc
    CXX: g++

.clang:
  variables:
    CC: clang
    CXX: clang++

.emper-worker-no-sleep:
  variables:
    EMPER_WORKER_SLEEP: 'false'

.emper-worker-stats:
  variables:
    EMPER_WORKER_STATS: 'true'

.release-build:
  variables:
    BUILDTYPE: release

.debug-build:
  variables:
    BUILDTYPE: debug

test-gcc:
  extends:
    - .test
    - .gcc

test-gcc-release:
  extends:
    - test-gcc
    - .release-build

test-gcc-debug:
  extends:
    - test-gcc
    - .debug-build

test-clang:
  extends:
    - .test
    - .clang

test-clang-release:
  extends:
    - test-clang
    - .release-build

test-clang-debug:
  extends:
    - test-clang
    - .debug-build

test-worker-no-sleep:
  extends:
    - .test
    - .emper-worker-no-sleep

test-with-stats:
  extends:
    - .test
    - .emper-worker-stats
