unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

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

Open davidmfinol opened this issue 2 years ago • 8 comments

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 avatar Jan 26 '22 06:01 davidmfinol

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

webbertakken avatar Jan 26 '22 12:01 webbertakken

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

wilg avatar Sep 19 '22 22:09 wilg

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 avatar Sep 19 '22 23:09 wilg

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

https://github.com/game-ci/unity-builder/blob/e5e370e88ea0489ff08dac7a986c79e23e625eca/dist/platforms/windows/build.ps1#L128-L138

wilg avatar Sep 19 '22 23:09 wilg

I think maybe $? needs to be $LastExitCode

wilg avatar Sep 19 '22 23:09 wilg

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

wilg avatar Sep 19 '22 23:09 wilg

Yes, this can probably be improved.

webbertakken avatar Sep 20 '22 09:09 webbertakken

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

https://github.com/game-ci/unity-builder/blob/3337de4dc90a37f0c9c786c0bcf6a1ec06dfe007/src/model/mac-builder.ts#L6-L9

Edit: and because exec returns the error code, it doesn't throw an exception. Example of catching it here: https://github.com/wilg/unity-builder/commit/4c4cb5d01f9026cae5fec68d6c5d0f3ce15aa386

wilg avatar Sep 24 '22 07:09 wilg

Done by #505

davidmfinol avatar Feb 14 '23 05:02 davidmfinol