Debug: Add detailed verification of Libbox.xcframework binary file before build to diagnose download issue

This commit is contained in:
2026-07-02 16:31:10 +08:00
parent 5b8e815fe6
commit a0e3b69ac5
+61 -84
View File
@@ -23,7 +23,6 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
lfs: true
- name: Set up JDK 17
uses: actions/setup-java@v4
@@ -73,7 +72,62 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
lfs: true
- name: Verify Libbox framework before build
run: |
echo "========================================"
echo "Checking Libbox.xcframework..."
echo "========================================"
cd iOS-SwiftUI-Code
if [ -d "Libbox.xcframework" ]; then
echo "✅ Libbox.xcframework directory exists"
ls -lh Libbox.xcframework/
# 检查模拟器版本
if [ -d "Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A" ]; then
echo "✅ Simulator framework structure exists"
# 检查二进制文件
LIBBOX_BINARY="Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Libbox"
if [ -f "$LIBBOX_BINARY" ]; then
echo "✅ Libbox binary file exists"
# 获取文件大小 (macOS 和 Linux 兼容)
FILE_SIZE=$(stat -f%z "$LIBBOX_BINARY" 2>/dev/null || stat -c%s "$LIBBOX_BINARY" 2>/dev/null)
echo "Binary file size: $FILE_SIZE bytes ($(( FILE_SIZE / 1024 / 1024 )) MB)"
# 检查文件是否是真实的二进制文件 (不是 Git placeholder)
if [ "$FILE_SIZE" -lt 1000 ]; then
echo "❌ ERROR: File size is too small! This is likely a Git placeholder"
echo "File content (first 200 bytes):"
head -c 200 "$LIBBOX_BINARY"
echo ""
echo "This means Git did not download the actual binary file."
exit 1
else
echo "✅ File size is normal, binary appears to be downloaded correctly"
echo "File type:"
file "$LIBBOX_BINARY" || echo "Binary file exists"
fi
else
echo "❌ ERROR: Libbox binary file NOT found at: $LIBBOX_BINARY"
echo "Listing directory contents:"
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/ || true
exit 1
fi
else
echo "❌ ERROR: Simulator framework structure NOT found"
echo "Listing Libbox.xcframework contents:"
find Libbox.xcframework -type d -name "*.framework" || true
exit 1
fi
else
echo "❌ ERROR: Libbox.xcframework directory NOT found!"
echo "Listing iOS-SwiftUI-Code directory:"
ls -la
exit 1
fi
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
@@ -90,34 +144,13 @@ jobs:
cd iOS-SwiftUI-Code
xcodebuild -resolvePackageDependencies -project uuvpn.xcodeproj -scheme SFI
- name: Verify Libbox framework exists
run: |
cd iOS-SwiftUI-Code
echo "Checking Libbox.xcframework..."
if [ -d "Libbox.xcframework" ]; then
echo "✅ Libbox.xcframework exists"
ls -lh Libbox.xcframework/
echo "Checking simulator variant..."
if [ -d "Libbox.xcframework/ios-arm64_x86_64-simulator" ]; then
echo "✅ Simulator variant exists"
ls -lh Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/
file Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Libbox || echo "Binary file check"
else
echo "❌ Simulator variant NOT found!"
exit 1
fi
else
echo "❌ Libbox.xcframework NOT found!"
exit 1
fi
- name: List available schemes
run: |
cd iOS-SwiftUI-Code
xcodebuild -list -project uuvpn.xcodeproj
- name: Build iOS Debug App (attempt 1 - with verbose output)
id: build_attempt_1
- name: Build iOS Debug App
id: build
run: |
cd iOS-SwiftUI-Code
xcodebuild clean build \
@@ -142,73 +175,19 @@ jobs:
exit 1
fi
# 显示构建产物目录
echo "Checking DerivedData directory for .app files..."
find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d || echo "No .app found in DerivedData"
- name: Check if build succeeded
if: failure()
run: |
echo "Build failed. Checking error messages..."
cd iOS-SwiftUI-Code
cat build_output.log | grep -A 10 "error:" || echo "No specific error found"
exit 1
- name: Find and upload iOS Debug App
if: success()
run: |
cd iOS-SwiftUI-Code
# 显示 DerivedData 目录结构
# 查找 .app 文件
echo "Searching for .app files in DerivedData..."
find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d
# 显示 Build 目录结构
echo "Searching for .app files in Build directory..."
find ./build -name "*.app" -type d || echo "No build directory found"
# 尝试多个可能的路径
APP_PATH=""
# 方法1: 从 DerivedData 查找
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "SFI.app" -type d | head -n 1)
# 方法2: 如果没找到,查找任何 .app 文件
if [ -z "$APP_PATH" ]; then
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1)
fi
# 方法3: 从 Build 目录查找
if [ -z "$APP_PATH" ]; then
APP_PATH=$(find ./build -name "*.app" -type d | head -n 1)
fi
# 方法4: 使用 xcodebuild 显示构建产物路径
if [ -z "$APP_PATH" ]; then
echo "Getting build settings to find target build dir..."
# 获取模拟器构建目录 (Debug-iphonesimulator)
BUILD_DIR=$(xcodebuild -project uuvpn.xcodeproj -scheme SFI -sdk iphonesimulator -showBuildSettings | grep "TARGET_BUILD_DIR" | cut -d '=' -f 2 | tr -d ' ')
echo "TARGET_BUILD_DIR (Simulator): $BUILD_DIR"
if [ -n "$BUILD_DIR" ] && [ -d "$BUILD_DIR" ]; then
echo "Contents of TARGET_BUILD_DIR:"
ls -la "$BUILD_DIR" || true
APP_PATH=$(find "$BUILD_DIR" -name "*.app" -type d | head -n 1)
fi
fi
# 方法5: 直接查找模拟器构建目录
if [ -z "$APP_PATH" ]; then
echo "Searching in Debug-iphonesimulator directory..."
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -path "*Debug-iphonesimulator*.app" -type d | head -n 1)
fi
# 方法6: 列出所有 DerivedData 内容
if [ -z "$APP_PATH" ]; then
echo "Listing ALL contents in DerivedData..."
find ~/Library/Developer/Xcode/DerivedData -type d -name "*.app" 2>/dev/null || true
find ~/Library/Developer/Xcode/DerivedData -type d -name "Build" 2>/dev/null || true
ls -R ~/Library/Developer/Xcode/DerivedData/ 2>/dev/null | head -100 || true
fi
if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then
echo "✅ Found app at: $APP_PATH"
echo "App size:"
@@ -226,9 +205,7 @@ jobs:
echo "✅ Created zip file: ios-debug-app.zip"
ls -lh ios-debug-app.zip
else
echo "❌ No .app file found in any location"
echo "Listing all files in DerivedData..."
ls -R ~/Library/Developer/Xcode/DerivedData/uuvpn*/Build/Products/ || true
echo "❌ No .app file found in DerivedData"
exit 1
fi