Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fail AppVeyor Build if MSI does not build#5755

Merged
TravisEz13 merged 8 commits intoPowerShell:masterfrom
bergmeister:failBuildIfMsiCannotBuild
Jan 2, 2018
Merged

Fail AppVeyor Build if MSI does not build#5755
TravisEz13 merged 8 commits intoPowerShell:masterfrom
bergmeister:failBuildIfMsiCannotBuild

Conversation

@bergmeister
Copy link
Contributor

@bergmeister bergmeister commented Dec 29, 2017

PR Summary

Before this PR, when a WiX compilation error occurs then an error is thrown, which appears in the log with details but the AppVeyor build itself is still marked as green.
This PR makes the console host also return an exit code of -1 when being run on AppVeyor so that it can then interpret it as a build failure and mark the build as red. It uses the fact that AppVeyor defines an environment variable named CI. Exiting is OK since the MSI build is the last step in CI and nothing happens after that.
The git history shows a test build that proves that this works if the installer was broken.

PR Checklist

Note: Please mark anything not applicable to this PR NA.

@iSazonov
Copy link
Collaborator

I restarted Travis CI Linux job.

@markekraus
Copy link
Contributor

@bergmeister this is where you tested it, correct? https://ci.appveyor.com/project/bergmeister/powershell/build/v6.1.0-preview.204

Copy link
Contributor

@markekraus markekraus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bergmeister
Copy link
Contributor Author

bergmeister commented Dec 29, 2017

@markekraus Yes, sorry, it seems my link was broken, it is fixed now in the PR description. If you look at the commit history, the first commit contained also a syntax error to test that AppVeyor would actually fail and the 2nd commit reverted the syntax error. Maybe not clean in terms of git history but the PR commit gets squashed anyway.
Thanks @iSazonov but the travis CI build is not affected anyway due to MSI being Windows only.

@bergmeister bergmeister changed the title Fail AppVeyor Build if MSI does not build WIP Fail AppVeyor Build if MSI does not build Dec 29, 2017
@bergmeister bergmeister changed the title WIP Fail AppVeyor Build if MSI does not build Fail AppVeyor Build if MSI does not build Dec 29, 2017
build.psm1 Outdated
$WiXLightLog | Out-String | Write-Verbose -Verbose
if ($null -ne $env:CI)
{
$host.SetShouldExit(-1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the CmdLet alter the host behavior, AppVeyor.psm1 should detect this error and fail the CI. This might become unreliable if we attempt this is multiple places.

Another option, is detect we are in AppVeyor, and Add a compilation message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied your suggestion but the error message from Appveyor is very obscure then: https://ci.appveyor.com/project/PowerShell/powershell/build/1.0.7407

@TravisEz13 TravisEz13 merged commit 5f17196 into PowerShell:master Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants