From a911f25a28788483e738ef2778dd37ce79c946ca Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 4 Jul 2026 20:37:32 +0800 Subject: [PATCH] WIP: Add real iOS build steps with Docker-OSX and LFS check --- .github/workflows/build.yml | 95 +++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 372aa9d..b660ee7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -217,25 +217,24 @@ jobs: if: ${{ github.event.inputs.build_ios != 'false' }} steps: - - name: Check KVM support + - name: Install dependencies + run: | + apt-get update && apt-get install -y qemu-utils wget + + - name: Check virtualization support run: | echo "Checking virtualization support..." - ls -la /dev/kvm || echo "KVM not available" - cat /proc/cpuinfo | grep -E "vmx|svm" || echo "No hardware virtualization support" + ls -la /dev/kvm || echo "KVM not available - will use QEMU emulation" + cat /proc/cpuinfo | grep -E "vmx|svm" || echo "No hardware virtualization detected" - - name: Pull macOS Docker image + - name: Download macOS base image run: | - docker pull sickcodes/docker-osx:latest || echo "Failed to pull macOS image" - - - name: Run macOS container (test) - run: | - # This is a test run - full build requires more setup - docker run --rm \ - --privileged \ - -e RAM=8192 \ - -e SMP=4 \ - sickcodes/docker-osx:latest \ - bash -c "echo 'macOS container started'; uname -a" || echo "Docker-OSX requires privileged mode and KVM support" + echo "Downloading macOS base image..." + mkdir -p /tmp/osx + # Use a pre-built macOS image with Xcode + wget -q --show-progress "https://images.sick.codes/osx-kvm/mac_os_x_13_high_sierra.iso" -O /tmp/osx/macos.iso || \ + echo "Download failed - will skip actual build" + ls -la /tmp/osx/ || true - name: Checkout repository uses: actions/checkout@v4 @@ -245,31 +244,57 @@ jobs: - name: Setup Git LFS run: | - if command -v apk &> /dev/null; then - apk add --no-cache git-lfs - else - apt-get update && apt-get install -y git-lfs - fi + apt-get update && apt-get install -y git-lfs git lfs install git config --global lfs.url "https://admin:${{ secrets.GITEA_TOKEN }}@git.viaeon.com/admin/UUVPN.git/info/lfs" - git lfs pull || echo "LFS pull failed" - ls -la iOS-SwiftUI-Code/uuvpn/Libbox.xcframework/ || echo "LFS files not found" + git lfs pull || echo "LFS pull failed - checking if framework exists" + ls -la iOS-SwiftUI-Code/uuvpn/Libbox.xcframework/ || echo "Libbox.xcframework not found" - - name: Build iOS (placeholder) + - name: Check if Libbox framework exists + id: check_lfs run: | - echo "iOS build in Docker-OSX requires:" - echo "1. KVM support on the host" - echo "2. Docker privileged mode" - echo "3. At least 8GB RAM" - echo "4. macOS VM with Xcode installed" + if [ -f "iOS-SwiftUI-Code/uuvpn/Libbox.xcframework/ios-arm64/Libbox.framework/Libbox" ]; then + echo "lfs_ready=true" >> $GITHUB_OUTPUT + echo "LFS files downloaded successfully" + else + echo "lfs_ready=false" >> $GITHUB_OUTPUT + echo "LFS files not available - cannot build iOS" + fi + + - name: Build iOS with Docker-OSX (if LFS ready) + if: ${{ steps.check_lfs.outputs.lfs_ready == 'true' }} + run: | + echo "Starting macOS container for iOS build..." + # Mount repository and build + docker run --rm \ + --privileged \ + -e RAM=8192 \ + -e SMP=4 \ + -v $PWD:/workspace \ + sickcodes/docker-osx:sonoma \ + bash -c " + echo 'Waiting for macOS to boot...' + sleep 60 + echo 'Checking Xcode...' + xcodebuild -version || echo 'Xcode not installed' + echo 'Building iOS app...' + cd /workspace/iOS-SwiftUI-Code + xcodebuild -project uuvpn.xcodeproj -scheme SFI -sdk iphoneos -configuration Debug build + " || echo "Docker-OSX build failed or not available" + + - name: iOS build status + run: | + echo "========================================" + echo "iOS Build Summary" + echo "========================================" + echo "LFS files ready: ${{ steps.check_lfs.outputs.lfs_ready }}" echo "" - echo "Current environment:" - docker info || true - echo "" - echo "To enable iOS builds, either:" - echo "- Add a macOS runner to your Gitea instance" - echo "- Use GitHub Actions hosted macOS runners" - echo "- Configure Docker-OSX with persistent storage" + if [ "${{ steps.check_lfs.outputs.lfs_ready }}" != "true" ]; then + echo "Cannot build iOS without Libbox.xcframework" + echo "Please ensure Gitea LFS is properly configured" + else + echo "Build attempted - check logs above for details" + fi # ==================== 发布到 GitHub Releases ==================== release: