swh:1:snp:72a4c465b82ec18a5d1f703821d91720268b476f
Raw File
Tip revision: 9cab8cfa4033d3f47a36c7bb816b2c9fae5cfdc6 authored by Philipp A on 07 June 2023, 13:46:06 UTC
Convert issue report templates to forms (#2503)
Tip revision: 9cab8cf
.azure-pipelines.yml
trigger:
- master

variables:
  python.version: '3.9'
  PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
  ANNDATA_DEV: no
  RUN_COVERAGE: no
  TEST_EXTRA: 'test-full'
  PRERELEASE_DEPENDENCIES: no

jobs:
- job: PyTest
  pool:
    vmImage: 'ubuntu-22.04'
  strategy:
    matrix:
      Python38:
        python.version: '3.8'
      Python39: {}
      minimal_tests:
        TEST_EXTRA: 'test-min'
      anndata_dev:
        python.version: '3.9'
        ANNDATA_DEV: yes
        RUN_COVERAGE: yes
        PRERELEASE_DEPENDENCIES: yes

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

  - task: Cache@2
    inputs:
      key: '"python $(python.version)" | "$(Agent.OS)" | pyproject.toml'
      restoreKeys: |
        python | "$(Agent.OS)"
        python
      path: $(PIP_CACHE_DIR)
    displayName: Cache pip packages

  - script: |
      export MPLBACKEND="agg"
      echo $MPLBACKEND
    displayName: 'Set env'

  - script: |
      python -m pip install --upgrade pip
      pip install pytest-cov wheel
      pip install .[dev,$(TEST_EXTRA)]
    displayName: 'Install dependencies'
    condition: eq(variables['PRERELEASE_DEPENDENCIES'], 'no')

  - script: |
      python -m pip install --pre --upgrade pip
      pip install --pre pytest-cov wheel
      pip install --pre .[dev,$(TEST_EXTRA)]
    displayName: 'Install dependencies release candidates'
    condition: eq(variables['PRERELEASE_DEPENDENCIES'], 'yes')

  - script: |
      pip install -v "anndata[dev,test] @ git+https://github.com/scverse/anndata"
    displayName: 'Install development anndata'
    condition: eq(variables['ANNDATA_DEV'], 'yes')

  - script: |
      pip list
    displayName: 'Display installed versions'

  - script: |
      pytest -v --color=yes --ignore=scanpy/tests/_images --nunit-xml="nunit/test-results.xml"
    displayName: 'PyTest'
    condition: eq(variables['RUN_COVERAGE'], 'no')

  - script: |
      pytest -v --color=yes --ignore=scanpy/tests/_images --nunit-xml="nunit/test-results.xml" --cov=scanpy --cov-report=xml
    displayName: 'PyTest (coverage)'
    condition: eq(variables['RUN_COVERAGE'], 'yes')

  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
      reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
    condition: eq(variables['RUN_COVERAGE'], 'yes')

  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testResultsFiles: 'nunit/test-results.xml'
      testResultsFormat: NUnit
      testRunTitle: 'Publish test results for Python $(python.version)'

  - script: bash <(curl -s https://codecov.io/bash)
    displayName: 'Upload to codecov.io'
    condition: eq(variables['RUN_COVERAGE'], 'yes')

- job: CheckBuild
  pool:
    vmImage: 'ubuntu-22.04'
  steps:

  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.9'
    displayName: 'Use Python 3.9'

  - script: |
      python -m pip install --upgrade pip
      pip install build twine
    displayName: 'Install build tools and requirements'

  - script: pip list
    displayName: 'Display installed versions'

  - script: |
      python -m build --sdist --wheel .
      twine check dist/*
    displayName: 'Build & Twine check'
back to top