# Notes: Dependencies were not working as passed in variables

.pytest_template: &pytest_template
  stage: test
  image: "${docker_image}"
  script:
   - python -m pip install pytest
   - wheel_file=$(ls "${CI_PROJECT_DIR}"/dist/easy_ansi*.whl)
   - echo "Wheel File - ${wheel_file}"
   - python -m pip install "${wheel_file}"
   - cd "${CI_PROJECT_DIR}"/easyansi
   - python -m pytest --rootdir="${CI_PROJECT_DIR}/tests" "${CI_PROJECT_DIR}/tests/"
  cache:
    key: "${cache_key}"
    paths:
      - .cache/pip/


.mypy_template: &mypy_template
  stage: test
  image: "${docker_image}"
  script:
    - python -m pip install mypy
    - python -m mypy --strict --python-version 3.6 "${CI_PROJECT_DIR}/build/lib/easyansi/"
  cache:
    key: "${cache_key}"
    paths:
      - .cache/pip/


pytest_python36:
  <<: *pytest_template
  variables:
    docker_image: "python:3.6"
    cache_key: "python36_cache"
  dependencies:
    - "build_python36"


pytest_python37:
  <<: *pytest_template
  variables:
    docker_image: "python:3.7"
    cache_key: "python37_cache"
  dependencies:
    - "build_python37"


pytest_python38:
  <<: *pytest_template
  variables:
    docker_image: "python:3.8"
    cache_key: "python38_cache"
  dependencies:
    - "build_python38"


mypy_python36:
  <<: *mypy_template
  variables:
    docker_image: "python:3.6"
    cache_key: "python36_cache"
  dependencies:
    - "build_python36"


# MyPy does not need to be run on multiple Python versions

#mypy_python37:
#  <<: *mypy_template
#  variables:
#    docker_image: "python:3.7"
#    cache_key: "python37_cache"
#  dependencies:
#    - "build_python37"
#
#
#mypy_python38:
#  <<: *mypy_template
#  variables:
#    docker_image: "python:3.8"
#    cache_key: "python38_cache"
#  dependencies:
#    - "build_python38"
