# https://github.com/python/mypy
# this job uses mypy2junit to get the junitxml report in gitlab CI

# This variable tells the kaniko job to add python testing packages to a separate testing image
variables:
  PYTHON_TEST: "true"

python:mypy:
  stage: test
  image: registry.gitlab.com/notno/python-tests
  variables:
    CHECK_PATH: "./${PYTHON_PACKAGE}"
    DEFAULT_SETTINGS: "--strict --ignore-missing-imports --show-error-context"  # Override this for special needs
    EXTRA_SETTINGS: ""  # Use this to add your settings to the default
  script:
    # stdout 
    - mypy ${DEFAULT_SETTINGS} ${EXTRA_SETTINGS} ${CHECK_PATH} | tee mypy.out || exit_code=$?
    # junitxml
    - mypy2junit mypy.out > mypy-report.xml
    - exit $exit_code
  artifacts:
    reports:
      junit: mypy-report.xml
  cache:
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
    paths:
      - .mypycache/
  needs: []
