parameters:
  name: ''
  vmImage: ''

jobs:
- job: ${{ parameters.name }}
  pool:
    vmImage: ${{ parameters.vmImage }}
  strategy:
    matrix:
      py36_np15:
        ENV_FILE: ci/deps/azure-windows-36.yaml
        CONDA_PY: "36"
        PATTERN: "not slow and not network"

      py37_np18:
        ENV_FILE: ci/deps/azure-windows-37.yaml
        CONDA_PY: "37"
        PATTERN: "not slow and not network"

  steps:
    - powershell: |
        Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
        Write-Host "##vso[task.prependpath]$HOME/miniconda3/bin"
      displayName: 'Add conda to PATH'

    - script: conda update -q -n base conda
      displayName: 'Update conda'

    - bash: |
        conda env create -q --file ci\\deps\\azure-windows-$(CONDA_PY).yaml
      displayName: 'Create anaconda environment'

    - bash: |
        source activate pandas-dev
        conda list
        python setup.py build_ext -q -i -j 4
        python -m pip install --no-build-isolation -e .
      displayName: 'Build'

    - bash: |
        source activate pandas-dev
        ci/run_tests.sh
      displayName: 'Test'

    - task: PublishTestResults@2
      condition: succeededOrFailed()
      inputs:
        failTaskOnFailedTests: true
        testResultsFiles: 'test-data.xml'
        testRunTitle: ${{ format('{0}-$(CONDA_PY)', parameters.name) }}
      displayName: 'Publish test results'

    - bash: |
        source activate pandas-dev
        python ci/print_skipped.py
      displayName: 'Print skipped tests'
