diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index c633bfe3c79..b5b3ea16e44 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -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 @@ -26,8 +30,17 @@ 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 @@ -35,6 +48,6 @@ steps: echo "Running full test" azdev test --no-exitfirst --profile ${{ parameters.profile }} --verbose --series fi - displayName: "Test on Profile ${{ parameters.profile }}" + displayName: "azdev test" env: ADO_PULL_REQUEST_LATEST_COMMIT: $(System.PullRequest.TargetBranch) diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 5f49baa3bd7..5dc98590d37 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -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 }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 609a0141c14..a225afbcb59 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -189,7 +189,7 @@ jobs: inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/metadata' artifactName: metadata - + - task: DownloadPipelineArtifact@1 displayName: 'Download Build Artifacts' inputs: @@ -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 @@ -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 @@ -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