mirror of
https://github.com/actions/python-versions.git
synced 2025-04-08 08:19:41 +00:00
Merge pull request #135 from mikhailkoliada/migrate_to_pester5
Migrate build pipeline to Pester v5
This commit is contained in:
9
.github/workflows/python-builder.yml
vendored
9
.github/workflows/python-builder.yml
vendored
@ -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
|
||||||
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 }}";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$Result = Invoke-Pester -PassThru -Script $pesterParams
|
$Result = Invoke-Pester -Container $pesterContainer -PassThru
|
||||||
if ($Result.FailedCount -gt 0) {
|
if ($Result.FailedCount -gt 0) {
|
||||||
$host.SetShouldExit($Result.FailedCount)
|
$host.SetShouldExit($Result.FailedCount)
|
||||||
exit $Result.FailedCount
|
exit $Result.FailedCount
|
||||||
|
@ -9,29 +9,31 @@ 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 {
|
||||||
$searchStringStart = "Failed to build these modules:"
|
function Analyze-MissingModules([string] $buildOutputLocation) {
|
||||||
$searchStringEnd = "running build_scripts"
|
$searchStringStart = "Failed to build these modules:"
|
||||||
$pattern = "$searchStringStart(.*?)$searchStringEnd"
|
$searchStringEnd = "running build_scripts"
|
||||||
|
$pattern = "$searchStringStart(.*?)$searchStringEnd"
|
||||||
|
|
||||||
$buildContent = Get-Content -Path $buildOutputLocation
|
$buildContent = Get-Content -Path $buildOutputLocation
|
||||||
$splitBuiltOutput = $buildContent -split "\n";
|
$splitBuiltOutput = $buildContent -split "\n";
|
||||||
|
|
||||||
### Search for missing modules that are displayed between the search strings
|
### Search for missing modules that are displayed between the search strings
|
||||||
$regexMatch = [regex]::match($SplitBuiltOutput, $Pattern)
|
$regexMatch = [regex]::match($SplitBuiltOutput, $Pattern)
|
||||||
if ($regexMatch.Success)
|
if ($regexMatch.Success)
|
||||||
{
|
{
|
||||||
$module = $regexMatch.Groups[1].Value.Trim()
|
$module = $regexMatch.Groups[1].Value.Trim()
|
||||||
Write-Host "Failed missing modules:"
|
Write-Host "Failed missing modules:"
|
||||||
Write-Host $module
|
Write-Host $module
|
||||||
if ( ($module -eq "_tkinter") -and ( [semver]"$($Version.Major).$($Version.Minor)" -ge [semver]"3.10" -and $Version.PreReleaseLabel ) ) {
|
if ( ($module -eq "_tkinter") -and ( [semver]"$($Version.Major).$($Version.Minor)" -ge [semver]"3.10" -and $Version.PreReleaseLabel ) ) {
|
||||||
Write-Host "$module $Version ignored"
|
Write-Host "$module $Version ignored"
|
||||||
} else {
|
} else {
|
||||||
return 1
|
return 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "Tests" {
|
Describe "Tests" {
|
||||||
|
Reference in New Issue
Block a user