Skip to content

Commit f1c0c2a

Browse files
authored
Clean build during daily build to ensure MSI package is generate correctly (#6334)
Clean build during the daily build to ensure MSI package is generated correctly - Do another clean build directly before packaging to clean up files that test has added
1 parent 46a8976 commit f1c0c2a

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

tools/appveyor.psm1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,25 @@ function Invoke-AppveyorFinish
450450
try {
451451
$releaseTag = Get-ReleaseTag
452452

453+
# Build clean before backing to remove files from testing
454+
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $releaseTag -Clean
455+
453456
# Build packages
454457
$packages = Start-PSPackage -Type msi,nupkg,zip -ReleaseTag $releaseTag -SkipReleaseChecks
458+
$msiObject = $packages | Where-Object { $_ -is [pscustomobject] -and $_.msi }
459+
$msi = $msiObject | Where-Object { $_.msi.EndsWith(".msi") } | Select-Object -ExpandProperty msi
455460

456461
$artifacts = New-Object System.Collections.ArrayList
457462
foreach ($package in $packages) {
458-
$null = $artifacts.Add($package)
463+
if($package -is [string])
464+
{
465+
$null = $artifacts.Add($package)
466+
}
467+
elseif($package -is [pscustomobject] -and $package.msi)
468+
{
469+
$null = $artifacts.Add($package.msi)
470+
$null = $artifacts.Add($package.wixpdb)
471+
}
459472
}
460473

461474
if ($env:APPVEYOR_REPO_TAG_NAME)
@@ -477,8 +490,8 @@ function Invoke-AppveyorFinish
477490
}
478491

479492
# Smoke Test MSI installer
480-
Write-Verbose "Smoke-Testing MSI installer" -Verbose
481-
$msi = $artifacts | Where-Object { $_.EndsWith(".msi") }
493+
log "Smoke-Testing MSI installer"
494+
$msi = $artifacts | Where-Object { $_.EndsWith(".msi")}
482495
$msiLog = Join-Path (Get-Location) 'msilog.txt'
483496
$msiExecProcess = Start-Process msiexec.exe -Wait -ArgumentList "/I $msi /quiet /l*vx $msiLog" -NoNewWindow -PassThru
484497
if ($msiExecProcess.ExitCode -ne 0)
@@ -487,7 +500,8 @@ function Invoke-AppveyorFinish
487500
$exitCode = $msiExecProcess.ExitCode
488501
throw "MSI installer failed and returned error code $exitCode. MSI Log was uploaded as artifact."
489502
}
490-
Write-Verbose "MSI smoke test was successful" -Verbose
503+
504+
log "MSI smoke test was successful"
491505

492506
# only publish assembly nuget packages if it is a daily build and tests passed
493507
if((Test-DailyBuild) -and $env:TestPassed -eq 'True')

tools/packaging/packaging.psm1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,6 +2278,18 @@ function Test-FileWxs
22782278

22792279
if(!$passed)
22802280
{
2281+
if($env:appveyor)
2282+
{
2283+
try
2284+
{
2285+
Push-AppveyorArtifact $HeatFilesWxsPath
2286+
}
2287+
catch
2288+
{
2289+
#ignore any error pushing the artifact
2290+
}
2291+
}
2292+
22812293
throw "Current files to not match {$FilesWxsPath}"
22822294
}
22832295
}

0 commit comments

Comments
 (0)