@@ -463,9 +463,8 @@ function Invoke-CIFinish
463463 $previewPrefix = $previewVersion [0 ]
464464 $previewLabel = $previewVersion [1 ].replace(' .' , ' ' )
465465
466- if (Test-DailyBuild )
467- {
468- $previewLabel = " daily{0}" -f $previewLabel
466+ if (Test-DailyBuild ) {
467+ $previewLabel = " daily{0}" -f $previewLabel
469468 }
470469
471470 $prereleaseIteration = (get-date ).Day
@@ -477,8 +476,7 @@ function Invoke-CIFinish
477476 $filter = Join-Path - Path (Split-Path $options.Output ) - ChildPath ' *.pdb'
478477 Write-Verbose " Removing symbol files from $filter " - Verbose
479478 Remove-Item $filter - Force - Recurse
480- }
481- else {
479+ } else {
482480 $releaseTag = Get-ReleaseTag
483481 $releaseTagParts = $releaseTag.split (' .' )
484482 $preReleaseVersion = $releaseTagParts [0 ]+ " .9.9"
@@ -496,106 +494,81 @@ function Invoke-CIFinish
496494 $vstsCommandString = " vso[task.setvariable variable=CI_FINISH_RELASETAG]$preReleaseVersion "
497495 Write-Verbose - Message " $vstsCommandString " - Verbose
498496 Write-Host - Object " ##$vstsCommandString "
499-
500- $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm32"
501-
502- # produce win-arm and win-arm64 packages if it is a daily build
503- Start-PSBuild - Restore - Runtime win- arm - PSModuleRestore - Configuration ' Release' - ReleaseTag $releaseTag - output $armBuildFolder - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json" - Crossgen
504- $options = Get-PSOptions
505- # Remove symbol files.
506- $filter = Join-Path - Path (Split-Path $options.Output ) - ChildPath ' *.pdb'
507- Write-Verbose " Removing symbol files from $filter " - Verbose
508- Remove-Item $filter - Force - Recurse
509-
510- $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm64"
511- Start-PSBuild - Restore - Runtime win- arm64 - PSModuleRestore - Configuration ' Release' - ReleaseTag $releaseTag - output $armBuildFolder - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json" - Crossgen
512- $options = Get-PSOptions
513- # Remove symbol files.
514- $filter = Join-Path - Path (Split-Path $options.Output ) - ChildPath ' *.pdb'
515- Write-Verbose " Removing symbol files from $filter " - Verbose
516- Remove-Item $filter - Force - Recurse
517497 }
518498
519-
520499 if ($Stage -contains " Package" ) {
521- Restore-PSOptions - PSOptionsPath " ${buildFolder} -meta /psoptions.json"
500+ Restore-PSOptions - PSOptionsPath " ${buildFolder} /psoptions.json"
522501 $preReleaseVersion = $env: CI_FINISH_RELASETAG
523502
524503 # Build packages $preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration"
525- $packages = Start-PSPackage - Type msi, nupkg, zip, zip- pdb - ReleaseTag $preReleaseVersion - SkipReleaseChecks - WindowsRuntime $Runtime
504+ switch - regex ($Runtime ){
505+ default {
506+ $runPackageTest = $true
507+ $packageTypes = ' msi' , ' nupkg' , ' zip' , ' zip-pdb' , ' msix'
508+ }
509+ ' win-arm.*' {
510+ $runPackageTest = $false
511+ $packageTypes = ' zip' , ' zip-pdb' , ' msix'
512+ }
513+ }
514+ $packages = Start-PSPackage - Type $packageTypes - ReleaseTag $preReleaseVersion - SkipReleaseChecks - WindowsRuntime $Runtime
526515
527516 foreach ($package in $packages ) {
528- if (Test-Path $package - ErrorAction Ignore)
529- {
517+ if (Test-Path $package - ErrorAction Ignore) {
530518 Write-Log " Package found: $package "
531- }
532- else
533- {
519+ } else {
534520 Write-Warning - Message " Package NOT found: $package "
535521 }
536522
537- if ($package -is [string ])
538- {
523+ if ($package -is [string ]) {
539524 $null = $artifacts.Add ($package )
540- }
541- elseif ($package -is [pscustomobject ] -and $package.psobject.Properties [' msi' ])
542- {
525+ } elseif ($package -is [pscustomobject ] -and $package.psobject.Properties [' msi' ]) {
543526 $null = $artifacts.Add ($package.msi )
544527 $null = $artifacts.Add ($package.wixpdb )
545528 }
546529 }
547530
548- # the packaging tests find the MSI package using env:PSMsiX64Path
549- $env: PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith (" .msi" )}
550- $architechture = $Runtime.Split (' -' )[1 ]
551- $exePath = New-ExePackage - ProductVersion ($preReleaseVersion -replace ' ^v' ) - ProductTargetArchitecture $architechture - MsiLocationPath $env: PSMsiX64Path
552- Write-Verbose " exe Path: $exePath " - Verbose
553- $artifacts.Add ($exePath )
554- $env: PSExePath = $exePath
555- $env: PSMsiChannel = $Channel
556- $env: PSMsiRuntime = $Runtime
531+ if ($runPackageTest ) {
532+ # the packaging tests find the MSI package using env:PSMsiX64Path
533+ $env: PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith (" .msi" )}
534+ $architechture = $Runtime.Split (' -' )[1 ]
535+ $exePath = New-ExePackage - ProductVersion ($preReleaseVersion -replace ' ^v' ) - ProductTargetArchitecture $architechture - MsiLocationPath $env: PSMsiX64Path
536+ Write-Verbose " exe Path: $exePath " - Verbose
537+ $artifacts.Add ($exePath )
538+ $env: PSExePath = $exePath
539+ $env: PSMsiChannel = $Channel
540+ $env: PSMsiRuntime = $Runtime
557541
558- # Install the latest Pester and import it
559- $maximumPesterVersion = ' 4.99'
560- Install-Module Pester - Force - SkipPublisherCheck - MaximumVersion $maximumPesterVersion
561- Import-Module Pester - Force - MaximumVersion $maximumPesterVersion
542+ # Install the latest Pester and import it
543+ $maximumPesterVersion = ' 4.99'
544+ Install-Module Pester - Force - SkipPublisherCheck - MaximumVersion $maximumPesterVersion
545+ Import-Module Pester - Force - MaximumVersion $maximumPesterVersion
562546
563- $testResultPath = Join-Path - Path $env: TEMP - ChildPath " win-package-$channel -$runtime .xml"
547+ $testResultPath = Join-Path - Path $env: TEMP - ChildPath " win-package-$channel -$runtime .xml"
564548
565- # start the packaging tests and get the results
566- $packagingTestResult = Invoke-Pester - Script (Join-Path $repoRoot ' .\test\packaging\windows\' ) - PassThru - OutputFormat NUnitXml - OutputFile $testResultPath
549+ # start the packaging tests and get the results
550+ $packagingTestResult = Invoke-Pester - Script (Join-Path $repoRoot ' .\test\packaging\windows\' ) - PassThru - OutputFormat NUnitXml - OutputFile $testResultPath
567551
568- Publish-TestResults - Title " win-package-$channel -$runtime " - Path $testResultPath
552+ Publish-TestResults - Title " win-package-$channel -$runtime " - Path $testResultPath
569553
570- # fail the CI job if the tests failed, or nothing passed
571- if (-not $packagingTestResult -is [pscustomobject ] -or $packagingTestResult.FailedCount -ne 0 -or $packagingTestResult.PassedCount -eq 0 )
572- {
573- throw " Packaging tests failed ( $ ( $packagingTestResult .FailedCount ) failed/ $ ( $packagingTestResult .PassedCount ) passed) "
554+ # fail the CI job if the tests failed, or nothing passed
555+ if (-not $packagingTestResult -is [pscustomobject ] -or $packagingTestResult.FailedCount -ne 0 -or $packagingTestResult.PassedCount -eq 0 ) {
556+ throw " Packaging tests failed ( $ ( $packagingTestResult .FailedCount ) failed/ $ ( $packagingTestResult .PassedCount ) passed) "
557+ }
574558 }
575559
576560 # only publish assembly nuget packages if it is a daily build and tests passed
577- if (Test-DailyBuild )
578- {
561+ if (Test-DailyBuild ) {
579562 $nugetArtifacts = Get-ChildItem $PSScriptRoot \packaging\nugetOutput - ErrorAction SilentlyContinue - Filter * .nupkg | Select-Object - ExpandProperty FullName
580- if ($nugetArtifacts )
581- {
563+ if ($nugetArtifacts ) {
582564 $artifacts.AddRange (@ ($nugetArtifacts ))
583565 }
584566 }
585567 }
586-
587- # produce win-arm and win-arm64 packages if it is a daily build
588- $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm32"
589- Restore-PSOptions - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json"
590- $arm32Package = Start-PSPackage - Type zip - WindowsRuntime win- arm - ReleaseTag $releaseTag - SkipReleaseChecks
591- $artifacts.Add ($arm32Package )
592-
593- $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm64"
594- Restore-PSOptions - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json"
595- $arm64Package = Start-PSPackage - Type zip - WindowsRuntime win- arm64 - ReleaseTag $releaseTag - SkipReleaseChecks
596- $artifacts.Add ($arm64Package )
597- }
598- finally {
568+ } catch {
569+ Get-Error - InputObject $_
570+ throw
571+ } finally {
599572 $pushedAllArtifacts = $true
600573
601574 $artifacts | ForEach-Object {
@@ -612,12 +585,6 @@ function Invoke-CIFinish
612585 throw " Some artifacts did not exist!"
613586 }
614587 }
615- catch
616- {
617- Write-Host - Foreground Red $_
618- Write-Host - Foreground Red $_.ScriptStackTrace
619- throw $_
620- }
621588}
622589
623590# Bootstrap script for Linux and macOS
0 commit comments