default:
    image: rboman/waves-py3:2020.3
    before_script:
        - source /opt/intel/mkl/bin/mklvars.sh intel64
        - source /opt/intel/tbb/bin/tbbvars.sh intel64
        - echo $(nproc)
        - printenv | sort

.global_tag: &global_tag_def
    tags:
        - mn2l
#        - warson   # you can choose a set of runners here

variables:
    GIT_SUBMODULE_STRATEGY: recursive
    GIT_STRATEGY: clone # workaround full clone for each pipeline (https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26993)
    GIT_LFS_SKIP_SMUDGE: 1 # do not pull LFS

stages:
    - build
    - test

build:
    <<: *global_tag_def
    stage: build
    before_script:
        - python3 -m pip install scipy==1.11.3 --user
    script:
        - git submodule init
        - git submodule update
        - rm -rf build workspace
        - mkdir build
        - cd build
        - cmake -Wno-dev ..
        - make -j 8
    artifacts:
        paths:
            - build/
        expire_in: 1 day

doxygen:
    <<: *global_tag_def
    stage: test
    script:
        - cd build
        - make dox
    artifacts:
        paths:
            - build/doxygen/
        expire_in: 1 week
    dependencies:
        - build

ctest:
    <<: *global_tag_def
    stage: test
    script:
        - cd build
        - ctest --output-on-failure -j 8
    #timeout: 10 hours  # will be available in 12.3
    dependencies:
        - build
