Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions .azure-pipelines/PipelineSteps/test-steps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ $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
}
"@

Set-Location $currentPath
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
17 changes: 16 additions & 1 deletion .azure-pipelines/util/test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,26 @@ steps:
}
workingDirectory: 'artifacts/Debug'
displayName: 'Test for AutoGen Modules With PowerShell Core'
condition: and(succeeded(), eq('${{ parameters.testTarget }}', 'Test'))
condition: eq('${{ parameters.testTarget }}', 'Test')
Comment thread
YangAn-microsoft marked this conversation as resolved.
Outdated
continueOnError: true
Comment thread
YangAn-microsoft marked this conversation as resolved.
env:
PowerShellPlatform: ${{ parameters.powerShellPlatform }}

- powershell: |
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force
if ($IsWindows) { $sp = ";" } else { $sp = ":" }
Comment thread
YangAn-microsoft marked this conversation as resolved.
Outdated
$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(eq(variables['Agent.OS'], 'Windows_NT'), eq('${{ parameters.testTarget }}', 'Test'))
continueOnError: true
Comment thread
YangAn-microsoft marked this conversation as resolved.
Outdated

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