144 lines
4.0 KiB
YAML
144 lines
4.0 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-13
|
|
|
|
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: '15.0'
|
|
|
|
- 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 15,OS=latest' \
|
|
-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
|
|
# 查找生成的 .app 文件
|
|
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1)
|
|
if [ -n "$APP_PATH" ]; then
|
|
echo "Found app at: $APP_PATH"
|
|
mkdir -p build
|
|
cp -R "$APP_PATH" build/
|
|
# 创建 zip 文件以便上传
|
|
cd build
|
|
zip -r ios-debug-app.zip *.app
|
|
else
|
|
echo "No .app file found"
|
|
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
|