before_script:
  - export GIT_SSL_NO_VERIFY=1
  - export PATH="$HOME/miniconda2/bin:$PATH"
  # 2024-09-04: We deleted autosubmit3 env (00:00:04).
  # - conda env remove -y -n autosubmit3
  # 2024-09-04: Installed a new env autosubmit4 (00:00:55).
  # - conda create -n autosubmit4 python=3.9 graphviz bcrypt pip sqlite rsync curl
  # And then we use this environment to create venv's (faster) and install Autosubmit.
  # We always activate the same environment
  - conda activate autosubmit4
  - test -f venv/bin/python || python3 -m venv venv
  - source venv/bin/activate
  - python3 -V

stages:
  - test
  - docs

cache:
  paths:
    - test/coverage.xml
    - test/unit/files
    - venv

test_python3:
  stage: test
  script:
    - pip install --upgrade pip
    # This installs default dependencies, plus those for running tests and for building docs.
    - pip install -e .[tests]
    - pytest -m "not postgres"
  coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
  # These artifacts are saved with every build in GitLab and can be reviewed later. If
  # we have a folder with HTML files, as in this example, users can navigate with their
  # browser.
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: test/coverage.xml

docs:
  stage: docs
  script:
    - pip install -e .[docs]
    - cd docs
    - make html
