Make sure GA revision increases from RC and Preview releases (#15558)

This commit is contained in:
Travis Plunk
2021-06-15 13:44:08 -07:00
committed by GitHub
parent 6833b2a43f
commit 046dec4d7c
2 changed files with 22 additions and 1 deletions
+3 -1
View File
@@ -49,13 +49,15 @@
<ReleaseTagSemVersionPrereleaseNamePart>$([System.Text.RegularExpressions.Regex]::Match($(ReleaseTag), $(RegexReleaseTag)).Groups[6].Value)</ReleaseTagSemVersionPrereleaseNamePart>
<!-- Increment revision 100 for rc releases -->
<RCIncrementValue>100</RCIncrementValue>
<!-- Increment revision 500 for GA releases -->
<GAIncrementValue>500</GAIncrementValue>
<ReleaseTagSemVersionPart Condition = "'$(ReleaseTagSemVersionPrereleaseNamePart)' == 'rc'">$([MSBuild]::Add($(ReleaseTagSemVersionPart), $(RCIncrementValue)))</ReleaseTagSemVersionPart>
<!-- Create the internal version -->
<PSCoreBuildVersion>$(ReleaseTag)</PSCoreBuildVersion>
<!-- Create the version if we have a pre-release -->
<PSCoreFileVersion Condition = "'$(ReleaseTagSemVersionPart)' != ''">$(ReleaseTagVersionPart).$(ReleaseTagSemVersionPart)</PSCoreFileVersion>
<!-- Create the version if we have a release build -->
<PSCoreFileVersion Condition = "'$(PSCoreFileVersion)' == ''">$(ReleaseTagVersionPart)</PSCoreFileVersion>
<PSCoreFileVersion Condition = "'$(PSCoreFileVersion)' == ''">$(ReleaseTagVersionPart).$(GAIncrementValue)</PSCoreFileVersion>
</PropertyGroup>
<PropertyGroup>
+19
View File
@@ -85,17 +85,28 @@ Describe -Name "Windows MSI" -Fixture {
Context "Upgrade code" {
BeforeAll {
Write-Verbose "cr-$channel-$runtime" -Verbose
$pwshPath = Join-Path $env:ProgramFiles -ChildPath "PowerShell"
$pwshx86Path = Join-Path ${env:ProgramFiles(x86)} -ChildPath "PowerShell"
switch ("$channel-$runtime") {
"preview-win7-x64" {
$versionPath = Join-Path -Path $pwshPath -ChildPath '7-preview'
$revisionRange = 0, 99
$msiUpgradeCode = '39243d76-adaf-42b1-94fb-16ecf83237c8'
}
"stable-win7-x64" {
$versionPath = Join-Path -Path $pwshPath -ChildPath '7'
$revisionRange = 500, 500
$msiUpgradeCode = '31ab5147-9a97-4452-8443-d9709f0516e1'
}
"preview-win7-x86" {
$versionPath = Join-Path -Path $pwshx86Path -ChildPath '7-preview'
$revisionRange = 0, 99
$msiUpgradeCode = '86abcfbd-1ccc-4a88-b8b2-0facfde29094'
}
"stable-win7-x86" {
$versionPath = Join-Path -Path $pwshx86Path -ChildPath '7'
$revisionRange = 500, 500
$msiUpgradeCode = '1d00683b-0f84-4db8-a64f-2f98ad42fe06'
}
default {
@@ -120,6 +131,14 @@ Describe -Name "Windows MSI" -Fixture {
$result.Count | Should -Be 1 -Because "Query should return 1 result if Upgrade code is for $runtime $channel"
}
It "Revision should be in correct range" -Skip:(!(Test-Elevated)) {
$pwshDllPath = Join-Path -Path $versionPath -ChildPath "pwsh.dll"
[version] $version = (Get-ChildItem $pwshDllPath).VersionInfo.FileVersion
Write-Verbose "pwsh.dll version: $version" -Verbose
$version.Revision | Should -BeGreaterOrEqual $revisionRange[0] -Because "$channel revision should between $($revisionRange[0]) and $($revisionRange[1])"
$version.Revision | Should -BeLessOrEqual $revisionRange[1] -Because "$channel revision should between $($revisionRange[0]) and $($revisionRange[1])"
}
It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) {
{
Invoke-MsiExec -Uninstall -MsiPath $msiX64Path