99 строки
3.2 KiB
YAML
99 строки
3.2 KiB
YAML
# 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:
|
|
tags:
|
|
include:
|
|
- '*'
|
|
branches:
|
|
include:
|
|
- master
|
|
- release/*
|
|
- refs/tags/*
|
|
pr:
|
|
- master
|
|
- release/*
|
|
|
|
jobs:
|
|
- job: pytest
|
|
# how long to run the job before automatically cancelling
|
|
timeoutInMinutes: "45"
|
|
# how much time to give 'run always even if cancelled tasks' before stopping them
|
|
cancelTimeoutInMinutes: "2"
|
|
|
|
pool: gridai-spot-pool
|
|
|
|
container:
|
|
image: "pytorch/pytorch:1.8.1-cuda10.2-cudnn7-runtime"
|
|
options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --name ci-container -v /usr/bin/docker:/tmp/docker:ro"
|
|
|
|
workspace:
|
|
clean: all
|
|
|
|
steps:
|
|
|
|
- bash: |
|
|
whoami
|
|
id
|
|
lspci | egrep 'VGA|3D'
|
|
whereis nvidia
|
|
nvidia-smi
|
|
python --version
|
|
pip --version
|
|
pip list
|
|
displayName: 'Image info & NVIDIA'
|
|
|
|
- script: |
|
|
/tmp/docker exec -t -u 0 ci-container \
|
|
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
|
|
displayName: 'Install Sudo in container (thanks Microsoft!)'
|
|
|
|
- bash: |
|
|
set -ex
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc cmake ffmpeg git libsndfile1
|
|
# python -m pip install "pip==20.1"
|
|
pip install --requirement ./requirements/devel.txt --upgrade-strategy only-if-needed
|
|
pip uninstall -y torchmetrics
|
|
pip list
|
|
displayName: 'Install dependencies'
|
|
|
|
- bash: |
|
|
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
|
|
displayName: 'Sanity check'
|
|
|
|
- bash: |
|
|
python -m pytest torchmetrics tests -v --cov=torchmetrics --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
|
|
displayName: 'Testing'
|
|
|
|
- bash: |
|
|
python -m coverage report
|
|
python -m coverage xml
|
|
python -m coverage html
|
|
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
|
|
ls -l
|
|
displayName: 'Statistics'
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish test results'
|
|
inputs:
|
|
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
|
|
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
|
|
condition: succeededOrFailed()
|
|
|
|
# todo: re-enable after schema check pass, also atm it seems does not have any effect
|
|
#- task: PublishCodeCoverageResults@1
|
|
# displayName: 'Publish coverage report'
|
|
# inputs:
|
|
# codeCoverageTool: 'Cobertura'
|
|
# summaryFileLocation: '$(Build.SourcesDirectory)/coverage.xml'
|
|
# reportDirectory: '$(Build.SourcesDirectory)/htmlcov'
|
|
# testRunTitle: '$(Agent.OS) - $(Build.BuildNumber)[$(Agent.JobName)] - Python $(python.version)'
|
|
# condition: succeededOrFailed()
|
|
|
|
- bash: |
|
|
python -m pytest integrations -v --durations=25
|
|
displayName: 'Integrations'
|