include:
  # https://computing.docs.ligo.org/gitlab-ci-templates/
  - project: computing/gitlab-ci-templates
    file:
      # https://computing.docs.ligo.org/gitlab-ci-templates/conda/
      - conda.yml
      # https://computing.docs.ligo.org/gitlab-ci-templates/python/
      - python.yml

stages:
  - test

.test:
  stage: test
  extends:
    # https://computing.docs.ligo.org/gitlab-ci-templates/conda/#.conda:base
    - .conda:base
    # https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:pytest
    - .python:pytest
  image: igwn/base:conda
  variables:
    # what Python package to track for coverage
    COVERAGE_TARGET: "peconfigurator"
    # command line options for pytest
    PYTEST_OPTIONS: "-vvv ${CI_PROJECT_DIR}/tests/"
    # set Python interpreter to conda env
    PYTHON: "${CONDA_ENVS_PATH}/tests/bin/python"
  before_script:
    # configure conda
    - !reference [".conda:base", before_script]
    - "PYTHON_VERSION=${CI_JOB_NAME##*:}"
    - mamba create -n tests
          python=${PYTHON_VERSION}
          pytest
          matplotlib-base
          lalsuite
    - conda activate tests
    # configure pip and pytest
    - !reference [".python:pytest", before_script]
  # script commands are set in .python:pytest template

test:3.9:
  extends: .test

test:3.10:
  extends: .test

test:3.11:
  extends: .test
