# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'
strategy:
  matrix:
    Python27:
      python.version: '2.7'
    Python34:
      python.version: '3.4'
    Python35:
      python.version: '3.5'
    Python36:
      python.version: '3.6'
    Python37:
      python.version: '3.7'

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

- script: |
    python -m pip install --upgrade pip
    pip install -r requirements.txt
  displayName: 'Install dependencies'

- script: |
    pip install pytest pytest-azurepipelines
    pytest
  displayName: 'pytest'

# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'
strategy:
  matrix:
    Python27:
      python.version: '2.7'
    Python34:
      python.version: '3.4'
    Python35:
      python.version: '3.5'
    Python36:
      python.version: '3.6'
    Python37:
      python.version: '3.7'

steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
  displayName: Add conda to PATH

- task: UsePythonVersion@0
  inputs:
    versionSpec: '$(python.version)'
  displayName: 'Use Python $(python.version)'

- script: |
    CONDA_ENV=$(grep -Po '(?<=name:).*(?= *)' environment.yml)-$(python.version)
    echo "##vso[task.setvariable variable=conda_env]$CONDA_ENV"
    conda create --yes --name $CONDA_ENV python=$(python.version)
    conda env update --quiet --name $CONDA_ENV --file environment.yml
  displayName: Create conda environment

- script: |
    source activate $CONDA_ENV
    conda install -y -c conda-forge pytest pytest-azurepipelines
    pytest
  displayName: Run tests in conda environment

Change dependency management to conda
Change dependency management to conda
