sudo: false

language: python
python: 3.6

# empty "env:" is needed for 'allow_failures'
# https://docs.travis-ci.com/user/customizing-the-build/#Rows-that-are-Allowed-to-Fail
env:

matrix:
  fast_finish: true
  exclude:
    - python: 3.6
  include:
    - python: 2.7
      env: TOXENV=py27-cov
    - python: 3.6
      env:
        - TOXENV=py36-cov
        - BUILD_DIST=true
    - python: 3.7
      env: TOXENV=py37-cov
      dist: xenial
      sudo: true
    - python: pypy
      env: TOXENV=pypy-nocov
    - language: generic
      os: osx
      env: TOXENV=py27-cov
    - language: generic
      os: osx
      env:
        - TOXENV=py3-cov
        - HOMEBREW_NO_AUTO_UPDATE=1
    - env:
        - TOXENV=py27-nocov
        - PYENV_VERSION='2.7.6'
        - PYENV_VERSION_STRING='Python 2.7.6'
        - PYENV_ROOT=$HOME/.travis-pyenv
        - TRAVIS_PYENV_VERSION='0.4.0'
  allow_failures:
    # We use fast_finish + allow_failures because OSX builds take forever
    # https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
    - language: generic
      os: osx
      env: TOXENV=py27-cov
    - language: generic
      os: osx
      env:
        - TOXENV=py3-cov
        - HOMEBREW_NO_AUTO_UPDATE=1

cache:
  - pip
  - directories:
    - $HOME/.pyenv_cache

before_install:
  - source ./.travis/before_install.sh

install:
  - ./.travis/install.sh

script:
  - ./.travis/run.sh

after_success:
  - ./.travis/after_success.sh

before_deploy:
  - ./.travis/before_deploy.sh

deploy:
  # deploy to Github Releases on tags
  - provider: releases
    api_key:
      secure: Kdf6HnU4mm0UK+yd+ywpN87IcUbhQ2ShjEMwenIBnrvBd2tD1hzHWrfKJVpSnVBy8QEtOcEqdRsSL4NGq/3qgp5cAxkf8hLtNChaVACeQsmQA8SLauipFPukCtkrpNdOlSDZLNHoGcIcVVPyTEkLVUpt68BxBpX8M859pA9KZ7KqFnAQFiCH06Qi5NZNHYzFBFeEcpFZyeo+3BAMEMWNfHRfkebC7BIim4de79tCui7F3C54vcGug/CuGKGU8Pbd7nfYXwEtibCDV9uOKF+kW5m7923fAvhJILrzDe3/C9KjaqtH/HQiiTNMlJ1TK1R9rodP3UUu2fN0oPpe/bMQvJUzllHMeHRB4luuaYMriRDtcCmZwCCOFeeHo3QxK8zfjv/v1lcVivPuhJiFXvx+1mU9ktSnQ5iD9QU0Si97ctJPypLaUeZq1WoluaKDv8Yw0Lmq7mZPo+rByikcGwTX7nx/LJYGlw9gtIdXSLVpsglPilM+2jVDOo7h+8oslD/AKs1S3ujDAFOeogL3SylSyswDHr4GLQMZBf/NrPBQHJge3uMYaldwKcT8xzu3LpkyCazYvt4f+Mh3RYfmE06rk86+R3luk5NNHjIJvFm0I4j+I7PtjpQYCnx6vtkH4rR0FBuE2/T0V8BBxp2UbIZF/wztBtV89oiO6yBGOauwkTM=
    skip_cleanup: true
    file_glob: true
    file: "dist/*"
    on:
      tags: true
      repo: robofab-developers/fontPens
      all_branches: true
      condition: "$BUILD_DIST == true"
  # deploy to PyPI on tags
  - provider: pypi
    user: benkiel
    password:
      secure: "dQmUNMwDeq7162p3IE3M9d9BW3lfk/chaW8SY605YikW7J56bfT1CQFaOiYumdvMF/eWBrVxbQbdwdupL2sDm1dSgYKWu0ite1jePaoTkMhEKFr+XW7GogcX+LOiFa7FITscnWgV02XwijStbklQmZ2beBe/tjB5Ug/Swx6CVCsTN/j1n0+r3UjtHcsnVgN+XAhpC0+ewoyKkoKP/aalb2gGFwsRDh2SzJZ/sOICHmmjJUGDB6/vS8tGgnI1arDSpSH7KDNB1dVAfDvjK9yXFEDPkYO5vEU//vZWP9yKTqXPmDiv+SMg959UcdgCUnNPSv44/VDtqv9kNhG4t3Ye4bjV/WBnyZ3SiWF8XHI+r3nk6x6Swjhq8ZRPk861JhDPK67kCJHdmMjOfaKy+MoTWscDqLlzxxAABSv+HkgQ3LiHKqBbvJVBbuhbmFdo8qtmZXKl4z8LlUcTHskMAioEMbueKRW/+jEDN5xm0h7c4W2mfHyrnn3Td5hWpmXZKe7ZKqbU8koBruGJpnC6miE689nO6HLpQbW8AjYy6ZOkz4HbkZCAYh0NqYe7qwgFKx8+iYy5smWyiqAS7A4D1kyFzaXV5jEe87jddDc/wMofgcKSUBOGe9eM/w4FKVRCW8jAMkjMiZKVMzHE2f9nk9q4A8bU++Da/AgIw3JKOVnWAPg="
    skip_cleanup: true
    distributions: "sdist bdist_wheel"
    on:
      tags: true
      repo: robofab-developers/fontPens
      all_branches: true
      condition: "$BUILD_DIST == true"
