game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
857 stars 253 forks source link

Job with manualExit: true fails without a proper reason #578

Closed JohannesDeml closed 1 year ago

JohannesDeml commented 1 year ago

Bug description

I tried upgrading to current main branch to elevate the new feature of #574 with a job to update unity packages (which I was successfully using for some time with a forked version of v2 with the quit parameter removed). The file I ran is this one: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/commit/9a439f366c7fcb99409cfe72cb2445000a1b6e4e#diff-20be283f9ab3995c688edbbc13b4692464de2a738a624c2ff29f5d426e5e5cef

From the logs everything worked as expected, I get to the line where I call EditorApplication.Exit(0);, and it looks like Unity is shutting down correctly. However, in the end I get this:

2023-09-25T18:05:55.8577393Z ##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1695665155835,"processId":89,"allocatedMemory":7466856,"memoryLabels":[{"Default":11511},{"Permanent":16296},{"Thread":1083180},{"Manager":18808},{"VertexData":12},{"Geometry":280},{"Texture":168},{"Shader":69065},{"Material":24},{"GfxDevice":36472},{"Animation":352},{"Audio":3976},{"Font":140459},{"FontEngine":336},{"Physics":505},{"Serialization":684},{"Input":26808},{"JobScheduler":232},{"Mono":40},{"ScriptingNativeRuntime":167184},{"BaseObject":1621196},{"Resource":1024},{"Renderer":2320},{"Transform":48},{"File":808},{"WebCam":40},{"Culling":40},{"Terrain":1025},{"Wind":24},{"String":35892},{"DynamicArray":201114},{"HashMap":124734},{"Utility":1480222},{"Curl":1112},{"PoolAlloc":1488},{"AI":40},{"TypeTree":4533},{"ScriptManager":528},{"RuntimeInitializeOnLoadManager":72},{"SpriteAtlas":112},{"GI":3792},{"Director":7928},{"CloudService":12944},{"WebRequest":720},{"VR":45705},{"SceneManager":600},{"Video":72},{"LazyScriptCache":32},{"NativeArray":12},{"Camera":25},{"Secure":6385},{"Image":278528},{"SerializationCache":1576},{"APIUpdating":11856},{"Subsystems":384},{"VirtualTexturing":57560},{"StaticSafetyDebugInfo":327680},{"EditorGui":56},{"EditorUtility":57848},{"VersionControl":4},{"Undo":736},{"AssetDatabase":1388479},{"RestService":1518},{"EditorGi":376},{"License":3608},{"UnityConnect":25456},{"Collab":641},{"Upm":165396},{"DrivenProperties":80},{"LocalIPC":212},{"ProfilerEditor":10943},{"CoreBusinessMetrics":2876},{"AssetReference":32},{"IPCStream":32}]}
2023-09-25T18:05:55.8786816Z Build succeeded
2023-09-25T18:05:55.9232951Z 
2023-09-25T18:05:55.9233463Z ###########################
2023-09-25T18:05:55.9234125Z #       Build output      #
2023-09-25T18:05:55.9234687Z ###########################
2023-09-25T18:05:55.9235100Z 
2023-09-25T18:05:55.9260889Z total 8.0K
2023-09-25T18:05:55.9261733Z drwxr-xr-x 2 root root 4.0K Sep 25 18:05 .
2023-09-25T18:05:55.9262465Z drwxr-xr-x 3 root root 4.0K Sep 25 18:05 ..
2023-09-25T18:05:55.9272744Z Changing to "/github/workspace/_activate-license~" directory.
2023-09-25T18:05:55.9273601Z /github/workspace/_activate-license~ /github/workspace
2023-09-25T18:05:55.9274242Z /github/workspace
2023-09-25T18:05:56.1092370Z ##[error]There was an error building the project. Please read the logs for details.
2023-09-25T18:05:56.1375337Z Post job cleanup.
2023-09-25T18:05:56.2514982Z [command]/usr/bin/git version
2023-09-25T18:05:56.2571456Z git version 2.42.0
2023-09-25T18:05:56.2617514Z Copying '/home/runner/.gitconfig' to '/home/runner/work/_temp/1f146f9f-08d3-403d-af17-46729832439f/.gitconfig'
2023-09-25T18:05:56.2629537Z Temporarily overriding HOME='/home/runner/work/_temp/1f146f9f-08d3-403d-af17-46729832439f' before making global git config changes
2023-09-25T18:05:56.2630651Z Adding repository directory to the temporary git global config as a safe directory
2023-09-25T18:05:56.2635285Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/UnityWebGL-LoadingTest/UnityWebGL-LoadingTest
2023-09-25T18:05:56.2679014Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-09-25T18:05:56.2717222Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-09-25T18:05:56.2985990Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-09-25T18:05:56.3016632Z http.https://github.com/.extraheader
2023-09-25T18:05:56.3033059Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2023-09-25T18:05:56.3074122Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-09-25T18:05:56.3667302Z Cleaning up orphan processes

Apparently something still is flagged as failed (see ##[error]There was an error building the project. Please read the logs for details.), even though everything looks fine to me.

How to reproduce

Expected behavior

Job should not fail if EditorApplication.Exit(0); is called at the end

Additional details

JohannesDeml commented 1 year ago

Maybe @tobyspark you have an idea what could be wrong?

JohannesDeml commented 1 year ago

I found the problem to be the missing build reports, also mentioned in #575, #564, #563 and #535. Since there are already other issues on the topic, I will close this one. As a workaround, you can add an output to your script that matches the expected build results. https://discord.com/channels/710946343828455455/1143838569220280321 This is necessary until this step for validation is stripped out or better controlled as suggested in #575

tobyspark commented 1 year ago

Sorry for missing the mention – was out with Covid.

See also PR #576

JohannesDeml commented 1 year ago

No worries, I hope you're feeling better again! Thanks a lot for pushing the manual exit topic, that is a very needed addition to the project ❤️