Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline updates #359

Merged
merged 8 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions .azure-devops/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@ pr: none

trigger: none

variables:
pythonVersion: '3.6.x'
architecture: 'x64'
parameters:
- name: pythonVersion
type: string
default: '3.6.x'
values:
- 3.6.x
- 3.9.x
- name: architecture
type: string
default: 'x64'
- name: 'testCentral'
type: boolean
default: true
- name: 'testADT'
type: boolean
default: true
- name: 'testDPS'
type: boolean
default: true
- name: 'testHub'
type: boolean
default: true

stages:
- stage: 'build'
Expand All @@ -13,27 +32,27 @@ stages:

- job: 'Build_Publish_Azure_IoT_CLI_Extension'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(pythonVersion)
architecture: $(architecture)
versionSpec: ${{ parameters.pythonVersion }}
architecture: ${{ parameters.architecture }}

- template: templates/setup-ci-machine.yml

- template: templates/build-publish-azure-iot-cli-extension.yml

- job: 'Build_Publish_Azure_CLI_Test_SDK'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(pythonVersion)
architecture: $(architecture)
versionSpec: ${{ parameters.pythonVersion }}
architecture: ${{ parameters.architecture }}

- template: templates/setup-ci-machine.yml

Expand All @@ -45,15 +64,15 @@ stages:
steps:
- template: templates/setup-dev-test-env.yml
parameters:
pythonVersion: $(pythonVersion)
architecture: $(architecture)
pythonVersion: ${{ parameters.pythonVersion }}
architecture: ${{ parameters.architecture }}

- template: templates/install-and-record-version.yml

- stage: 'test'
displayName: 'Run tests'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'
dependsOn: build
jobs:
- job: 'testCentral'
Expand Down Expand Up @@ -105,8 +124,8 @@ stages:
steps:
- template: templates/calculate-code-coverage.yml
parameters:
pythonVersion: $(pythonVersion)
architecture: $(architecture)
pythonVersion: ${{ parameters.pythonVersion }}
architecture: ${{ parameters.architecture }}

- stage: 'release'
displayName: 'Stage GitHub release'
Expand Down
22 changes: 11 additions & 11 deletions .azure-devops/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- job: 'build_and_publish_azure_iot_cli_ext'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
Expand All @@ -31,7 +31,7 @@ jobs:

- job: 'build_and_publish_azure_cli_test_sdk'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
Expand All @@ -45,7 +45,7 @@ jobs:
- job: 'run_unit_tests_ubuntu'
dependsOn: [ 'build_and_publish_azure_iot_cli_ext', 'build_and_publish_azure_cli_test_sdk']
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python36:
Expand All @@ -62,8 +62,8 @@ jobs:
- template: templates/run-tests.yml
parameters:
pythonVersion: '$(python.version)'
runUnitTests: 'true'
runIntTests: 'false'
runUnitTests: true
runIntTests: false

- job: 'run_unit_tests_macOs'
dependsOn: ['build_and_publish_azure_iot_cli_ext', 'build_and_publish_azure_cli_test_sdk']
Expand All @@ -74,8 +74,8 @@ jobs:
- template: templates/run-tests.yml
parameters:
pythonVersion: '3.8.x'
runUnitTests: 'true'
runIntTests: 'false'
runUnitTests: true
runIntTests: false

- template: templates/calculate-code-coverage.yml

Expand All @@ -93,13 +93,13 @@ jobs:
- template: templates/run-tests.yml
parameters:
pythonVersion: '3.8.x'
runUnitTests: 'true'
runIntTests: 'false'
runUnitTests: true
runIntTests: false

- job: 'run_style_check'
dependsOn: ['build_and_publish_azure_iot_cli_ext', 'build_and_publish_azure_cli_test_sdk']
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
Expand All @@ -124,7 +124,7 @@ jobs:
dependsOn: ['build_and_publish_azure_iot_cli_ext']
displayName: 'Evaluate IoT extension command table'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
Expand Down
88 changes: 88 additions & 0 deletions .azure-devops/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Run nightly at midnight.
schedules:
- cron: "0 0 * * *"
displayName: Nightly Integration Build
branches:
include:
- dev

variables:
pythonVersion: '3.6.x'
architecture: 'x64'

stages:
- stage: 'build'
displayName: 'Build and Publish Artifacts'
jobs:

- job: 'Build_Publish_Azure_IoT_CLI_Extension'
pool:
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(pythonVersion)
architecture: $(architecture)

- template: templates/setup-ci-machine.yml

- template: templates/build-publish-azure-iot-cli-extension.yml

- job: 'Build_Publish_Azure_CLI_Test_SDK'
pool:
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(pythonVersion)
architecture: $(architecture)

- template: templates/setup-ci-machine.yml

- template: templates/build-publish-azure-cli-test-sdk.yml

- job: 'recordVersion'
displayName: 'Install and verify version'
dependsOn: [Build_Publish_Azure_IoT_CLI_Extension, Build_Publish_Azure_CLI_Test_SDK]
steps:
- template: templates/setup-dev-test-env.yml
parameters:
pythonVersion: $(pythonVersion)
architecture: $(architecture)

- template: templates/install-and-record-version.yml

- stage: 'test'
displayName: 'Run all tests'
pool:
vmImage: 'ubuntu-latest'
dependsOn: build
jobs:
- job: 'azEdge'
displayName: 'Test against edge AZ CLI'
steps:
- template: templates/nightly-tests.yml
parameters:
azureCLIVersion: 'edge'
- job: 'azMin'
dependsOn: 'azEdge'
displayName: 'Test against minimum supported AZ CLI'
steps:
- template: templates/nightly-tests.yml
parameters:
azureCLIVersion: 'min'

- stage: 'kpi'
displayName: 'Build KPIs'
dependsOn: [build, test]
jobs:
- job: 'calculateCodeCoverage'
displayName: 'Calculate distributed code coverage'
steps:
- template: templates/calculate-code-coverage.yml
parameters:
pythonVersion: $(pythonVersion)
architecture: $(architecture)

14 changes: 14 additions & 0 deletions .azure-devops/templates/install-azure-cli-min.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
steps:
- task: PythonScript@0
displayName: 'Check minimum supported version of Azure CLI'
inputs:
scriptSource: 'inline'
script: |
import json
with open("$(System.DefaultWorkingDirectory)/azext_iot/azext_metadata.json") as f:
metadata = json.load(f)
version = metadata['azext.minCliCoreVersion']
print('##vso[task.setvariable variable=min_cli_version]{}'.format(version))
- bash: |
pip install azure-cli==$(min_cli_version)
displayName: "Install minimum supported CLI version"
55 changes: 55 additions & 0 deletions .azure-devops/templates/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
parameters:
- name: pythonVersion
type: string
default: '3.6.x'
- name: architecture
type: string
default: 'x64'
- name: azureCLIVersion
type: string
default: released
values:
- min
- released
- edge

steps:
- template: setup-dev-test-env.yml
parameters:
architecture: ${{ parameters.architecture }}
pythonVersion: ${{ parameters.pythonVersion }}
azureCLIVersion: ${{ parameters.azureCLIVersion }}

- template: set-testenv-sentinel.yml

- script: |
pytest -vv azext_iot/tests -k "_unit" --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-unit.xml
displayName: 'All unit tests'
env:
COVERAGE_FILE: .coverage.all

- task: AzureCLI@2
continueOnError: true
displayName: 'All integration tests'
inputs:
azureSubscription: az-cli-nightly
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
export COVERAGE_FILE=.coverage.all
pytest -vv azext_iot/tests -k "_int" --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: .coverage.all
publishLocation: 'Container'
artifactName: 'coverage'

- task: PublishTestResults@2
condition: succeededOrFailed()
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results for Python ${{ parameters.pythonVersion }} on OS $(Agent.OS)'
searchFolder: '$(System.DefaultWorkingDirectory)'
Loading