# configure
image: python:latest
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
  paths:
    - .cache/pip
    - venv/

# common to all scripts
before_script:
  - python -V  # Print out python version for debugging
  - pip install -U virtualenv
  - virtualenv venv
  - source venv/bin/activate
  - pip install -U flit
  - pip install -U pytest
  - pip install -U mypy
  - pip install .

# test stage
mypy:
  stage: test
  script:
    - mypy yaq_traits
entry:
  stage: test
  script:
    - yaq-traits --help

# deploy stage
pages:
  stage: deploy
  script:
    - mkdir public
    - cp docs/* public/
  artifacts:
    paths:
    - public/
  only:
  - master
flit:
  stage: deploy
  script:
    - flit publish
  artifacts:
    paths:
      - dist/*
  only:
    - tags
