From fcc9069b4f05d4ac926ac07d3e7e538fd33c7f5f Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:13:52 -0700 Subject: [PATCH 01/25] move win packaging template and add runtime param --- .vsts-ci/{ => windows}/templates/windows-packaging.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename .vsts-ci/{ => windows}/templates/windows-packaging.yml (90%) diff --git a/.vsts-ci/templates/windows-packaging.yml b/.vsts-ci/windows/templates/windows-packaging.yml similarity index 90% rename from .vsts-ci/templates/windows-packaging.yml rename to .vsts-ci/windows/templates/windows-packaging.yml index 2c691809885..130e0266e26 100644 --- a/.vsts-ci/templates/windows-packaging.yml +++ b/.vsts-ci/windows/templates/windows-packaging.yml @@ -1,6 +1,7 @@ parameters: pool: 'Hosted VS2017' jobName: 'win_packaging' + runtimeId: 'win7-x64' parentJobs: [] jobs: @@ -10,7 +11,7 @@ jobs: pool: name: ${{ parameters.pool }} - displayName: Windows Packaging + displayName: Windows Packaging - ${{ parameters.runtimeId }} steps: - powershell: | From 3cf45ef58770904deea9676157ffbebb3d87572d Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:14:18 -0700 Subject: [PATCH 02/25] add win packaging CI --- .vsts-ci/windows/windows-packaging.yml | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .vsts-ci/windows/windows-packaging.yml diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml new file mode 100644 index 00000000000..30a5116cae0 --- /dev/null +++ b/.vsts-ci/windows/windows-packaging.yml @@ -0,0 +1,79 @@ +name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr) +trigger: + # Batch merge builds together while a merge build is running + batch: true + branches: + include: + - master + - release* + - feature* + paths: + include: + - /.vsts-ci/templates/windows-packaging.yml + - /.vsts-ci/windows-packaging.yml + - /global.json + - /src/Microsoft.Management.Infrastructure.CimCmdlets/Microsoft.Management.Infrastructure.CimCmdlets.csproj + - /src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj + - /src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj + - /src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj + - /src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj + - /src/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj + - /src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj + - /src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj + - /src/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.csproj + - /src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj + - /src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj + - /src/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.csproj + - /src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj + - /src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj + - /src/Modules/PSGalleryModules.csproj + - /src/powershell-win-core/powershell-win-core.csproj + - /tools/ci.psm1 + - /tools/packaging/* +pr: + branches: + include: + - master + - release* + - feature* + paths: + include: + - /.vsts-ci/templates/windows-packaging.yml + - /.vsts-ci/windows-packaging.yml + - /global.json + - /src/Microsoft.Management.Infrastructure.CimCmdlets/Microsoft.Management.Infrastructure.CimCmdlets.csproj + - /src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj + - /src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj + - /src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj + - /src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj + - /src/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj + - /src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj + - /src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj + - /src/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.csproj + - /src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj + - /src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj + - /src/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.csproj + - /src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj + - /src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj + - /src/Modules/PSGalleryModules.csproj + - /src/powershell-win-core/powershell-win-core.csproj + - /tools/ci.psm1 + - /tools/packaging/* + +variables: + GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + # Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + __SuppressAnsiEscapeSequences: 1 + +resources: +- repo: self + clean: true +- stage: PackagingWin + displayName: Packaging for Windows + dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it + jobs: + # Unlike daily builds, we do not upload nuget package to MyGet so we do not wait on tests to finish. + - template: templates/windows-packaging.yml From f87793a63c608cbdd502e406c37a87a8045b7694 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:14:41 -0700 Subject: [PATCH 03/25] Add runtime param to CI function --- tools/ci.psm1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 2042349445f..286e7fa47c9 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -437,6 +437,9 @@ function Get-ReleaseTag # Implements CI 'on_finish' step function Invoke-CIFinish { + param( + [string] $Runtime = 'win7-x64' + ) if($PSEdition -eq 'Core' -and ($IsLinux -or $IsMacOS)) { return New-LinuxPackage @@ -457,10 +460,10 @@ function Invoke-CIFinish $preReleaseVersion = "$previewPrefix-$previewLabel.$env:BUILD_BUILDID" # Build clean before backing to remove files from testing - Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean + Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime # Build packages - $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks + $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -Runtime $Runtime $artifacts = New-Object System.Collections.ArrayList foreach ($package in $packages) { From 43956232ce4c03ed7941b03dca281ab6a477831b Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:15:14 -0700 Subject: [PATCH 04/25] remove packaging stage from main CI --- .vsts-ci/windows.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.vsts-ci/windows.yml b/.vsts-ci/windows.yml index 6554e3f38e5..bdaa015832e 100644 --- a/.vsts-ci/windows.yml +++ b/.vsts-ci/windows.yml @@ -73,11 +73,3 @@ stages: tagSet: Others - template: templates/verify-xunit.yml - -- stage: PackagingWin - displayName: Packaging for Windows - dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it - jobs: - # Unlike daily builds, we do not upload nuget package to MyGet so we do not wait on tests to finish. - - template: templates/windows-packaging.yml - From 475ceb17073ab0678fa2ee74227d491164bd340b Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:15:59 -0700 Subject: [PATCH 05/25] don't trigger linux or mac when making windows only yaml changes --- .vsts-ci/linux.yml | 2 ++ .vsts-ci/mac.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 04451cba405..be7de6d8fc5 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -30,6 +30,8 @@ pr: - .vsts-ci/misc-analysis.yml - .github/ISSUE_TEMPLATE/* - .dependabot/config.yml + - .vsts-ci/windows.yml + - .vsts-ci/windows/* variables: DOTNET_CLI_TELEMETRY_OPTOUT: 1 diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index 55666e05d03..55d29959336 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -31,6 +31,8 @@ pr: - .dependabot/config.yml - tools/releaseBuild/* - tools/releaseBuild/azureDevOps/templates/* + - /.vsts-ci/windows.yml + - /.vsts-ci/windows/* variables: DOTNET_CLI_TELEMETRY_OPTOUT: 1 From bc575748dcc3d12075590395091ab4c168f3609c Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:21:37 -0700 Subject: [PATCH 06/25] finish CI yaml --- .vsts-ci/windows/windows-packaging.yml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index 30a5116cae0..dfd59f48b21 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -12,24 +12,11 @@ trigger: - /.vsts-ci/templates/windows-packaging.yml - /.vsts-ci/windows-packaging.yml - /global.json - - /src/Microsoft.Management.Infrastructure.CimCmdlets/Microsoft.Management.Infrastructure.CimCmdlets.csproj - - /src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj - - /src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj - - /src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj - - /src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj - - /src/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj - - /src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj - - /src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj - - /src/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.csproj - - /src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj - - /src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj - - /src/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.csproj - - /src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj - - /src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj - - /src/Modules/PSGalleryModules.csproj - - /src/powershell-win-core/powershell-win-core.csproj + - /src/* - /tools/ci.psm1 - /tools/packaging/* + - /assets/* + pr: branches: include: @@ -37,6 +24,8 @@ pr: - release* - feature* paths: + # file extension filters are not supported when this was written. + # This really should be /src/**/*.csproj include: - /.vsts-ci/templates/windows-packaging.yml - /.vsts-ci/windows-packaging.yml @@ -59,6 +48,8 @@ pr: - /src/powershell-win-core/powershell-win-core.csproj - /tools/ci.psm1 - /tools/packaging/* + - /assets/files.wxs + - /assets/Product.wxs variables: GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" From f5caf8218895a021d70329499b67f7d9973b3981 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:26:47 -0700 Subject: [PATCH 07/25] fix syntax --- .vsts-ci/windows/windows-packaging.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index dfd59f48b21..2f19f45c0e2 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -62,6 +62,7 @@ variables: resources: - repo: self clean: true +stages: - stage: PackagingWin displayName: Packaging for Windows dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it From 6c608da6b3c4150091f404c4ec106fe93d249f56 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 11:45:30 -0700 Subject: [PATCH 08/25] fix variables --- .vsts-ci/windows/windows-packaging.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index 2f19f45c0e2..fcb8acbbc01 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -52,12 +52,18 @@ pr: - /assets/Product.wxs variables: - GIT_CONFIG_PARAMETERS: "'core.autocrlf=false'" - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - POWERSHELL_TELEMETRY_OPTOUT: 1 + - name: GIT_CONFIG_PARAMETERS + value: "'core.autocrlf=false'" + - name: DOTNET_CLI_TELEMETRY_OPTOUT + value: 1 + - name: POWERSHELL_TELEMETRY_OPTOUT + value: 1 # Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - __SuppressAnsiEscapeSequences: 1 + - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE + value: 1 + - name: __SuppressAnsiEscapeSequences + value: 1 + - group: fakeNugetKey resources: - repo: self From 615bc334fc0bde05a0b03cc9ccf7a8103909b684 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 12:16:54 -0700 Subject: [PATCH 09/25] fix param name --- tools/ci.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 286e7fa47c9..3ce1afbc934 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -463,7 +463,7 @@ function Invoke-CIFinish Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime # Build packages - $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -Runtime $Runtime + $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -WindowsRuntime $Runtime $artifacts = New-Object System.Collections.ArrayList foreach ($package in $packages) { From 39e71fcd5ad2f6b41f701388e5e0b7091a385cf2 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 15:37:32 -0700 Subject: [PATCH 10/25] add channel --- .../windows/templates/windows-packaging.yml | 9 +++-- .vsts-ci/windows/windows-packaging.yml | 3 ++ tools/ci.psm1 | 37 +++++++++++++------ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.vsts-ci/windows/templates/windows-packaging.yml b/.vsts-ci/windows/templates/windows-packaging.yml index 130e0266e26..c3c6bfcfe3e 100644 --- a/.vsts-ci/windows/templates/windows-packaging.yml +++ b/.vsts-ci/windows/templates/windows-packaging.yml @@ -1,17 +1,18 @@ parameters: pool: 'Hosted VS2017' jobName: 'win_packaging' - runtimeId: 'win7-x64' + architecture: 'x64' + channel: 'preview' parentJobs: [] jobs: -- job: ${{ parameters.jobName }} +- job: ${{ parameters.jobName }}_${{ parameters.channel }}_${{ parameters.architecture }} dependsOn: ${{ parameters.parentJobs }} pool: name: ${{ parameters.pool }} - displayName: Windows Packaging - ${{ parameters.runtimeId }} + displayName: Windows Packaging - ${{ parameters.architecture }} - ${{ parameters.channel }} steps: - powershell: | @@ -31,5 +32,5 @@ jobs: - pwsh: | Import-Module .\tools\ci.psm1 New-CodeCoverageAndTestPackage - Invoke-CIFinish + Invoke-CIFinish -Runtime win7-${{ parameters.architecture }} -channel ${{ parameters.channel }} displayName: Build and Test Package diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index fcb8acbbc01..1f1da95c824 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -75,3 +75,6 @@ stages: jobs: # Unlike daily builds, we do not upload nuget package to MyGet so we do not wait on tests to finish. - template: templates/windows-packaging.yml + - template: templates/windows-packaging.yml + parameters: + channel: stable diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 3ce1afbc934..f1a61920768 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -438,29 +438,42 @@ function Get-ReleaseTag function Invoke-CIFinish { param( - [string] $Runtime = 'win7-x64' + [string] $Runtime = 'win7-x64', + [string] $Channel = 'preview' ) + if($PSEdition -eq 'Core' -and ($IsLinux -or $IsMacOS)) { return New-LinuxPackage } try { - $releaseTag = Get-ReleaseTag - - $previewVersion = $releaseTag.Split('-') - $previewPrefix = $previewVersion[0] - $previewLabel = $previewVersion[1].replace('.','') - if(Test-DailyBuild) + if($Channel -eq 'preview') { - $previewLabel= "daily{0}" -f $previewLabel - } + $releaseTag = Get-ReleaseTag + + $previewVersion = $releaseTag.Split('-') + $previewPrefix = $previewVersion[0] + $previewLabel = $previewVersion[1].replace('.','') - $preReleaseVersion = "$previewPrefix-$previewLabel.$env:BUILD_BUILDID" + if(Test-DailyBuild) + { + $previewLabel= "daily{0}" -f $previewLabel + } + + $preReleaseVersion = "$previewPrefix-$previewLabel.$env:BUILD_BUILDID" + # Build clean before backing to remove files from testing + Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime + } + else { + $releaseTag = Get-ReleaseTag + $releaseTagParts = $releaseTag.split('.') + $newPSReleaseTag = $releaseTagParts[0]+ ".9.9" + Write-Verbose "newPSReleaseTag: $newPSReleaseTag" -Verbose + Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $newPSReleaseTag -Clean -Runtime $Runtime + } - # Build clean before backing to remove files from testing - Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime # Build packages $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -WindowsRuntime $Runtime From f60bb0b60f3e4647963c5f57d6b310fd02ecb0fc Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 15:48:01 -0700 Subject: [PATCH 11/25] remove duplicate build command --- tools/ci.psm1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index f1a61920768..d227509d6c1 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -474,10 +474,6 @@ function Invoke-CIFinish Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $newPSReleaseTag -Clean -Runtime $Runtime } - - # Build packages - $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -WindowsRuntime $Runtime - $artifacts = New-Object System.Collections.ArrayList foreach ($package in $packages) { if (Test-Path $package -ErrorAction Ignore) From 46d0dd242cfd5b072d1ae8683ab527cc387dbdc4 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 16:15:53 -0700 Subject: [PATCH 12/25] actually build --- tools/ci.psm1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index d227509d6c1..7911b0f33e6 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -469,11 +469,14 @@ function Invoke-CIFinish else { $releaseTag = Get-ReleaseTag $releaseTagParts = $releaseTag.split('.') - $newPSReleaseTag = $releaseTagParts[0]+ ".9.9" - Write-Verbose "newPSReleaseTag: $newPSReleaseTag" -Verbose - Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $newPSReleaseTag -Clean -Runtime $Runtime + $preReleaseVersion = $releaseTagParts[0]+ ".9.9" + Write-Verbose "newPSReleaseTag: $preReleaseVersion" -Verbose + Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime } + # Build packages $preReleaseVersion = "$previewPrefix-$previewLabel.$env:BUILD_BUILDID" + $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks + $artifacts = New-Object System.Collections.ArrayList foreach ($package in $packages) { if (Test-Path $package -ErrorAction Ignore) From 664189d7e98050357424f1f79662915c8f083533 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 10 Jul 2020 17:10:28 -0700 Subject: [PATCH 13/25] update tests --- test/packaging/windows/msi.tests.ps1 | 24 +++++++++++++++++------- tools/ci.psm1 | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index d9541b74f06..8874f9f4465 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -53,6 +53,7 @@ Describe -Name "Windows MSI" -Fixture { } $msiX64Path = $env:PsMsiX64Path + $channel = $env:PSMsiChannel # Get any existing powershell in the path $beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | @@ -82,12 +83,16 @@ Describe -Name "Windows MSI" -Fixture { Context "Upgrade code" { BeforeAll { - $previewUpgladeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' + if ($channel -eq 'preview') { + $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' + } else { + $msiUpgradeCode = '31ab5147-9a97-4452-8443-d9709f0516e1' + } } - It "Preview MSI should not be installed before test" -Skip:(!(Test-Elevated)) { - $result = @(Get-CimInstance -Query "SELECT Value FROM Win32_Property WHERE Property='UpgradeCode' and Value = '{$previewUpgladeCode}'") - $result.Count | Should -Be 0 -Because 'Query should return nothing if preview x64 is not installed' + It "$Channel MSI should not be installed before test" -Skip:(!(Test-Elevated)) { + $result = @(Get-CimInstance -Query "SELECT Value FROM Win32_Property WHERE Property='UpgradeCode' and Value = '{$msiUpgradeCode}'") + $result.Count | Should -Be 0 -Because "Query should return nothing if $channel x64 is not installed" } It "MSI should install without error" -Skip:(!(Test-Elevated)) { @@ -97,8 +102,8 @@ Describe -Name "Windows MSI" -Fixture { } It "Upgrade code should be correct" -Skip:(!(Test-Elevated)) { - $result = @(Get-CimInstance -Query "SELECT Value FROM Win32_Property WHERE Property='UpgradeCode' and Value = '{$previewUpgladeCode}'") - $result.Count | Should -Be 1 -Because 'Query should return 1 result if Upgrade code is for x64 preview' + $result = @(Get-CimInstance -Query "SELECT Value FROM Win32_Property WHERE Property='UpgradeCode' and Value = '{$msiUpgradeCode}'") + $result.Count | Should -Be 1 -Because "Query should return 1 result if Upgrade code is for x64 $channel" } It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) { @@ -137,8 +142,13 @@ Describe -Name "Windows MSI" -Fixture { } It "MSI should have updated path" -Skip:(!(Test-Elevated)) { + if ($channel -eq 'preview') { + $pattern = '*files\powershell*\preview*' + } else { + $pattern = '*files\powershell*' + } $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object {$_ -like '*files\powershell*\preview*' -and $_ -notin $beforePath} + Where-Object {$_ -like $pattern -and $_ -notin $beforePath} $psPath | Should -Not -BeNullOrEmpty } diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 7911b0f33e6..80f39735b8b 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -501,6 +501,7 @@ function Invoke-CIFinish # the packaging tests find the MSI package using env:PSMsiX64Path $env:PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith(".msi")} + $env:PSMsiChannel = $Channel # Install the latest Pester and import it $maximumPesterVersion = '4.99' From aa3ebb5c7c9a231beb7f1b00d973779500b3d840 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 3 Feb 2021 20:01:51 +0000 Subject: [PATCH 14/25] try making stable x86 to avoid test issue --- .vsts-ci/windows/windows-packaging.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index 1f1da95c824..057081ff53d 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -78,3 +78,4 @@ stages: - template: templates/windows-packaging.yml parameters: channel: stable + architecture: x86 From a02054b933bde30d4f7a5b626f894fbfb89a2baa Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 3 Feb 2021 20:12:26 +0000 Subject: [PATCH 15/25] fix packaging runtime --- tools/ci.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 80f39735b8b..0d90d981897 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -475,7 +475,7 @@ function Invoke-CIFinish } # Build packages $preReleaseVersion = "$previewPrefix-$previewLabel.$env:BUILD_BUILDID" - $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks + $packages = Start-PSPackage -Type msi,nupkg,zip,zip-pdb -ReleaseTag $preReleaseVersion -SkipReleaseChecks -WindowsRuntime $Runtime $artifacts = New-Object System.Collections.ArrayList foreach ($package in $packages) { From 65366ed7a7d87cc83114c0493b97f66994b1f39e Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 3 Feb 2021 20:42:48 +0000 Subject: [PATCH 16/25] Add upgrade codes for all variants --- test/packaging/windows/msi.tests.ps1 | 19 +++++++++++++++---- tools/ci.psm1 | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index 8874f9f4465..e12e851395b 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -54,6 +54,7 @@ Describe -Name "Windows MSI" -Fixture { $msiX64Path = $env:PsMsiX64Path $channel = $env:PSMsiChannel + $runtime = $env:PSMsiRuntime # Get any existing powershell in the path $beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | @@ -82,11 +83,21 @@ Describe -Name "Windows MSI" -Fixture { } Context "Upgrade code" { + $channelRuntime = "$channel-$runtime" BeforeAll { - if ($channel -eq 'preview') { - $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' - } else { - $msiUpgradeCode = '31ab5147-9a97-4452-8443-d9709f0516e1' + switch ($channelRuntime) { + "preview-win-x64" { + $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' + } + "stable-win-x64" { + $msiUpgradeCode = '31ab5147-9a97-4452-8443-d9709f0516e1' + } + "preview-win-x86" { + $msiUpgradeCode = '86abcfbd-1ccc-4a88-b8b2-0facfde29094' + } + "stable-win-x86" { + $msiUpgradeCode = '1d00683b-0f84-4db8-a64f-2f98ad42fe06' + } } } diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 0d90d981897..f978decf64a 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -502,6 +502,7 @@ function Invoke-CIFinish # the packaging tests find the MSI package using env:PSMsiX64Path $env:PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith(".msi")} $env:PSMsiChannel = $Channel + $env:PSMsiRuntime = $Runtime # Install the latest Pester and import it $maximumPesterVersion = '4.99' From 7c38c06a28a57f93bcd379b1cbc4b09c81d00ede Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 4 Feb 2021 18:20:57 +0000 Subject: [PATCH 17/25] fix variable scope --- test/packaging/windows/msi.tests.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index e12e851395b..e8f8d867838 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -83,9 +83,8 @@ Describe -Name "Windows MSI" -Fixture { } Context "Upgrade code" { - $channelRuntime = "$channel-$runtime" BeforeAll { - switch ($channelRuntime) { + switch ("$channel-$runtime") { "preview-win-x64" { $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' } From cb6ed5f143880ae314cfee785403d2a7a5ab170c Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 4 Feb 2021 18:34:11 +0000 Subject: [PATCH 18/25] diagnostics --- test/packaging/windows/msi.tests.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index e8f8d867838..c2b3eb657fd 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -84,6 +84,7 @@ Describe -Name "Windows MSI" -Fixture { Context "Upgrade code" { BeforeAll { + Write-Verbose "cr-$channel-$runtime" -Verbose switch ("$channel-$runtime") { "preview-win-x64" { $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' @@ -97,6 +98,9 @@ Describe -Name "Windows MSI" -Fixture { "stable-win-x86" { $msiUpgradeCode = '1d00683b-0f84-4db8-a64f-2f98ad42fe06' } + default { + throw "'$_' not a valid channel runtime combination" + } } } From 21ebd38c516cf5fc97dd86d39a236704692fd029 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 4 Feb 2021 18:57:28 +0000 Subject: [PATCH 19/25] fix runtimes --- test/packaging/windows/msi.tests.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index c2b3eb657fd..d0cf5b8fe10 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -86,16 +86,16 @@ Describe -Name "Windows MSI" -Fixture { BeforeAll { Write-Verbose "cr-$channel-$runtime" -Verbose switch ("$channel-$runtime") { - "preview-win-x64" { + "preview-win7-x64" { $msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8' } - "stable-win-x64" { + "stable-win7-x64" { $msiUpgradeCode = '31ab5147-9a97-4452-8443-d9709f0516e1' } - "preview-win-x86" { + "preview-win7-x86" { $msiUpgradeCode = '86abcfbd-1ccc-4a88-b8b2-0facfde29094' } - "stable-win-x86" { + "stable-win7-x86" { $msiUpgradeCode = '1d00683b-0f84-4db8-a64f-2f98ad42fe06' } default { From cc0b97f15b148b2482febe26fa457f23b49d0a9e Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 4 Feb 2021 19:22:48 +0000 Subject: [PATCH 20/25] fix path check --- test/packaging/windows/msi.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index d0cf5b8fe10..4739fe85eca 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -136,7 +136,7 @@ Describe -Name "Windows MSI" -Fixture { It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) { $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath} + Where-Object {$_ -like '*files*\powershell*' -and $_ -notin $beforePath} $psPath | Should -BeNullOrEmpty } From c50163f83b176aed56e4a54248947b9ee266fa44 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Feb 2021 01:40:59 +0000 Subject: [PATCH 21/25] log paths --- test/packaging/windows/msi.tests.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index 4739fe85eca..f5435cdb709 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -135,6 +135,9 @@ Describe -Name "Windows MSI" -Fixture { } It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) { + $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | + Where-Object {$_ -notin $beforePath} | + ForEach-Object {Write-Verbose -Verbose $_} $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | Where-Object {$_ -like '*files*\powershell*' -and $_ -notin $beforePath} From 75320692dbb2415c22022052b545895fa6525f0b Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Feb 2021 19:23:59 +0000 Subject: [PATCH 22/25] pend test failure --- .vsts-ci/windows/windows-packaging.yml | 4 ++++ test/packaging/windows/msi.tests.ps1 | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.vsts-ci/windows/windows-packaging.yml b/.vsts-ci/windows/windows-packaging.yml index 057081ff53d..e3edb42d4c4 100644 --- a/.vsts-ci/windows/windows-packaging.yml +++ b/.vsts-ci/windows/windows-packaging.yml @@ -79,3 +79,7 @@ stages: parameters: channel: stable architecture: x86 + - template: templates/windows-packaging.yml + parameters: + channel: preview + architecture: x86 diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index f5435cdb709..2f1d3fc4173 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -136,10 +136,18 @@ Describe -Name "Windows MSI" -Fixture { It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) { $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object {$_ -notin $beforePath} | - ForEach-Object {Write-Verbose -Verbose $_} - $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object {$_ -like '*files*\powershell*' -and $_ -notin $beforePath} + Where-Object { $_ -like '*files*\powershell*' -and $_ -notin $beforePath } + + if (!$psPath) { + ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | + Where-Object { $_ -notin $beforePath } | + ForEach-Object { Write-Verbose -Verbose $_ } + } + + if ($runtime -eq 'win7-x86') + { + Set-ItResult -Pending -Because "Setting path is not working on x86" + } $psPath | Should -BeNullOrEmpty } From 1f4d1c153a0147e8303896d346472f4d206040bb Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Feb 2021 19:29:58 +0000 Subject: [PATCH 23/25] diagnostics --- tools/packaging/packaging.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 03bcb63461b..93e713f21c2 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -336,6 +336,7 @@ function Start-PSPackage { if ($Runtime -match "-x86") { $TargetArchitecture = "x86" } + Write-Verbose "TargetArchitecture = $TargetArchitecture" -Verbose $Arguments = @{ ProductNameSuffix = $NameSuffix From afdb585839802a8fdb4992eaff749521da4c2a58 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Feb 2021 20:23:54 +0000 Subject: [PATCH 24/25] fix correct test --- test/packaging/windows/msi.tests.ps1 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index 2f1d3fc4173..ccec36d7b44 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -136,18 +136,7 @@ Describe -Name "Windows MSI" -Fixture { It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) { $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object { $_ -like '*files*\powershell*' -and $_ -notin $beforePath } - - if (!$psPath) { - ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object { $_ -notin $beforePath } | - ForEach-Object { Write-Verbose -Verbose $_ } - } - - if ($runtime -eq 'win7-x86') - { - Set-ItResult -Pending -Because "Setting path is not working on x86" - } + Where-Object { $_ -like '*files\powershell*' -and $_ -notin $beforePath } $psPath | Should -BeNullOrEmpty } @@ -172,8 +161,19 @@ Describe -Name "Windows MSI" -Fixture { } else { $pattern = '*files\powershell*' } + $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | - Where-Object {$_ -like $pattern -and $_ -notin $beforePath} + Where-Object { $_ -like $pattern -and $_ -notin $beforePath } + + if (!$psPath) { + ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | + Where-Object { $_ -notin $beforePath } | + ForEach-Object { Write-Verbose -Verbose $_ } + } + + if ($runtime -eq 'win7-x86') { + Set-ItResult -Pending -Because "Setting path is not working on x86" + } $psPath | Should -Not -BeNullOrEmpty } From a359b8322e503d58f5b275f786fe8c4432b3969a Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Feb 2021 20:46:38 +0000 Subject: [PATCH 25/25] fix pattern --- test/packaging/windows/msi.tests.ps1 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index ccec36d7b44..ce9e3334557 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -157,9 +157,9 @@ Describe -Name "Windows MSI" -Fixture { It "MSI should have updated path" -Skip:(!(Test-Elevated)) { if ($channel -eq 'preview') { - $pattern = '*files\powershell*\preview*' + $pattern = '*files*\powershell*\preview*' } else { - $pattern = '*files\powershell*' + $pattern = '*files*\powershell*' } $psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' | @@ -171,10 +171,6 @@ Describe -Name "Windows MSI" -Fixture { ForEach-Object { Write-Verbose -Verbose $_ } } - if ($runtime -eq 'win7-x86') { - Set-ItResult -Pending -Because "Setting path is not working on x86" - } - $psPath | Should -Not -BeNullOrEmpty }