188 lines
5.8 KiB
YAML
188 lines
5.8 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
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- 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 Xcode
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: '26.4'
|
|
|
|
- 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: Build iOS Debug App (attempt 1 - with verbose output)
|
|
id: build_attempt_1
|
|
continue-on-error: true
|
|
run: |
|
|
cd iOS-SwiftUI-Code
|
|
xcodebuild clean build \
|
|
-project uuvpn.xcodeproj \
|
|
-scheme SFI \
|
|
-sdk iphonesimulator \
|
|
-destination 'platform=iOS Simulator,name=iPhone Air,OS=26.4' \
|
|
-configuration Debug \
|
|
CODE_SIGN_IDENTITY="" \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
-skipPackagePluginManifestValidation \
|
|
-skipMacroValidation \
|
|
2>&1 | tee build_output.log
|
|
|
|
- name: Check if build succeeded
|
|
if: steps.build_attempt_1.outcome == 'failure'
|
|
run: |
|
|
echo "First build attempt failed. Trying alternative approach..."
|
|
cd iOS-SwiftUI-Code
|
|
# 尝试使用 xcpretty 获取更清晰的错误信息
|
|
cat build_output.log | grep -A 5 "error:" || echo "No specific error found in log"
|
|
exit 1
|
|
|
|
- name: Find and upload iOS Debug App
|
|
run: |
|
|
cd iOS-SwiftUI-Code
|
|
|
|
# 显示 DerivedData 目录结构
|
|
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..."
|
|
BUILD_DIR=$(xcodebuild -project uuvpn.xcodeproj -scheme SFI -showBuildSettings | grep "TARGET_BUILD_DIR" | cut -d '=' -f 2 | tr -d ' ')
|
|
echo "TARGET_BUILD_DIR: $BUILD_DIR"
|
|
if [ -n "$BUILD_DIR" ] && [ -d "$BUILD_DIR" ]; then
|
|
APP_PATH=$(find "$BUILD_DIR" -name "*.app" -type d | head -n 1)
|
|
fi
|
|
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 any location"
|
|
echo "Listing all files in DerivedData..."
|
|
ls -R ~/Library/Developer/Xcode/DerivedData/uuvpn*/Build/Products/ || true
|
|
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
|