97 строки
2.5 KiB
YAML
97 строки
2.5 KiB
YAML
resources:
|
|
- repo: self
|
|
#Multi-configuration and multi-agent job options are not exported to YAML. Configure these options using documentation guidance: https://docs.microsoft.com/vsts/pipelines/process/phases
|
|
jobs:
|
|
|
|
- job: 'Static_Analysis'
|
|
pool:
|
|
vmImage: 'Ubuntu 20.04'
|
|
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: '3.x'
|
|
architecture: 'x64'
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
inputs:
|
|
scanType: 'Register'
|
|
verbosity: 'Verbose'
|
|
alertWarningLevel: 'High'
|
|
|
|
- script: 'python scripts/env_setup.py --no_dev'
|
|
displayName: 'Prepare environment (install packages + dependencies + tools)'
|
|
|
|
- script: 'flake8 .'
|
|
displayName: 'Flake8'
|
|
|
|
- job: 'Test'
|
|
pool:
|
|
vmImage: 'Ubuntu 20.04'
|
|
strategy:
|
|
matrix:
|
|
Python36:
|
|
python.version: '3.6'
|
|
Python37:
|
|
python.version: '3.7'
|
|
Python38:
|
|
python.version: '3.8'
|
|
Python39:
|
|
python.version: '3.9'
|
|
Python310:
|
|
python.version: '3.10'
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
displayName: 'Use Python $(python.version)'
|
|
inputs:
|
|
versionSpec: '$(python.version)'
|
|
architecture: 'x64'
|
|
|
|
- script: 'python -m pip install --upgrade pip'
|
|
displayName: 'Update pip'
|
|
|
|
- script: 'python scripts/env_setup.py --no_dev'
|
|
displayName: 'Prepare environment (install packages + dependencies + tools)'
|
|
|
|
- script: 'pytest tests --junitxml=junit/azure-iot-device-test-results.xml --cov=azure --cov-report=xml:coverage.xml --cov-report=html:coverage --cov-append'
|
|
displayName: pytest
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/*-test-results.xml'
|
|
inputs:
|
|
testResultsFiles: '**/*-test-results.xml'
|
|
testRunTitle: 'Python $(python.version)'
|
|
condition: always()
|
|
|
|
- task: PublishCodeCoverageResults@1
|
|
inputs:
|
|
codeCoverageTool: 'cobertura'
|
|
summaryFileLocation: '$(Build.SourcesDirectory)/coverage.xml'
|
|
reportDirectory: '$(Build.SourcesDirectory)/coverage'
|
|
failIfCoverageEmpty: true
|
|
|
|
- job: 'Publish'
|
|
dependsOn:
|
|
- 'Test'
|
|
- 'Static_Analysis'
|
|
|
|
pool:
|
|
vmImage: 'Ubuntu 20.04'
|
|
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: '3.x'
|
|
architecture: 'x64'
|
|
|
|
- script: |
|
|
pip install wheel
|
|
pip install setuptools
|
|
python scripts/build_packages.py
|
|
displayName: Build source and wheel distribution
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish artifact dist'
|
|
inputs:
|
|
pathtoPublish: $(Build.SourcesDirectory)/dist
|
|
artifactName: 'dist'
|