Migrate build pipeline to Pester v5

This commit is contained in:
Mikhail Koliada
2022-01-21 12:43:03 +03:00
parent a5914bfabd
commit 133a2c6b96
2 changed files with 24 additions and 25 deletions

View File

@@ -146,16 +146,13 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1 Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 5.3.1
Import-Module Pester Import-Module Pester
$pesterParams = @{ $pesterContainer = New-PesterContainer -Path './python-tests.ps1' -Data @{
Path="./python-tests.ps1";
Parameters=@{
Version="${{ env.VERSION }}"; Version="${{ env.VERSION }}";
Platform="${{ matrix.platform }}"; Platform="${{ matrix.platform }}";
} }
} Invoke-Pester -Container $pesterContainer -PassThru
$Result = Invoke-Pester -PassThru -Script $pesterParams
if ($Result.FailedCount -gt 0) { if ($Result.FailedCount -gt 0) {
$host.SetShouldExit($Result.FailedCount) $host.SetShouldExit($Result.FailedCount)
exit $Result.FailedCount exit $Result.FailedCount

View File

@@ -9,7 +9,8 @@ Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1") Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
Import-Module (Join-Path $PSScriptRoot "../builders/python-version.psm1") Import-Module (Join-Path $PSScriptRoot "../builders/python-version.psm1")
function Analyze-MissingModules([string] $buildOutputLocation) { BeforeAll {
function Analyze-MissingModules([string] $buildOutputLocation) {
$searchStringStart = "Failed to build these modules:" $searchStringStart = "Failed to build these modules:"
$searchStringEnd = "running build_scripts" $searchStringEnd = "running build_scripts"
$pattern = "$searchStringStart(.*?)$searchStringEnd" $pattern = "$searchStringStart(.*?)$searchStringEnd"
@@ -32,6 +33,7 @@ function Analyze-MissingModules([string] $buildOutputLocation) {
} }
return 0 return 0
}
} }
Describe "Tests" { Describe "Tests" {