language: python
cache:
  pip: true
  directories:
    - $HOME/.cache/pre-commit

matrix:
  fast_finish: true
  include:
    - python: "3.7"
      env: TOXENV=lint
    - python: "pypy3"
    - python: "3.8"
    - python: "3.7"
    - python: "3.6"
    - python: "3.9-dev"

install:
  - pip install -U pip
  - pip install -U tox-travis

script:
  - tox

after_success:
  - |
    if [ "$TOXENV" != "lint" ]; then
      pip install -U codecov && codecov
    fi

deploy:
  - provider: pypi
    server: https://test.pypi.org/legacy/
    on:
      tags: false
      repo: hugovk/osmviz
      branch: master
      condition: $TOXENV = lint
    user: hugovk
    password:
      secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
    distributions: sdist --format=gztar bdist_wheel
    skip_existing: true
  - provider: pypi
    on:
      tags: true
      repo: hugovk/osmviz
      branch: master
      condition: $TOXENV = lint
    user: hugovk
    password:
      secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
    distributions: sdist --format=gztar bdist_wheel
    skip_existing: true
