language: python
python: 3.5

env:
  global:
    - TWINE_USERNAME="anthrotype"
    - secure: PJuCmlDuwnojiw3QuDhfNAaU4f/yeJcEcRzJAudA66bwZK7hvxV7Tiy9A17Bm6yO0HbJmmyjsIr8h2e7/PyY6QCaV8RqcMDkQ0UraU16pRsihp0giVXJoWscj2sCP4cNDOBVwSaGAX8yZ2OONc5srESywghzcy8xmgw6O+XFqx4=

branches:
  only:
    - master
    # We want to build wip/* branches since these are not usually used for PRs
    - /^wip\/.*$/
    # We want to build version tags as well.
    - /^\d+\.\d+.*$/

matrix:
  fast_finish: true
  exclude:
    # Exclude the default Python 3.5 build
    - python: 3.5
  include:
    - python: 2.7
      env: TOXENV=py27-cov
    - python: 3.5
      env: TOXENV=py35-cov
    - python: 3.6
      env:
        - TOXENV=py36-cov,package_readme
        - BUILD_DIST=true
    - python: 3.7
      env: TOXENV=py37-cov
      # required to run python3.7 on Travis CI
      # https://github.com/travis-ci/travis-ci/issues/9815
      dist: xenial
    - python: pypy2.7-6.0
      # disable coverage.py on pypy because of performance problems
      env: TOXENV=pypy
      dist: xenial
    - language: generic
      os: osx
      env: TOXENV=py27-cov
    - language: generic
      os: osx
      env:
        - TOXENV=py3-cov
        - HOMEBREW_NO_AUTO_UPDATE=1
    - env:
        - TOXENV=py27
        - 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

notifications:
  irc: "irc.freenode.org##fonts"
  email: fonttools-dev@googlegroups.com

deploy:
  # deploy to Github Releases on tags
  - provider: releases
    api_key:
      secure: KEcWhJxMcnKay7wmWJCpg2W5GWHTQ+LaRbqGM11IKGcQuEOFxWuG7W1xjGpVdKPj/MQ+cG0b9hGUFpls1hwseOA1HANMv4xjCgYkuvT1OdpX/KOcZ7gfe/qaovzVxHyP9xwohnHSJMb790t37fmDfFUSROx3iEexIX09LLoDjO8=
    skip_cleanup: true
    file_glob: true
    file: "dist/*"
    on:
      tags: true
      repo: fonttools/fonttools
      all_branches: true
      condition: "$BUILD_DIST == true"
