@@ -442,111 +442,156 @@ function Invoke-CIFinish
442
442
{
443
443
param (
444
444
[string ] $Runtime = ' win7-x64' ,
445
- [string ] $Channel = ' preview'
445
+ [string ] $Channel = ' preview' ,
446
+ [Validateset (' Build' , ' Package' )]
447
+ [string []] $Stage = (' Build' , ' Package' )
446
448
)
447
449
448
- if ($PSEdition -eq ' Core' -and ($IsLinux -or $IsMacOS ))
449
- {
450
+ if ($PSEdition -eq ' Core' -and ($IsLinux -or $IsMacOS ) -and $Stage -contains ' Build' ) {
450
451
return New-LinuxPackage
451
452
}
452
453
454
+ $artifacts = New-Object System.Collections.ArrayList
453
455
try {
454
-
455
- if ($Channel -eq ' preview' )
456
- {
457
- $releaseTag = Get-ReleaseTag
458
-
459
- $previewVersion = $releaseTag.Split (' -' )
460
- $previewPrefix = $previewVersion [0 ]
461
- $previewLabel = $previewVersion [1 ].replace(' .' , ' ' )
462
-
463
- if (Test-DailyBuild )
464
- {
465
- $previewLabel = " daily{0}" -f $previewLabel
456
+ $buildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /mainBuild"
457
+
458
+ if ($Stage -contains " Build" ) {
459
+ if ($Channel -eq ' preview' ) {
460
+ $releaseTag = Get-ReleaseTag
461
+
462
+ $previewVersion = $releaseTag.Split (' -' )
463
+ $previewPrefix = $previewVersion [0 ]
464
+ $previewLabel = $previewVersion [1 ].replace(' .' , ' ' )
465
+
466
+ if (Test-DailyBuild )
467
+ {
468
+ $previewLabel = " daily{0}" -f $previewLabel
469
+ }
470
+
471
+ $prereleaseIteration = (get-date ).Day
472
+ $preReleaseVersion = " $previewPrefix -$previewLabel .$prereleaseIteration "
473
+ # Build clean before backing to remove files from testing
474
+ Start-PSBuild - CrossGen - PSModuleRestore - Configuration ' Release' - ReleaseTag $preReleaseVersion - Clean - Runtime $Runtime - output $buildFolder - PSOptionsPath " ${buildFolder} /psoptions.json"
475
+ $options = Get-PSOptions
476
+ # Remove symbol files.
477
+ $filter = Join-Path - Path (Split-Path $options.Output ) - ChildPath ' *.pdb'
478
+ Write-Verbose " Removing symbol files from $filter " - Verbose
479
+ Remove-Item $filter - Force - Recurse
480
+ }
481
+ else {
482
+ $releaseTag = Get-ReleaseTag
483
+ $releaseTagParts = $releaseTag.split (' .' )
484
+ $preReleaseVersion = $releaseTagParts [0 ]+ " .9.9"
485
+ Write-Verbose " newPSReleaseTag: $preReleaseVersion " - Verbose
486
+ Start-PSBuild - CrossGen - PSModuleRestore - Configuration ' Release' - ReleaseTag $preReleaseVersion - Clean - Runtime $Runtime - output $buildFolder - PSOptionsPath " ${buildFolder} /psoptions.json"
487
+ $options = Get-PSOptions
488
+ # Remove symbol files.
489
+ $filter = Join-Path - Path (Split-Path $options.Output ) - ChildPath ' *.pdb'
490
+ Write-Verbose " Removing symbol files from $filter " - Verbose
491
+ Remove-Item $filter - Force - Recurse
466
492
}
467
493
468
- $prereleaseIteration = (get-date ).Day
469
- $preReleaseVersion = " $previewPrefix -$previewLabel .$prereleaseIteration "
470
- # Build clean before backing to remove files from testing
471
- Start-PSBuild - CrossGen - PSModuleRestore - Configuration ' Release' - ReleaseTag $preReleaseVersion - Clean - Runtime $Runtime
472
- }
473
- else {
474
- $releaseTag = Get-ReleaseTag
475
- $releaseTagParts = $releaseTag.split (' .' )
476
- $preReleaseVersion = $releaseTagParts [0 ]+ " .9.9"
477
- Write-Verbose " newPSReleaseTag: $preReleaseVersion " - Verbose
478
- Start-PSBuild - CrossGen - PSModuleRestore - Configuration ' Release' - ReleaseTag $preReleaseVersion - Clean - Runtime $Runtime
494
+ # Set a variable, both in the current process and in AzDevOps for the packaging stage to get the release tag
495
+ $env: CI_FINISH_RELASETAG = $preReleaseVersion
496
+ $vstsCommandString = " vso[task.setvariable variable=CI_FINISH_RELASETAG]$preReleaseVersion "
497
+ Write-Verbose - Message " $vstsCommandString " - Verbose
498
+ 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
479
517
}
480
518
481
- # Build packages $preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration"
482
- $packages = Start-PSPackage - Type msi, nupkg, zip, zip- pdb - ReleaseTag $preReleaseVersion - SkipReleaseChecks - WindowsRuntime $Runtime
483
-
484
- $artifacts = New-Object System.Collections.ArrayList
485
- foreach ($package in $packages ) {
486
- if (Test-Path $package - ErrorAction Ignore)
487
- {
488
- Write-Log " Package found: $package "
489
- }
490
- else
491
- {
492
- Write-Warning - Message " Package NOT found: $package "
493
- }
494
519
495
- if ($package -is [string ])
496
- {
497
- $null = $artifacts.Add ($package )
520
+ if ($Stage -contains " Package" ) {
521
+ Restore-PSOptions - PSOptionsPath " ${buildFolder} -meta/psoptions.json"
522
+ $preReleaseVersion = $env: CI_FINISH_RELASETAG
523
+
524
+ # Build packages $preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration"
525
+ $packages = Start-PSPackage - Type msi, nupkg, zip, zip- pdb - ReleaseTag $preReleaseVersion - SkipReleaseChecks - WindowsRuntime $Runtime
526
+
527
+ foreach ($package in $packages ) {
528
+ if (Test-Path $package - ErrorAction Ignore)
529
+ {
530
+ Write-Log " Package found: $package "
531
+ }
532
+ else
533
+ {
534
+ Write-Warning - Message " Package NOT found: $package "
535
+ }
536
+
537
+ if ($package -is [string ])
538
+ {
539
+ $null = $artifacts.Add ($package )
540
+ }
541
+ elseif ($package -is [pscustomobject ] -and $package.psobject.Properties [' msi' ])
542
+ {
543
+ $null = $artifacts.Add ($package.msi )
544
+ $null = $artifacts.Add ($package.wixpdb )
545
+ }
498
546
}
499
- elseif ($package -is [pscustomobject ] -and $package.psobject.Properties [' msi' ])
500
- {
501
- $null = $artifacts.Add ($package.msi )
502
- $null = $artifacts.Add ($package.wixpdb )
503
- }
504
- }
505
547
506
- # the packaging tests find the MSI package using env:PSMsiX64Path
507
- $env: PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith (" .msi" )}
508
- $architechture = $Runtime.Split (' -' )[1 ]
509
- $exePath = New-ExePackage - ProductVersion ($preReleaseVersion -replace ' ^v' ) - ProductTargetArchitecture $architechture - MsiLocationPath $env: PSMsiX64Path
510
- Write-Verbose " exe Path: $exePath " - Verbose
511
- $artifacts.Add ($exePath )
512
- $env: PSExePath = $exePath
513
- $env: PSMsiChannel = $Channel
514
- $env: PSMsiRuntime = $Runtime
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
515
557
516
- # Install the latest Pester and import it
517
- $maximumPesterVersion = ' 4.99'
518
- Install-Module Pester - Force - SkipPublisherCheck - MaximumVersion $maximumPesterVersion
519
- Import-Module Pester - Force - MaximumVersion $maximumPesterVersion
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
520
562
521
- $testResultPath = Join-Path - Path $env: TEMP - ChildPath " win-package-$channel -$runtime .xml"
563
+ $testResultPath = Join-Path - Path $env: TEMP - ChildPath " win-package-$channel -$runtime .xml"
522
564
523
- # start the packaging tests and get the results
524
- $packagingTestResult = Invoke-Pester - Script (Join-Path $repoRoot ' .\test\packaging\windows\' ) - PassThru - OutputFormat NUnitXml - OutputFile $testResultPath
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
525
567
526
- Publish-TestResults - Title " win-package-$channel -$runtime " - Path $testResultPath
568
+ Publish-TestResults - Title " win-package-$channel -$runtime " - Path $testResultPath
527
569
528
- # fail the CI job if the tests failed, or nothing passed
529
- if (-not $packagingTestResult -is [pscustomobject ] -or $packagingTestResult.FailedCount -ne 0 -or $packagingTestResult.PassedCount -eq 0 )
530
- {
531
- throw " Packaging tests failed ($ ( $packagingTestResult.FailedCount ) failed/$ ( $packagingTestResult.PassedCount ) passed)"
532
- }
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)"
574
+ }
533
575
534
- # only publish assembly nuget packages if it is a daily build and tests passed
535
- if (Test-DailyBuild )
536
- {
537
- $nugetArtifacts = Get-ChildItem $PSScriptRoot \packaging\nugetOutput - ErrorAction SilentlyContinue - Filter * .nupkg | Select-Object - ExpandProperty FullName
538
- if ($nugetArtifacts )
576
+ # only publish assembly nuget packages if it is a daily build and tests passed
577
+ if (Test-DailyBuild )
539
578
{
540
- $artifacts.AddRange (@ ($nugetArtifacts ))
579
+ $nugetArtifacts = Get-ChildItem $PSScriptRoot \packaging\nugetOutput - ErrorAction SilentlyContinue - Filter * .nupkg | Select-Object - ExpandProperty FullName
580
+ if ($nugetArtifacts )
581
+ {
582
+ $artifacts.AddRange (@ ($nugetArtifacts ))
583
+ }
541
584
}
542
585
}
543
586
544
587
# produce win-arm and win-arm64 packages if it is a daily build
545
- Start-PSBuild - Restore - Runtime win- arm - PSModuleRestore - Configuration ' Release' - ReleaseTag $releaseTag
588
+ $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm32"
589
+ Restore-PSOptions - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json"
546
590
$arm32Package = Start-PSPackage - Type zip - WindowsRuntime win- arm - ReleaseTag $releaseTag - SkipReleaseChecks
547
591
$artifacts.Add ($arm32Package )
548
592
549
- Start-PSBuild - Restore - Runtime win- arm64 - PSModuleRestore - Configuration ' Release' - ReleaseTag $releaseTag
593
+ $armBuildFolder = " ${env: SYSTEM_ARTIFACTSDIRECTORY} /releaseArm64"
594
+ Restore-PSOptions - PSOptionsPath " ${armBuildFolder} -meta/psoptions.json"
550
595
$arm64Package = Start-PSPackage - Type zip - WindowsRuntime win- arm64 - ReleaseTag $releaseTag - SkipReleaseChecks
551
596
$artifacts.Add ($arm64Package )
552
597
}
0 commit comments