azure-cli-dev-tools/azure-pipelines.yml

355 строки
8.6 KiB
YAML

resources:
- repo: self
trigger:
batch: true
branches:
include:
- '*'
jobs:
- job: Tox36
displayName: 'Tox: Python 3.6'
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
versionSpec: 3.6
- task: Bash@3
displayName: 'Run Tox'
env:
TOXENV: py36
inputs:
targetType: 'filePath'
filePath: scripts/ci/run_tox.sh
- job: Tox37
displayName: 'Tox: Python 3.7'
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- task: Bash@3
displayName: 'Run Tox'
env:
TOXENV: py37
inputs:
targetType: 'filePath'
filePath: scripts/ci/run_tox.sh
- job: Tox38
displayName: 'Tox: Python 3.8'
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.8'
inputs:
versionSpec: 3.8
- task: Bash@3
displayName: 'Run Tox'
env:
TOXENV: py38
inputs:
targetType: 'filePath'
filePath: scripts/ci/run_tox.sh
- job: ExtractMetadata
displayName: 'Extract Metadata'
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: Bash@3
displayName: 'Extract Version'
inputs:
targetType: 'filePath'
filePath: scripts/ci/extract_version.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: metadata'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: metadata
- job: BuildPythonWheel
displayName: 'Build Python Wheel'
dependsOn: ExtractMetadata
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- task: Bash@3
displayName: 'Run Wheel Build Script'
inputs:
targetType: 'filePath'
filePath: scripts/ci/build.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: pypi'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: pypi
- job: Unittest
timeoutInMinutes: 10
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
set -ev
python -m venv env
. env/bin/activate
# install azdev from source code
pip install -e .
pip install pytest-cov
# azdev setup
git clone --quiet https://github.com/Azure/azure-cli.git
git clone --quiet https://github.com/Azure/azure-cli-extensions.git
azdev setup -c ./azure-cli -r ./azure-cli-extensions
azdev --version
python -m pytest azdev/ --ignore=azdev/mod_templates --junitxml=junit/test-results.xml --cov=azdev --cov-report=xml
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results for Python $(python.version)'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
- job: TestAzdevSetup
displayName: 'Test azdev setup'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
#!/usr/bin/env bash
set -ev
. scripts/ci/install.sh
# verify azdev setup worked
az -h
displayName: 'Test azdev setup'
- job: TestAzdevTest
displayName: 'Test azdev test'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
#!/usr/bin/env bash
set -ev
. scripts/ci/install.sh
# verify azdev test works
azdev test redis
displayName: 'Test azdev test'
- job: TestAzdevLinter
displayName: 'Test azdev linter'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
#!/usr/bin/env bash
set -ev
. scripts/ci/install.sh
# verify azdev linter works
azdev linter CLI
displayName: 'Test azdev linter'
- job: TestAzdevStyle
displayName: 'Test azdev style'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.7'
Python38:
python.version: '3.8'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
#!/usr/bin/env bash
set -ev
. scripts/ci/install.sh
# verify azdev style works
azdev style redis
displayName: 'Test azdev style'
- job: PerformanceCheckOnLinux
displayName: "Performance Check on Linux"
dependsOn: BuildPythonWheel
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Build'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
artifactName: pypi
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: |
set -ev
. scripts/ci/install.sh
azdev --version
displayName: 'Azdev Setup'
- bash: |
set -ev
. env/bin/activate
azdev perf load-times
displayName: "Load Performance"
- bash: |
set -ev
. env/bin/activate
azdev perf benchmark "version" "network vnet -h" "rest -h" "storage account" -o table
displayName: "Execution Performance"
# - job: PerformanceCheckOnWindows
# displayName: "Performance Check on Windows"
# dependsOn: BuildPythonWheel
# pool:
# vmImage: 'vs2017-win2016'
# strategy:
# matrix:
# Python36:
# python.version: '3.6'
# Python38:
# python.version: '3.8'
# steps:
# - task: DownloadPipelineArtifact@1
# displayName: 'Download Build'
# inputs:
# TargetPath: '$(Build.ArtifactStagingDirectory)/pypi'
# artifactName: pypi
# - task: UsePythonVersion@0
# displayName: 'Use Python $(python.version)'
# inputs:
# versionSpec: '$(python.version)'
# - powershell: |
# python -m venv env
# .\env\Scripts\Activate.ps1
# pip install --user -U pip setuptools wheel -q
# pip install --user $(find ${BUILD_ARTIFACTSTAGINGDIRECTORY}/pypi -name *.tar.gz) -q
# git clone https://github.com/Azure/azure-cli.git
# git clone https://github.com/Azure/azure-cli-extensions.git
# azdev setup -c -r azure-cli-extensions
# azdev --version
# displayName: 'Azdev Setup'
# - powershell: |
# .\env\Scripts\Activate.ps1
# azdev perf load-times
# displayName: "Load Performance"
# - powershell: |
# .\env\Scripts\Activate.ps1
# azdev perf benchmark "version" "network vnet -h" "rest -h" "storage account"
# displayName: "Execution Performance"