Skip to content

Use the PNG Z.ai badge asset #1325

Use the PNG Z.ai badge asset

Use the PNG Z.ai badge asset #1325

Workflow file for this run

name: Mobile App CI
permissions:
contents: read
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-ios:
runs-on: macos-26-xlarge
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-ios
- name: Cache Homebrew
uses: actions/cache@v4
with:
path: |
~/Library/Caches/Homebrew
/opt/homebrew/Cellar/openssl@3
key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/mobile-build.yml') }}
restore-keys: |
${{ runner.os }}-brew-
- name: Cache Xcode DerivedData and SourcePackages
uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-ios-xcode26.2-${{ github.workflow }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
xcode-cache-ios-xcode26.2-${{ github.workflow }}-
xcode-cache-ios-xcode26.2-
- name: Cache Cargo bin (Tauri CLI)
uses: actions/cache@v4
with:
path: ~/.cargo/bin/
key: ${{ runner.os }}-cargo-bin-tauri-cli-2.9.2
restore-keys: |
${{ runner.os }}-cargo-bin-tauri-cli-
${{ runner.os }}-cargo-bin-
- name: Install frontend dependencies
working-directory: ./frontend
run: bun install
- name: Cache ONNX Runtime iOS build
uses: actions/cache@v4
id: cache-onnxruntime
with:
path: |
frontend/src-tauri/onnxruntime-ios
frontend/src-tauri/onnxruntime-build
key: onnxruntime-ios-built-1.22.2-xcode26.2-v1
restore-keys: |
onnxruntime-ios-built-1.22.2-xcode26.2-
- name: Build ONNX Runtime for iOS from source
if: steps.cache-onnxruntime.outputs.cache-hit != 'true'
working-directory: ./frontend/src-tauri
run: |
chmod +x scripts/build-ios-onnxruntime.sh
./scripts/build-ios-onnxruntime.sh 1.22.2
timeout-minutes: 90
- name: Verify ONNX Runtime files
run: |
echo "Checking ONNX Runtime xcframework..."
ls -la ${{ github.workspace }}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/
ls -la ${{ github.workspace }}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64/
echo ""
echo "Library info:"
file ${{ github.workspace }}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64/libonnxruntime.a
echo ""
echo "Checking for Abseil symbols (should be included):"
nm ${{ github.workspace }}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64/libonnxruntime.a 2>/dev/null | grep -i "absl" | head -20 || echo "No abseil symbols found (they may be internal)"
- name: Configure Cargo for iOS ONNX Runtime
run: |
# Create cargo config with absolute paths for iOS builds
# This overrides ort-sys's build script to use our built-from-source library
WORKSPACE="${{ github.workspace }}"
mkdir -p "${WORKSPACE}/frontend/src-tauri/.cargo"
cat > "${WORKSPACE}/frontend/src-tauri/.cargo/config.toml" << EOF
# Auto-generated cargo config for iOS ONNX Runtime linking
# Uses absolute paths because xcodebuild may run cargo from different directories
[target.aarch64-apple-ios.onnxruntime]
rustc-link-search = ["${WORKSPACE}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64"]
# Also link libc++ since ONNX Runtime is C++; overriding ort-sys link metadata
# suppresses the build script's cargo:rustc-link-lib=c++
rustc-link-lib = ["static=onnxruntime", "c++"]
[target.aarch64-apple-ios-sim.onnxruntime]
rustc-link-search = ["${WORKSPACE}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64-simulator"]
rustc-link-lib = ["static=onnxruntime", "c++"]
EOF
echo "Generated cargo config:"
cat "${WORKSPACE}/frontend/src-tauri/.cargo/config.toml"
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.2'
- name: Install Tauri CLI
run: |
if ! command -v cargo-tauri &> /dev/null; then
cargo install tauri-cli --version "2.9.2" --locked
else
echo "Tauri CLI already installed"
fi
env:
# Workaround for getrandom v0.2.16 (https://github.com/rust-random/getrandom/issues/641)
# cargo install builds for the host; on macOS runners target_os is "macos"
CARGO_CFG_TARGET_OS: macos
- name: Set up API Key
run: |
mkdir -p ~/.private_keys
echo "${{ secrets.APPLE_API_PRIVATE_KEY }}" | base64 --decode > ~/.private_keys/AuthKey_${{ secrets.APPLE_API_KEY }}.p8
chmod 600 ~/.private_keys/AuthKey_${{ secrets.APPLE_API_KEY }}.p8
echo "APPLE_API_KEY_PATH=~/.private_keys/AuthKey_${{ secrets.APPLE_API_KEY }}.p8" >> "$GITHUB_ENV"
- name: Build Tauri iOS App
working-directory: ./frontend
run: |
bun tauri ios build --export-method app-store-connect
env:
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_PATH: ${{ env.APPLE_API_KEY_PATH }}
APPLE_DEVELOPMENT_TEAM: ${{ secrets.APPLE_TEAM_ID }}
VITE_OPEN_SECRET_API_URL: https://enclave.trymaple.ai
VITE_MAPLE_BILLING_API_URL: https://billing.opensecret.cloud
VITE_CLIENT_ID: ba5a14b5-d915-47b1-b7b1-afda52bc5fc6
# ONNX Runtime location for ort-sys crate
ORT_LIB_LOCATION: ${{ github.workspace }}/frontend/src-tauri/onnxruntime-ios/onnxruntime.xcframework/ios-arm64
# Ensure Swift bridge code is compiled with iOS 16+ deployment target
# to avoid references to removed swiftCompatibility back-deployment libraries
IPHONEOS_DEPLOYMENT_TARGET: '16.0'
- name: Upload iOS App
uses: actions/upload-artifact@v4
with:
name: maple-ios
path: |
frontend/src-tauri/gen/apple/build/arm64/*.ipa
retention-days: 5
- name: Submit to TestFlight
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
# Find the actual path of the IPA file
IPA_PATH=$(find frontend/src-tauri/gen/apple/build -name "*.ipa" | head -n 1)
echo "Found IPA at: $IPA_PATH"
xcrun altool --upload-app --type ios \
--file "$IPA_PATH" \
--apiKey ${{ secrets.APPLE_API_KEY }} \
--apiIssuer ${{ secrets.APPLE_API_ISSUER }}