# from matplotlib's azure setup

schedules:
  - cron: "0 0 * * 4"
    displayName: Weekly build
    branches:
      include:
        - releases/*
    always: true

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

variables:
  PIP_CACHE_DIR: $(Pipeline.Workspace)/cache/pip

jobs:
  - job: "static_checks"
    pool:
      vmImage: ubuntu-20.04
    variables:
      TOXENV: flake8,pylint,docs,check-manifest,checkreadme
    steps:
      - task: UsePythonVersion@0
        inputs:
          versionSpec: "3.8"
          architecture: "x64"
      - script: |
          pip install tox
        displayName: Install tox
      - script: |
          tox
        displayName: tox

  - job: "ubuntu2004"
    pool:
      vmImage: ubuntu-20.04
    strategy:
      matrix:
        py37:
          python.version: "3.7"
          TOXENV: py37
        py38:
          python.version: "3.8"
          TOXENV: py38
        py39:
          python.version: "3.9"
          TOXENV: py39
        py310:
          python.version: "3.10"
          TOXENV: py310
        py37-mpi:
          python.version: "3.7"
          TOXENV: py37-mpi
        py38-mpi:
          python.version: "3.8"
          TOXENV: py38-mpi
        py39-mpi:
          python.version: "3.9"
          TOXENV: py39-mpi
        py310-mpi:
          python.version: "3.10"
          TOXENV: py310-mpi
        py37-oldpt:
          python.version: "3.7"
          TOXENV: py37-oldpt
        py38-oldpt:
          python.version: "3.8"
          TOXENV: py38-oldpt
        py39-oldpt:
          python.version: "3.9"
          TOXENV: py39-oldpt
        py37-mpi-oldpt:
          python.version: "3.7"
          TOXENV: py37-mpi-oldpt
        py38-mpi-oldpt:
          python.version: "3.8"
          TOXENV: py38-mpi-oldpt
        py39-mpi-oldpt:
          python.version: "3.9"
          TOXENV: py39-mpi-oldpt

    steps:
      - template: ci/azure-pipelines-steps.yml
        parameters:
          platform: linux
          installer: apt

#  - job: "macOS1015"
#    pool:
#      vmImage: macOS-10.15
#    strategy:
#      matrix:
#        py37:
#          python.version: "3.7"
#          TOXENV: py37
#        py38:
#          python.version: "3.8"
#          TOXENV: py38
#        py39:
#          python.version: "3.9"
#          TOXENV: py39
#        py37-mpi:
#          python.version: "3.7"
#          TOXENV: py37-mpi
#        py38-mpi:
#          python.version: "3.8"
#          TOXENV: py38-mpi
#        py39-mpi:
#          python.version: "3.9"
#          TOXENV: py39-mpi
#      maxParallel: 4
#
#    steps:
#      - template: ci/azure-pipelines-steps.yml
#        parameters:
#          platform: macos
#          installer: brew
