Prototype icon indicating copy to clipboard operation
Prototype copied to clipboard

Export C7 Game Should Fail if Project Fails to Build

Open QuintillusCFC opened this issue 3 years ago • 5 comments

See https://github.com/C7-Game/Prototype/runs/7297094073?check_suite_focus=true, open the Windows Build section (or Linux, or probably Mac), expand the logs, and you'll see:

ERROR: Failed to export project: Failed to build project
   at: godot_icall_GD_pusherror (modules/mono/glue/gd_glue.cpp:249)

This is a real failure, but the build succeeds. It should fail.

To reproduce this, you can set your .NET version so something that the build server doesn't support. Right now it supports net472 but not net6.0, but if it later supports that, try setting it to something like net9.7 to cause this error again.

QuintillusCFC avatar Jul 12 '22 17:07 QuintillusCFC

Confirmed that Godot sets an error code of 1 if it fails to succeed; you can check this on Windows by running echo %errorlevel% after running godot.exe -v --export "Windows Desktop" OutputFolder/C7.exe; if it succeeds, it sets it to 0.

It looks like echo $? does the same thing in Bash, which is probably what our build server is running, so in theory we should be able to check $? to see whether we succeeded, and if not then we just have to figure out how to fail. We have some code that sort of looks like that for the file-copying step, but I'm not sure if that actually causes a failure either, or just prints out a scary warning in the logs.

Gonna self-assign this and move it to in-progress, it looks solveable with some sleep and a few tests of it running in its native environment.

QuintillusCFC avatar Sep 15 '22 07:09 QuintillusCFC

Also adding to Carthage, as #308 already is in Carthage and while it might not technically require this, it's a whole lot more useful if this one is done first and it isn't just saying it succeeded all the time whether it actually did or not.

QuintillusCFC avatar Sep 15 '22 07:09 QuintillusCFC

I'm giving up on this. I created two branches to try to fix this:

https://github.com/C7-Game/Prototype/tree/306-Failing-to-Fail https://github.com/C7-Game/Prototype/tree/306-II-Failing-to-Fail

But in neither case could I get it to consistently fail when it should fail, and succeed when it should succeed. E.g. workflow https://github.com/C7-Game/Prototype/actions/runs/3062333231 uses the latest commit on 306-II-Failing-to-Fail, and even though the logs say the build failed, the return value still winds up being 0.

Testing manually on Ubuntu, the return value is 1 when it fails, which matches what I see on Windows. So it's something weird about the build server I guess. Or maybe bash (is the build server not really running bash maybe?). Either way it's too tedious to test and check and my Linux/Bash expertise is not high enough to resolve it. I'm much better at coding things than bash scripts/infrastructure things, thought this would be quick but it clearly isn't.

QuintillusCFC avatar Sep 15 '22 17:09 QuintillusCFC

I'll look into it.

WildWeazel avatar Sep 15 '22 17:09 WildWeazel

Thanks!

QuintillusCFC avatar Sep 15 '22 20:09 QuintillusCFC

I confirmed that the CI runs fail for build failures. I bumped the sdk version to 12.0 in C7Engine.csproj and got this output on the run. I suspect this was probably fixed by https://github.com/C7-Game/Prototype/pull/486

MSBuild version 17.7.6+77d58ec69 for .NET
  Determining projects to restore...
/usr/share/dotnet/sdk/7.0.410/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(160,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 12.0.  Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 12.0. Download the .NET SDK from https://aka.ms/dotnet/download [/__w/Prototype/Prototype/C7Engine/C7Engine.csproj]

Build FAILED.

/usr/share/dotnet/sdk/7.0.[41](https://github.com/C7-Game/Prototype/actions/runs/12856620334/job/35843509460#step:5:42)0/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(160,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 12.0.  Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 12.0. Download the .NET SDK from https://aka.ms/dotnet/download [/__w/Prototype/Prototype/C7Engine/C7Engine.csproj]
    0 Warning(s)
    1 Error(s)

TomWerner avatar Jan 19 '25 19:01 TomWerner