Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows and Mac builds do not raise error when the build fails #325

Closed
davidmfinol opened this issue Jan 26, 2022 · 9 comments
Closed

Windows and Mac builds do not raise error when the build fails #325

davidmfinol opened this issue Jan 26, 2022 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@davidmfinol
Copy link
Member

davidmfinol commented Jan 26, 2022

Bug description

Windows and Mac builds do not raise error when the build fails

How to reproduce

  • Run a build using a windows image or using macos runner
  • Have the build fail

Expected behavior

The GitHub actions status should show as errored.

Additional details

The windows builds here failed, but do not show as errored: https://github.com/finol-digital/Card-Game-Simulator/actions/runs/1748742227

@davidmfinol davidmfinol added the bug Something isn't working label Jan 26, 2022
@webbertakken
Copy link
Member

Déjà vu. We used to have this image in Linux as well. Perhaps we can use a similar same solution.

@davidmfinol davidmfinol added the help wanted Extra attention is needed label Apr 22, 2022
@davidmfinol davidmfinol changed the title Windows builds do not raise error when the build fails Windows and Mac builds do not raise error when the build fails May 9, 2022
@wilg
Copy link

wilg commented Sep 19, 2022

It doesn't even seem like the process exits when the build fails, at least on my self-hosted runnner.

@wilg
Copy link

wilg commented Sep 19, 2022

I see this in my logs, which is perhaps the culprit?

Build failed, with exit code True"

It looks like that's expecting an int? Probably some Windows hogwash.

@wilg
Copy link

wilg commented Sep 19, 2022

Seems like something's wrong here, but I don't know anything about PowerShell:

# Catch exit code
$Env:BUILD_EXIT_CODE=$?
# Display results
if ($Env:BUILD_EXIT_CODE -eq 0)
{
Write-Output "Build Succeeded!"
} else
{
Write-Output "$('Build failed, with exit code ')$($Env:BUILD_EXIT_CODE)$('"')"
}

@wilg
Copy link

wilg commented Sep 19, 2022

I think maybe $? needs to be $LastExitCode

@wilg
Copy link

wilg commented Sep 19, 2022

Seems like nowhere in the script does it actually exit if there is a failure? I am playing with adding explicit exits on my fork. Not sure if that's the best solution or what, still learning this codebase. https://github.com/wilg/unity-builder

@webbertakken
Copy link
Member

Yes, this can probably be improved.

@wilg
Copy link

wilg commented Sep 24, 2022

This seems to have been added explicitly, the Mac builder is run with ignoreReturnCode:

https://github.com/game-ci/unity-builder/pull/326/files#diff-235ccbdf6464862b094c2efc53e8144265c6665ad99a973e18bad1c51d113204R8

await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent,
ignoreReturnCode: true,
});

Edit: and because exec returns the error code, it doesn't throw an exception. Example of catching it here: wilg@4c4cb5d

@davidmfinol
Copy link
Member Author

Done by #505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants