Skip to content
Draft
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
29 changes: 29 additions & 0 deletions .azure-pipelines/PipelineSteps/test-steps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,35 @@ $ErrorActionPreference = $preference
Set-Location $currentPath
Write-Host -ForegroundColor DarkGreen "-------------------- End testing AutoGen modules with PowerShell Core ... --------------------`n`n`n`n`n"

# Test AutoGen Modules With Windows PowerShell 5.1
if ($IsWindows) {
Write-Host -ForegroundColor Green "-------------------- Start testing AutoGen modules with Windows PowerShell 5.1 ... --------------------"
$executeCIStepScriptPath = Join-Path $RepoRoot "tools" "ExecuteCIStep.ps1"
$currentPath = $PWD
$debugFolderPath = Join-Path $RepoRoot "artifacts" "Debug"
Set-Location $debugFolderPath

$winPs = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'
& $winPs -NoProfile -Command @"
Comment thread
YangAn-microsoft marked this conversation as resolved.
`$ErrorActionPreference = 'Continue'
Install-Module -Name Pester -Repository PSGallery -RequiredVersion 4.10.1 -Force
`$env:PSModulePath = `$env:PSModulePath + ';' + (pwd).Path
`$rootFolder = (Get-item `$PWD).Parent.Parent
Get-ChildItem -File -Recurse test-module.ps1 | ForEach-Object {
Write-Host `$_.Directory.FullName
cd `$rootFolder
& '$executeCIStepScriptPath' -TestAutorest -AutorestDirectory `$_.Directory.FullName
}
"@
$winPsExitCode = $LASTEXITCODE

Set-Location $currentPath
if ($winPsExitCode -ne 0) {
throw "Windows PowerShell 5.1 AutoGen module tests failed with exit code $winPsExitCode."
}
Write-Host -ForegroundColor DarkGreen "-------------------- End testing AutoGen modules with Windows PowerShell 5.1 ... --------------------`n`n`n`n`n"
}

# Analyze test coverage
Write-Host -ForegroundColor Green "-------------------- Start analyzing test coverage ... --------------------"
$validateTestCoverageScriptPath = Join-Path $RepoRoot 'tools' 'TestFx' 'Coverage' 'ValidateTestCoverage.ps1'
Expand Down
14 changes: 14 additions & 0 deletions .azure-pipelines/util/test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ steps:
env:
PowerShellPlatform: ${{ parameters.powerShellPlatform }}

- powershell: |
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force
$sp = [System.IO.Path]::PathSeparator
$env:PSModulePath = $env:PSModulePath + $sp + (pwd).Path
Comment thread
YangAn-microsoft marked this conversation as resolved.
$rootFolder = (Get-item $PWD).Parent.Parent
Get-ChildItem -File -Recurse test-module.ps1 | ForEach-Object {
Write-Host $_.Directory.FullName
cd $rootFolder
& .\tools\ExecuteCIStep.ps1 -TestAutorest -AutorestDirectory $_.Directory.FullName
}
workingDirectory: 'artifacts/Debug'
displayName: 'Test for AutoGen Modules With Windows PowerShell 5.1'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq('${{ parameters.testTarget }}', 'Test'))

- task: PowerShell@2
displayName: Analyze Test Coverage
inputs:
Expand Down