mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
Add test results upload (#630)
This commit is contained in:
parent
d9738a3f13
commit
13a249a7ee
10
.azdo/ci.yml
10
.azdo/ci.yml
@ -123,5 +123,13 @@ stages:
|
|||||||
- pwsh: |
|
- pwsh: |
|
||||||
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
|
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
|
||||||
Invoke-OpenSSHTests -OpenSSHBinPath "$env:SystemDrive/OpenSSH"
|
Invoke-OpenSSHTests -OpenSSHBinPath "$env:SystemDrive/OpenSSH"
|
||||||
Publish-OpenSSHTestResults # TODO: #
|
# Copy test results to results directory
|
||||||
|
$ResultsDirectory = "$(Build.SourcesDirectory)/Win32OpenSSHTestResults"
|
||||||
|
Copy-OpenSSHTestResults -ResultsPath $ResultsDirectory
|
||||||
|
# Upload test results artifact
|
||||||
|
if (Test-Path -Path $ResultsDirectory)
|
||||||
|
{
|
||||||
|
$artifactName = 'Win32-OpenSSH-TestResults'
|
||||||
|
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$ResultsDirectory"
|
||||||
|
}
|
||||||
displayName: Run tests and publish results
|
displayName: Run tests and publish results
|
||||||
|
@ -32,6 +32,6 @@ FunctionsToExport = @(
|
|||||||
'Invoke-AzDOBuild',
|
'Invoke-AzDOBuild',
|
||||||
'Install-OpenSSH',
|
'Install-OpenSSH',
|
||||||
'Invoke-OpenSSHTests',
|
'Invoke-OpenSSHTests',
|
||||||
'Publish-OpenSSHTestResults')
|
'Copy-OpenSSHTestResults')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -404,33 +404,50 @@ function Invoke-OpenSSHTests
|
|||||||
|
|
||||||
<#
|
<#
|
||||||
.Synopsis
|
.Synopsis
|
||||||
upload OpenSSH pester test results.
|
Collect OpenSSH pester test results into one directory
|
||||||
#>
|
#>
|
||||||
function Publish-OpenSSHTestResults
|
function Copy-OpenSSHTestResults
|
||||||
{
|
{
|
||||||
if ($env:APPVEYOR_JOB_ID)
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string] $ResultsPath
|
||||||
|
)
|
||||||
|
|
||||||
|
if (Test-Path -Path $ResultsPath)
|
||||||
|
{
|
||||||
|
Remove-Item -Path $ResultsPath -Force -Recurse -ErrorAction Ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Verbose -Verbose "Creating test results directory for artifacts upload: $ResultsPath"
|
||||||
|
$null = New-Item -Path $ResultsPath -ItemType Directory -Force
|
||||||
|
|
||||||
|
if (Test-Path -Path $ResultsPath)
|
||||||
{
|
{
|
||||||
$setupresultFile = Resolve-Path $Global:OpenSSHTestInfo["SetupTestResultsFile"] -ErrorAction Ignore
|
$setupresultFile = Resolve-Path $Global:OpenSSHTestInfo["SetupTestResultsFile"] -ErrorAction Ignore
|
||||||
if( (Test-Path $Global:OpenSSHTestInfo["SetupTestResultsFile"]) -and $setupresultFile)
|
if ($setupresultFile)
|
||||||
{
|
{
|
||||||
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $setupresultFile)
|
Write-Verbose -Verbose "Copying set-up test results file, $setupresultFile, to results directory"
|
||||||
Write-BuildMessage -Message "Setup test results uploaded!" -Category Information
|
Copy-Item -Path $setupresultFile -Destination $ResultsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
$E2EresultFile = Resolve-Path $Global:OpenSSHTestInfo["E2ETestResultsFile"] -ErrorAction Ignore
|
$E2EresultFile = Resolve-Path $Global:OpenSSHTestInfo["E2ETestResultsFile"] -ErrorAction Ignore
|
||||||
if( (Test-Path $Global:OpenSSHTestInfo["E2ETestResultsFile"]) -and $E2EresultFile)
|
if ($E2EresultFile)
|
||||||
{
|
{
|
||||||
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $E2EresultFile)
|
Write-Verbose -Verbose "Copying end-to-end test results file, $E2EresultFile, to results directory"
|
||||||
Write-BuildMessage -Message "E2E test results uploaded!" -Category Information
|
Copy-Item -Path $E2EresultFile -Destination $ResultsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
$uninstallResultFile = Resolve-Path $Global:OpenSSHTestInfo["UninstallTestResultsFile"] -ErrorAction Ignore
|
$uninstallResultFile = Resolve-Path $Global:OpenSSHTestInfo["UninstallTestResultsFile"] -ErrorAction Ignore
|
||||||
if( (Test-Path $Global:OpenSSHTestInfo["UninstallTestResultsFile"]) -and $uninstallResultFile)
|
if ($uninstallResultFile)
|
||||||
{
|
{
|
||||||
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $uninstallResultFile)
|
Write-Verbose -Verbose "Copying uninstall test results file, $uninstallResultFile, to results directory"
|
||||||
Write-BuildMessage -Message "Uninstall test results uploaded!" -Category Information
|
Copy-Item -Path $uninstallResultFile -Destination $ResultsPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Verbose -Verbose "Unable to write test results path for test artifacts upload: $ResultsPath"
|
||||||
|
}
|
||||||
|
|
||||||
if ($env:DebugMode)
|
if ($env:DebugMode)
|
||||||
{
|
{
|
||||||
@ -439,11 +456,11 @@ function Publish-OpenSSHTestResults
|
|||||||
|
|
||||||
if($env:TestPassed -ieq 'True')
|
if($env:TestPassed -ieq 'True')
|
||||||
{
|
{
|
||||||
Write-BuildMessage -Message "The checkin validation success!" -Category Information
|
Write-BuildMessage -Message "The checkin validation tests succeeded!" -Category Information
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-BuildMessage -Message "The checkin validation failed!" -Category Error
|
Write-BuildMessage -Message "The checkin validation tests failed!" -Category Error
|
||||||
throw "The checkin validation failed!"
|
throw "The checkin validation tests failed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user