default:
  image: debian:unstable

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

tests:
  before_script:
  - apt-get update
  - apt-get -y install --no-install-recommends build-essential debhelper fakeroot flit libjs-jquery python3-all python3-all-dbg python3-all-dev python3-build python3-installer python3-nose2 python3-poetry-core python3-pytest python3-setuptools python3-cachy tox

  script:
  - make tests
  - echo -e '#!/bin/sh\nset -eu\nmake "$@"' > debian/tests/run-installed
  - export DH_PYTHON_DIST=$PWD/pydist
  - ./debian/tests/dh-python
  - ./debian/tests/pybuild

style:
  before_script:
  - apt-get update
  - apt-get -y install --no-install-recommends black make pylint

  script:
  - pylint dhpython dh_python3 pybuild
  - make black BLACK_ARGS=--check

typecheck:
  before_script:
  - apt-get update
  - apt-get -y install --no-install-recommends python3-installer mypy make

  script:
  - make mypy
