jobs:
-
    job: 'Python2'
    pool:
        vmImage: 'ubuntu-latest'

    # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#timeouts
    # Maximum allowed as of Sep 5, 2019
    timeoutInMinutes: 360

    steps:
    -
        script: |
            set -e
            sed 's/python=3/python=2.7/' .test-conda-env-py3.yml > .test-conda-env-py2.yml
            cat .test-conda-env-py2.yml
            CONDA_ENVIRONMENT=.test-conda-env-py2.yml
            curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project-within-miniconda.sh
            . ./build-and-test-py-project-within-miniconda.sh

        displayName: 'Pytest Conda'
    -
        task: PublishTestResults@2
        inputs:
            testResultsFormat: 'JUnit'
            testResultsFiles: 'test/pytest.xml'

-
    job: 'Python3'
    pool:
        vmImage: 'ubuntu-latest'

    # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#timeouts
    # Maximum allowed as of Sep 5, 2019
    timeoutInMinutes: 360

    steps:
    -
        script: |
            set -e
            CONDA_ENVIRONMENT=.test-conda-env-py3.yml
            curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project-within-miniconda.sh
            . ./build-and-test-py-project-within-miniconda.sh

        displayName: 'Pytest Conda'

    -
        task: PublishTestResults@2
        inputs:
            testResultsFormat: 'JUnit'
            testResultsFiles: 'test/pytest.xml'

-
    job: 'Flake8'
    pool:
        vmImage: 'ubuntu-latest'
    strategy:
        matrix:
            Python37:
                python.version: '3.7'

    steps:
    -
        task: UsePythonVersion@0
        inputs:
            versionSpec: '$(python.version)'

    -
        script: |
            set -e
            curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh
            . ./prepare-and-run-flake8.sh pytential test

        displayName: 'Flake8'

-
    job: 'Pylint'
    pool:
        vmImage: 'ubuntu-latest'

    steps:
    -
        script: |
            set -e
            CONDA_ENVIRONMENT=.test-conda-env-py3-pylint.yml
            sed 's/numpy/numpy=1.15/' .test-conda-env-py3.yml > $CONDA_ENVIRONMENT
            echo "- matplotlib" >> $CONDA_ENVIRONMENT
            echo "-------------------------------------------"
            cat $CONDA_ENVIRONMENT
            echo "-------------------------------------------"
            USE_CONDA_BUILD=1
            curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh

            # Pylint won't find the Cython bits without this
            PROJECT_INSTALL_FLAGS="--editable"

            . ./prepare-and-run-pylint.sh pytential test/test_*.py

        displayName: 'Pylint'
