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

Error: There was an error building the project. Please read the logs for details #584

Closed humbertodias closed 1 year ago

humbertodias commented 1 year ago

Bug description

After successfully build on the license step fails saying "Error: There was an error building the project. Please read the logs for details."

How to reproduce

  1. Configure the step
      # Build
      - name: Build project
        uses: game-ci/unity-builder@v3
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          unityVersion: ${{ matrix.unityVersion }}
          targetPlatform: ${{ matrix.targetPlatform }}
  1. Setup the secret variable UNITY_LICENSE
  2. Launch the build action manually
  3. Linux/Mac/Windws build will fail

Step configured https://github.com/humbertodias/unity-mugen/blob/main/.github/workflows/release.yml

Expected behavior

Should pass through without any problem, because the activation was completed.

Changing to "/github/workspace/_activate-license~" directory.
/github/workspace/_activate-license~ /github/workspace
Requesting activation (personal license)
Activation complete.

Another weird behavior is related to WebGL version that works well image However, linux, windows and mac fails.

Additional details

Log https://github.com/humbertodias/unity-mugen/actions/runs/6508708719/job/17680421661

Build succeeded

###########################
#       Build output      #
###########################

total 32M
drwxr-xr-x 4 root root 4.0K Oct 13 14:04 .
drwxr-xr-x 3 root root 4.0K Oct 13 13:50 ..
-rwxr-xr-x 1 1000 1000  15K Oct 13 14:04 StandaloneLinux64
drwxr-xr-x 3 root root 4.0K Oct 13 14:04 StandaloneLinux64_BurstDebugInformation_DoNotShip
drwxr-xr-x 7 root root 4.0K Oct 13 14:04 StandaloneLinux64_Data
-rwxr-xr-x 1 1000 1000  32M Oct 13 14:04 UnityPlayer.so
Changing to "/github/workspace/_activate-license~" directory.
/github/workspace/_activate-license~ /github/workspace
/github/workspace
Error: There was an error building the project. Please read the logs for details.
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Build project

image

GabLeRoux commented 1 year ago

Before v3, we didn't look for actual errors, we only considered Unity's exit code.

In your case, we can see that Unity build succeeded:

2023-10-13T14:04:41.5215929Z Build succeeded!

but have a look at this here:

2023-10-13T14:04:41.5195289Z ###########################
2023-10-13T14:04:41.5196270Z #      Build results      #
2023-10-13T14:04:41.5197178Z ###########################
2023-10-13T14:04:41.5197731Z 
2023-10-13T14:04:41.5198080Z Duration: 00:08:38.1499180
2023-10-13T14:04:41.5198940Z Warnings: 94
2023-10-13T14:04:41.5199691Z Errors: 4
2023-10-13T14:04:41.5200452Z Size: 193454560 bytes
2023-10-13T14:04:41.5200956Z 
2023-10-13T14:04:41.5206352Z 
2023-10-13T14:04:41.5215929Z Build succeeded!

The pipeline failed due to 4 errors during the build. Yes Unity managed to create a build, but a few things went wrong.

Based on action implementation, this is handled here.

As you can see, if it finds Errors: (and it did find it in your case), then the workflow is marked as failed even if there was a build produced.

v2 to v3 of the actions added this error checking in logs. There are active discussions about this possible breaking change and how we should actually improve this.

Here's some related issues https://github.com/game-ci/unity-builder/issues/564 https://github.com/game-ci/unity-builder/issues/563 https://github.com/game-ci/unity-builder/issues/578 And there are others too

This is actually a proposal that will most likely help with that: https://github.com/game-ci/unity-builder/pull/576


Searching in the logs you linked, I found this:

2023-10-13T13:56:43.7126070Z Failed to find a suitable OpenCL device for the GPU Lightmapper. Please change your lightmapper or install the latest graphics driver.
2023-10-13T13:56:43.7129356Z UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
2023-10-13T13:56:43.7134730Z UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:508)
2023-10-13T13:56:43.7140102Z UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:372)
2023-10-13T13:56:43.7144451Z UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:336)
2023-10-13T13:56:43.7147264Z UnityBuilderAction.Builder:BuildProject () (at Assets/Editor/Editor/UnityBuilderAction/Builder.cs:82)
2023-10-13T13:56:43.7148534Z 
2023-10-13T13:56:43.7149516Z [/home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs line 508]
2023-10-13T13:56:43.7150897Z 
2023-10-13T13:56:43.7151340Z Falling back to CPU lightmapper.
2023-10-13T13:56:43.7153330Z UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
2023-10-13T13:56:43.7157568Z UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:508)
2023-10-13T13:56:43.7162990Z UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:372)
2023-10-13T13:56:43.7167411Z UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:336)
2023-10-13T13:56:43.7170240Z UnityBuilderAction.Builder:BuildProject () (at Assets/Editor/Editor/UnityBuilderAction/Builder.cs:82)

In other words, something went wrong trying to build with these lighting settings (if I understand correctly). Here's a very similar issue posted on our discord server.

AndrewKahr commented 1 year ago

v4 goes back to v2 style checks so this should be resolved once you upgrade