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

335 строки
8.6 KiB
YAML
Исходник Постоянная ссылка Обычный вид История

resources:
- repo: self
trigger:
batch: true
branches:
include:
- '*'
jobs:
- job: ExtractMetadata
displayName: 'Extract Metadata'
condition: succeeded()
pool:
name: 'pool-ubuntu-2004'
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:
name: 'pool-ubuntu-2004'
steps:
- task: UsePythonVersion@0
2024-11-05 11:31:52 +03:00
displayName: 'Use Python 3.12'
inputs:
2024-11-05 11:31:52 +03:00
versionSpec: 3.12
- 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: BuildCliDiffToolPythonWheel
displayName: 'Build Python Wheel for cli breaking change detection tool'
condition: succeeded()
pool:
name: 'pool-ubuntu-2004'
steps:
- task: UsePythonVersion@0
2024-11-05 11:31:52 +03:00
displayName: 'Use Python 3.12'
inputs:
2024-11-05 11:31:52 +03:00
versionSpec: 3.12
- task: Bash@3
displayName: 'Run Wheel Build Script'
inputs:
targetType: 'filePath'
filePath: scripts/ci/build_cli_diff_tool.sh
- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: pypi'
inputs:
TargetPath: $(Build.ArtifactStagingDirectory)
ArtifactName: pypi_cli_diff_tool
- job: Unittest
timeoutInMinutes: 10
pool:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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'
- task: UsePythonVersion@0
displayName: 'azure cli diff tool unittests'
inputs:
versionSpec: '$(python.version)'
- bash: |
set -ev
python -m venv env
. env/bin/activate
# install azure cli diff tool from source code
cd azure-cli-diff-tool
pip install -e .
pip install pytest-cov
python -m pytest tests --cov=azure_cli_diff_tool --cov-report=xml
- job: TestAzdevSetup
displayName: 'Test azdev setup'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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 acr
displayName: 'Test azdev linter'
- job: TestAzdevStyle
displayName: 'Test azdev style'
dependsOn: BuildPythonWheel
condition: succeeded()
pool:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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:
name: 'pool-ubuntu-2004'
strategy:
matrix:
Python39:
python.version: '3.9'
2024-11-05 11:31:52 +03:00
Python312:
python.version: '3.12'
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:
# 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"