From 146dea5121f1c094bc92fce4693778572781c989 Mon Sep 17 00:00:00 2001 From: Ozgur Ersoy Date: Tue, 15 Apr 2025 14:28:10 +0200 Subject: [PATCH] fix(actions): add error handling and suggestions for build issues in macOS workflow --- .gitea/workflows/test-macos-build.yml | 47 +++++++++++++++++++++++---- Source/LuckyWorld.Target.cs | 1 + scripts/mac_build.sh | 2 ++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/test-macos-build.yml b/.gitea/workflows/test-macos-build.yml index 4376bbb8..dd41e358 100644 --- a/.gitea/workflows/test-macos-build.yml +++ b/.gitea/workflows/test-macos-build.yml @@ -100,24 +100,57 @@ jobs: # Find the app bundle - name: Find app bundle run: | + # Add error handling + set +e # Don't exit immediately on error for this block + + echo "Build status check..." + if [ ! -d "./Builds" ] && [ ! -d "./Saved/StagedBuilds" ]; then + echo "❌ ERROR: Build directories do not exist. Build likely failed." + echo "Checking build logs for common issues..." + + # Check for the specific GlobalDefinitions error + if grep -q "GlobalDefinitions.*This is not allowed" "$GITHUB_WORKSPACE"/*.log 2>/dev/null || grep -q "BuildEnvironment = TargetBuildEnvironment.Unique" "$GITHUB_WORKSPACE"/*.log 2>/dev/null; then + echo "🔍 Found issue with GlobalDefinitions in build target." + echo "⚠️ Fix required in LuckyWorld.Target.cs - need to add BuildEnvironment = TargetBuildEnvironment.Unique;" + cat << 'EOF' + +Fix suggestion for LuckyWorld.Target.cs: +Add this line in the constructor: + BuildEnvironment = TargetBuildEnvironment.Unique; + +Example: + public LuckyWorldTarget(TargetInfo Target) : base(Target) + { + Type = TargetType.Game; + DefaultBuildSettings = BuildSettingsVersion.V5; + BuildEnvironment = TargetBuildEnvironment.Unique; // Add this line + + // Rest of your constructor... + } +EOF + fi + + exit 1 + fi + # First check Saved/StagedBuilds directory - where Unreal often places built apps echo "Checking Saved/StagedBuilds directory..." - APP_PATHS=$(find ./Saved/StagedBuilds -type d -name "*.app" 2>/dev/null) + APP_PATHS=$(find ./Saved/StagedBuilds -type d -name "*.app" 2>/dev/null || echo "") # If not found, check Builds directory if [ -z "$APP_PATHS" ]; then - echo "Checking Builds directory..." - APP_PATHS=$(find ./Builds -type d -name "*.app" 2>/dev/null) + echo "No app found in Saved/StagedBuilds, checking Builds directory..." + APP_PATHS=$(find ./Builds -type d -name "*.app" 2>/dev/null || echo "") fi # If still not found, check the whole workspace if [ -z "$APP_PATHS" ]; then - echo "Checking entire workspace..." - APP_PATHS=$(find . -type d -name "*.app" -not -path "*/\.*" 2>/dev/null) + echo "No app found in Builds, checking entire workspace..." + APP_PATHS=$(find . -type d -name "*.app" -not -path "*/\.*" 2>/dev/null || echo "") fi if [ -z "$APP_PATHS" ]; then - echo "ERROR: Could not find any app bundles!" + echo "❌ ERROR: Could not find any app bundles!" echo "Listing all directories to help debug:" find . -type d -maxdepth 3 | sort exit 1 @@ -134,7 +167,7 @@ jobs: # Make sure app exists - using local variable if [ ! -d "$MAIN_APP_PATH" ]; then - echo "ERROR: App bundle not found at $MAIN_APP_PATH!" + echo "❌ ERROR: App bundle not found at $MAIN_APP_PATH!" exit 1 fi diff --git a/Source/LuckyWorld.Target.cs b/Source/LuckyWorld.Target.cs index a7b2ad79..233a574d 100644 --- a/Source/LuckyWorld.Target.cs +++ b/Source/LuckyWorld.Target.cs @@ -9,6 +9,7 @@ public class LuckyWorldTarget : TargetRules { Type = TargetType.Game; DefaultBuildSettings = BuildSettingsVersion.V5; + BuildEnvironment = TargetBuildEnvironment.Unique; ExtraModuleNames.AddRange( new string[] { "LuckyWorld" } ); diff --git a/scripts/mac_build.sh b/scripts/mac_build.sh index 478f3281..a7bc439d 100755 --- a/scripts/mac_build.sh +++ b/scripts/mac_build.sh @@ -135,3 +135,5 @@ if [ -n "$APP_PATH" ]; then echo "⚠️ Info.plist not found at $INFO_PLIST" fi fi + +echo "Completed post-build process ✅"