# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later

include:
  - project: 'biosignal/templates/ci'
    ref: main
    file: 'python.yml'

variables:
  OMP_NUM_THREADS: 1  # for pytorch CI tests on docker platform
  GIT_SUBMODULE_STRATEGY: normal
  GIT_SUBMODULE_DEPTH: 1

.snippets:
  apt-install-libs:
      # apt install libgl1-mesa-glx for grad-cam
      - |
        if [[ ${CI_RUNNER_TAGS} =~ '"docker"' ]]; then \
          apt update; \
          apt install -y libopengl0 libegl1 libgl1-mesa-glx > /dev/null; \
        fi

tests:
  before_script:
    - !reference [.snippets, setup-pixi]
    - !reference [.snippets, apt-install-libs]
  cache:
    key: test-cache-${TAG}-${PYTHON}
    paths:
      - _cache/torch

documentation:
  before_script:
    - !reference [.snippets, setup-pixi]
    - !reference [.snippets, apt-install-libs]
  cache:
    key: doc-cache
    paths:
      - _cache/torch
