# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/
image: python:3

variables:
  #XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"

cache:
  paths:
    - .cache

stages:
  - test
  - build

test:
  stage: test
  script:
  - pip install pytest-cov requests
  - py.test -q --cov=sima tests
  - python setup.py test
  # build wheel and source
  - python setup.py bdist_wheel sdist
  # install
  - pip install dist/*.whl
  # smoke test
  - mpd-sima --help
  artifacts:
    expire_in: 1 hour
    paths:
    - dist/*.whl
    - dist/*.tar.gz
    - dist/*.zip

tag_release:
  stage: build
  dependencies:
    - test
  script:
    - python -V
  artifacts:
    paths:
    - dist/*.whl
    - dist/*.tar.gz
    - dist/*.zip
    name: "$CI_PROJECT_NAME-$CI_COMMIT_TAG"
  cache: {}
  only:
    - tags
