Publish test package to AppVeyor daily build (#8273)
This commit is contained in:
parent
6a388f0b7d
commit
9fda1d0e4f
28
build.psm1
28
build.psm1
|
@ -2975,6 +2975,31 @@ $script:RESX_TEMPLATE = @'
|
|||
</root>
|
||||
'@
|
||||
|
||||
function Get-UniquePackageFolderName {
|
||||
param(
|
||||
[Parameter(Mandatory)] $Root
|
||||
)
|
||||
|
||||
$packagePath = Join-Path $Root 'TestPackage'
|
||||
|
||||
$triesLeft = 10
|
||||
|
||||
while(Test-Path $packagePath) {
|
||||
$suffix = Get-Random
|
||||
|
||||
# Not using Guid to avoid maxpath problems as in example below.
|
||||
# Example: 'TestPackage-ba0ae1db-8512-46c5-8b6c-1862d33a2d63\test\powershell\Modules\Microsoft.PowerShell.Security\TestData\CatalogTestData\UserConfigProv\DSCResources\UserConfigProviderModVersion1\UserConfigProviderModVersion1.schema.mof'
|
||||
$packagePath = Join-Path $Root "TestPackage_$suffix"
|
||||
$triesLeft--
|
||||
|
||||
if ($triesLeft -le 0) {
|
||||
throw "Could find unique folder name for package path"
|
||||
}
|
||||
}
|
||||
|
||||
$packagePath
|
||||
}
|
||||
|
||||
function New-TestPackage
|
||||
{
|
||||
[CmdletBinding()]
|
||||
|
@ -2995,13 +3020,14 @@ function New-TestPackage
|
|||
|
||||
$rootFolder = $env:TEMP
|
||||
|
||||
# In some build agents, typically macOS on AzDevOps, $env:TEMP might not be set.
|
||||
if (-not $rootFolder -and $env:TF_BUILD) {
|
||||
$rootFolder = $env:AGENT_WORKFOLDER
|
||||
}
|
||||
|
||||
Write-Verbose -Verbose "RootFolder: $rootFolder"
|
||||
$packageRoot = Get-UniquePackageFolderName -Root $rootFolder
|
||||
|
||||
$packageRoot = Join-Path $rootFolder ('TestPackage-' + (new-guid))
|
||||
$null = New-Item -ItemType Directory -Path $packageRoot -Force
|
||||
$packagePath = Join-Path $Destination "TestPackage.zip"
|
||||
Write-Verbose -Verbose "PackagePath: $packagePath"
|
||||
|
|
|
@ -502,6 +502,12 @@ function Invoke-AppVeyorAfterTest
|
|||
$codeCoverageArtifacts | ForEach-Object {
|
||||
Push-Artifact -Path $_
|
||||
}
|
||||
|
||||
New-TestPackage -Destination (Get-Location).Path
|
||||
$testPackageFullName = Join-Path $pwd 'TestPackage.zip'
|
||||
Write-Verbose "Created TestPackage.zip" -Verbose
|
||||
Write-Host -ForegroundColor Green 'Upload test package'
|
||||
Push-Artifact $testPackageFullName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue