---
include:
  - project: 'core/ci-config'
    ref: master
    file: 'config/common/master.yml'
  - project: 'core/ci-config'
    ref: master
    file: 'jobs/common/master.yml'

before_script:
  - . /duneci/bin/duneci-init-job

variables:
  DUNECI_TEST_LABELS: quick
  DUNE_TEST_EXPECTED_VC_IMPLEMENTATION: SSE2

debian:10 gcc-7-17--expensive:
  # This image has Vc
  image: registry.dune-project.org/docker/ci/debian:10
  script: duneci-standard-test
  stage: test
  # allow expensive tests
  variables:
    DUNECI_CXXFLAGS: -mavx
    DUNECI_TEST_LABELS: ""
    DUNECI_TOOLCHAIN: gcc-7-17
    DUNE_TEST_EXPECTED_VC_IMPLEMENTATION: AVX
  # require AVX to properly test Vc
  tags: [duneci, "iset:avx"]
  # allowed to fail to e.g. do no hold up a merge when a runner supporting avx
  # is unavailable
  allow_failure: true


debian-11-gcc-9-17-python:
  image: registry.dune-project.org/docker/ci/debian:11
  script: duneci-standard-test
  stage: test
  variables:
    DUNECI_TOOLCHAIN:  gcc-9-17
    # so we need some variables to build the dune-py module during execution of the first python test:
    # we need to find the dune mdoule
    DUNE_CONTROL_PATH:  /duneci/modules:$CI_PROJECT_DIR
    # the position for the dune-py module
    DUNE_PY_DIR:       /duneci/modules/dune-py
    # during dune-py build this variable is used - do know a way to access
    # the CMAKE_FLAGS used to build the modules...
    DUNE_CMAKE_FLAGS:   "CC=gcc-9 CXX=g++-9 -DCMAKE_CXX_FLAGS='-std=c++17 -O2 -g -Wall -fdiagnostics-color=always' -DDUNE_ENABLE_PYTHONBINDINGS=ON -DDUNE_MAX_TEST_CORES=4 -DBUILD_SHARED_LIBS=TRUE -DDUNE_PYTHON_INSTALL_LOCATION=none -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Alberta=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Vc=TRUE -DCMAKE_DISABLE_DOCUMENTATION=TRUE"
    # cmake flags we use for all dune moudle - important is that build shared libs is set (need some better way of doing this)
    DUNECI_CMAKE_FLAGS: $DUNE_CMAKE_FLAGS
    # finally set the python path to all modules
    PYTHONPATH:        $CI_PROJECT_DIR/build-cmake/python
  tags: [duneci]

system-test:
  stage: downstream
  variables:
    CI_BUILD_REF_NAME: $CI_COMMIT_REF_NAME
    DUNECI_TEST_LABELS: ""
  trigger:
    project: infrastructure/dune-nightly-test
    branch: core
    strategy: depend
  allow_failure: true
