trigger:
  branches:
    include:
      - "master"
  tags:
    include:
      - "*"

jobs:
- job: 'mac'
  pool:
    vmImage: 'macOS-10.14'
  strategy:
    matrix:
      Python27:
        python.version: '2.7'
        TOXENV: py27
      Python34:
        python.version: '3.4'
        TOXENV: py34
      Python35:
        python.version: '3.5'
        TOXENV: py35
      Python36:
        python.version: '3.6'
        TOXENV: py36
      Python37:
        python.version: '3.7'
        TOXENV: py37
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '$(python.version)'
      architecture: 'x64'

  - script: pip install tox
    displayName: 'Install tox'

  - script: tox
    displayName: 'Run tests'
- job: 'win'
  pool:
    vmImage: 'windows-2019'
  container: $[variables.containerImage]
  strategy:
    matrix:
      Python27-x86:
        TOXENV: py27
        containerImage: 'pyca/cryptography-runner-windows:py27-x86'
        PYTHON_DIR: 'Python27'
      Python27-x86-64:
        TOXENV: py27
        containerImage: 'pyca/cryptography-runner-windows:py27-x86_64'
        PYTHON_DIR: 'Python27'
      Python34-x86:
        TOXENV: py34
        containerImage: 'pyca/cryptography-runner-windows:py34-x86'
        PYTHON_DIR: 'Python34'
      Python34-x86-64:
        TOXENV: py34
        containerImage: 'pyca/cryptography-runner-windows:py34-x86_64'
        PYTHON_DIR: 'Python34'
      Python35-x86:
        TOXENV: py35
        containerImage: 'pyca/cryptography-runner-windows:py35-x86'
        PYTHON_DIR: 'Python35'
      Python35-x86-64:
        TOXENV: py35
        containerImage: 'pyca/cryptography-runner-windows:py35-x86_64'
        PYTHON_DIR: 'Python35'
      Python36-x86:
        TOXENV: py36
        containerImage: 'pyca/cryptography-runner-windows:py3-x86'
        PYTHON_DIR: 'Python36'
      Python36-x86-64:
        TOXENV: py36
        containerImage: 'pyca/cryptography-runner-windows:py3-x86_64'
        PYTHON_DIR: 'Python36'
      Python37-x86:
        TOXENV: py37
        containerImage: 'pyca/cryptography-runner-windows:py3-x86'
        PYTHON_DIR: 'Python37'
      Python37-x86-64:
        TOXENV: py37
        containerImage: 'pyca/cryptography-runner-windows:py3-x86_64'
        PYTHON_DIR: 'Python37'
  steps:
  - script: "C:/%PYTHON_DIR%/Scripts/tox"
    displayName: 'Run tests'
