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

{CI} Use azdev test for core and telemetry #17646

Merged
merged 2 commits into from
Apr 16, 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
17 changes: 15 additions & 2 deletions .azure-pipelines/templates/automation_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ parameters:
type: string
default: latest
- name: fullTest
displayName: 'Run full test?'
displayName: Run full test?
type: boolean
default: false
- name: module
displayName: Run test for specific module
type: string
default: ''

steps:
- task: UsePythonVersion@0
Expand All @@ -26,15 +30,24 @@ steps:
echo pythonVersion: ${{ parameters.pythonVersion }}
echo profile: ${{ parameters.profile }}
echo fullTest: ${{ parameters.fullTest }}
echo module: ${{ parameters.module }}
echo Build.Reason: $(Build.Reason)

# Test specific module
module="${{ parameters.module }}"
if [[ -n $module ]]; then
echo "Running test for module '$module'"
azdev test --no-exitfirst --verbose --series $module
exit 0
fi

if [[ "$(Build.Reason)" == "PullRequest" && "${{ parameters.fullTest }}" == 'False' ]]; then
echo "Running incremental test"
azdev test --no-exitfirst --repo=./ --src=HEAD --tgt=origin/$(System.PullRequest.TargetBranch) --cli-ci --profile ${{ parameters.profile }} --verbose --series
else
echo "Running full test"
azdev test --no-exitfirst --profile ${{ parameters.profile }} --verbose --series
fi
displayName: "Test on Profile ${{ parameters.profile }}"
displayName: "azdev test"
Copy link
Member Author

@jiasli jiasli Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the displayName to better reflect what is done inside.

Showing Profile xxx is unnecessary as it is already shown in parent job.

image

env:
ADO_PULL_REQUEST_LATEST_COMMIT: $(System.PullRequest.TargetBranch)
2 changes: 1 addition & 1 deletion .azure-pipelines/templates/azdev_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
else
azdev setup -c $CLI_REPO_PATH -r $CLI_EXT_REPO_PATH --debug
fi
displayName: 'Azdev Setup'
displayName: 'azdev setup'
env:
CLI_REPO_PATH: ${{ parameters.CLIRepoPath }}
CLI_EXT_REPO_PATH: ${{ parameters.CLIExtensionRepoPath }}
42 changes: 25 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata

- task: DownloadPipelineArtifact@1
displayName: 'Download Build Artifacts'
inputs:
Expand All @@ -201,7 +201,7 @@ jobs:
inputs:
targetType: inline
script: |
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Start another Powershell process as Admin and execute this script again
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Expand All @@ -223,7 +223,7 @@ jobs:
$to_be_installed_version=Get-Content $(System.ArtifactsDirectory)/metadata/version
if ($pre_installed_version -eq $to_be_installed_version){
# See https://docs.microsoft.com/windows/win32/msi/reinstallmode about options of REINSTALLMODE
$reinstall_option="REINSTALL=ALL REINSTALLMODE=emus"
$reinstall_option="REINSTALL=ALL REINSTALLMODE=emus"
$InstallArgs += $reinstall_option
}
Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow
Expand Down Expand Up @@ -372,31 +372,39 @@ jobs:

displayName: 'Test pip Install'

- job: UnitTest
displayName: Unit Test for Core and Telemetry
- job: TestCore
displayName: Unit Test for Core
timeoutInMinutes: 10
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
steps:
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
module: 'azure-cli-core'

- job: TestTelemetry
displayName: Unit Test for Telemetry
timeoutInMinutes: 10
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
tox_env: 'py36'
Python38:
python.version: '3.8'
tox_env: 'py38'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade pip tox
displayName: 'Install pip and tox'
- bash: ./scripts/ci/unittest.sh
displayName: 'Run Unit Test'
env:
TOXENV: $(tox_env)
- template: .azure-pipelines/templates/automation_test.yml
parameters:
pythonVersion: '$(python.version)'
module: 'azure-cli-telemetry'

- job: IntegrationTestAgainstProfiles
displayName: Integration Test against Profiles
Expand Down