image: Visual Studio 2015

environment:
  matrix:
    - TOXENV: py35
    - TOXENV: py37-cover

branches:
  only:
    - master
    - /^\d+\.\d+\.x$/ # Version branches like X.X.X
    - /^test-.*$/

init:
  # Since master can receive only commits from PR that have already been tested, following
  # condition avoid to launch all jobs except the coverage one for commits pushed to master.
  - ps: |
      if (-Not $Env:APPVEYOR_PULL_REQUEST_NUMBER -And $Env:APPVEYOR_REPO_BRANCH -Eq 'master' `
          -And -Not ($Env:TOXENV -Like '*-cover'))
      { $Env:APPVEYOR_SKIP_FINALIZE_ON_EXIT = 'true'; Exit-AppVeyorBuild }

install:
  # Use Python 3.7 by default
  - "SET PATH=C:\\Python37;C:\\Python37\\Scripts;%PATH%"
  # Check env
  - "python --version"
  # Upgrade pip to avoid warnings
  - "python -m pip install --upgrade pip"
  # Ready to install tox and coverage
  - "pip install tox codecov"

build: off

test_script:
  - set TOX_TESTENV_PASSENV=APPVEYOR
  # Test env is set by TOXENV env variable
  - tox

on_success:
  - if exist .coverage codecov
