Files
UUVPN/.github/workflows/build-debug.yml
T
admin cecdbd1b01
Build Debug / Build Android Debug APK (push) Failing after 1m10s
Build UUVPN / Build Android APK (push) Failing after 1m9s
Build UUVPN / Cleanup old artifacts (push) Failing after 0s
Build Debug / Build iOS Debug App (push) Has been cancelled
Build UUVPN / Build iOS IPA (push) Has been cancelled
Build UUVPN / Create GitHub Release (push) Has been cancelled
Build UUVPN / Upload to TestFlight (push) Has been cancelled
Build UUVPN / Send Notification (push) Has been cancelled
Fix: Install Git LFS before checkout, pull LFS files after checkout
2026-07-03 18:53:40 +08:00

254 lines
8.3 KiB
YAML

name: Build Debug
on:
push:
branches:
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
# ==================== Android Debug 构建 ====================
build-android-debug:
name: Build Android Debug APK
runs-on: ubuntu-latest
container:
image: node:20-bullseye
options: --user root
steps:
- name: Install Git LFS
run: apt-get update && apt-get install -y git-lfs
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Pull Git LFS files
run: |
git lfs install
git lfs pull
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Grant execute permission for gradlew
run: |
cd Android-kotlin-Code
chmod +x gradlew
- name: Create local.properties
run: |
cd Android-kotlin-Code
echo "sdk.dir=$ANDROID_HOME" > local.properties
- name: Build Android Debug APK
run: |
cd Android-kotlin-Code
./gradlew app:assembleDebug --stacktrace
- name: Upload Android Debug APK
uses: actions/upload-artifact@v4
with:
name: android-debug-apk
path: Android-kotlin-Code/app/build/outputs/apk/**/*.apk
retention-days: 7
# ==================== iOS Debug 构建 ====================
build-ios-debug:
name: Build iOS Debug App
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Git LFS
run: |
git lfs install
git lfs pull
- 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
with:
xcode-version: '26.3'
- name: Show Xcode version
run: |
xcodebuild -version
swift --version
- name: Resolve Swift Package Dependencies
run: |
cd iOS-SwiftUI-Code
xcodebuild -resolvePackageDependencies -project uuvpn.xcodeproj -scheme SFI
- name: List available schemes
run: |
cd iOS-SwiftUI-Code
xcodebuild -list -project uuvpn.xcodeproj
- name: Diagnose Libbox module
run: |
cd iOS-SwiftUI-Code
echo "=== Libbox.xcframework Info.plist ==="
cat Libbox.xcframework/Info.plist
echo ""
echo "=== Simulator module.modulemap ==="
cat Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Modules/module.modulemap
echo ""
echo "=== Simulator Headers ==="
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Headers/
echo ""
echo "=== Check for Swift module interface ==="
find Libbox.xcframework/ios-arm64_x86_64-simulator -name "*.swiftmodule" -o -name "*.swiftinterface" 2>/dev/null || echo "No Swift module interface found"
echo ""
echo "=== Check Modules directory ==="
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Modules/
- name: Build iOS Debug App
id: build
run: |
cd iOS-SwiftUI-Code
xcodebuild clean build \
-project uuvpn.xcodeproj \
-scheme SFI \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone Air,OS=26.2' \
-configuration Debug \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
2>&1 | tee build_output.log
# 检查构建结果
if grep -q "BUILD SUCCEEDED" build_output.log; then
echo "✅ BUILD SUCCEEDED"
echo "build_status=succeeded" >> $GITHUB_OUTPUT
else
echo "❌ BUILD FAILED"
echo "=== Error lines from build log ==="
grep -i "error:" build_output.log || echo "No 'error:' lines found"
echo ""
echo "=== Last 100 lines of build log ==="
tail -100 build_output.log
echo "build_status=failed" >> $GITHUB_OUTPUT
exit 1
fi
- name: Find and upload iOS Debug App
if: success()
run: |
cd iOS-SwiftUI-Code
# 查找 .app 文件
echo "Searching for .app files in DerivedData..."
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "SFI.app" -type d | head -n 1)
if [ -z "$APP_PATH" ]; then
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1)
fi
if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then
echo "✅ Found app at: $APP_PATH"
echo "App size:"
du -sh "$APP_PATH"
# 复制到 build 目录
mkdir -p build
cp -R "$APP_PATH" build/
# 创建 zip 文件
cd build
APP_NAME=$(basename "$APP_PATH")
zip -r ios-debug-app.zip "$APP_NAME"
echo "✅ Created zip file: ios-debug-app.zip"
ls -lh ios-debug-app.zip
else
echo "❌ No .app file found in DerivedData"
exit 1
fi
- name: Upload iOS Debug App
uses: actions/upload-artifact@v4
with:
name: ios-debug-app
path: iOS-SwiftUI-Code/build/ios-debug-app.zip
retention-days: 7