From 6304521e92ed860ebccddf3f894a30d4078deaa7 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Mon, 18 May 2026 21:22:07 -0400 Subject: [PATCH] CI: iOS Simulator build workflow (no signing) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 1 of iOS CI. Validates the Mac runner end-to-end with the simplest possible target: an unsigned simulator .app. Runs on the mac-mini-m2 self-hosted runner (label: macos-latest). Mirrors the Linux/Android workflows for the shared prep steps (torch_dart, reown_flutter, bitbox_flutter, monero_c prebuilt bundle, configure, codegen, Trocador secrets), then does flutter build ios --simulator --no-codesign and zips Runner.app. Artifact: hash-wallet-ios-sim-. Unzip on any Apple Silicon Mac, drag Runner.app into Simulator to run. Phase 2 (TestFlight, separate file) follows after Phase 1 is green — adds keychain setup, .p12 + provisioning profile install, ipa build, xcrun altool upload using the App Store Connect API key. All Apple secrets are already configured in Gitea. The 'Inspect iOS targets in monero_c bundle' debug step will reveal which Apple targets the prebuilt bundle ships — we'll need aarch64-apple-ios-sim (or similar) for arm64 simulator builds on M-series Macs. If missing, follow-up will either fetch from a different source or build the iOS .a archives from source via Cake's scripts/ios/ build_*.sh chain (slow but reliable). --- .github/workflows/build-ios-sim.yml | 164 ++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 .github/workflows/build-ios-sim.yml diff --git a/.github/workflows/build-ios-sim.yml b/.github/workflows/build-ios-sim.yml new file mode 100644 index 000000000..31db21bbc --- /dev/null +++ b/.github/workflows/build-ios-sim.yml @@ -0,0 +1,164 @@ +name: Hash Wallet iOS Simulator build + +# Phase 1 of iOS CI: validate the Mac runner end-to-end by producing an +# unsigned simulator .app. Drop the resulting Runner.app into the iOS +# Simulator on any Apple Silicon Mac to verify the app actually compiles +# and launches. +# +# Phase 2 (separate workflow): full TestFlight pipeline with signing. + +on: + push: + branches: [dev, main] + pull_request: + branches: [dev, main] + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: macos-latest + env: + APP_IOS_TYPE: cakewallet + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Show toolchain + run: | + set -x + flutter --version + xcodebuild -version + pod --version + which wget unzip + uname -m + + # ---- External prebuilt deps (same as android/linux) ------------------ + - name: Fetch prebuilt torch_dart + run: | + set -x -e + pushd scripts + rm -rf torch_dart torch_dart.tar.gz + wget -q https://github.com/MrCyjaneK/torch_dart/releases/download/v1.0.17/torch_dart-v1.0.17.tar.gz -O torch_dart.tar.gz + mkdir torch_dart + tar -xzf torch_dart.tar.gz -C torch_dart + rm torch_dart.tar.gz + popd + + - name: Fetch prebuilt reown_flutter + run: | + set -x -e + pushd scripts + rm -rf reown_flutter reown_flutter.tar.gz + wget -q https://github.com/cake-tech/reown_flutter/releases/download/v0.0.4/reown_flutter-v0.0.4.tar.gz -O reown_flutter.tar.gz + mkdir reown_flutter + tar -xzf reown_flutter.tar.gz -C reown_flutter + rm reown_flutter.tar.gz + popd + + - name: Clone BitBox Flutter + run: | + set -x -e + pushd scripts + ./build_bitbox_flutter.sh + popd + + # ---- Native crypto cores (monero_c prebuilt bundle) ------------------ + - name: Fetch prebuilt monero_c bundle + run: | + set -x -e + ./scripts/prepare_moneroc.sh + MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) + mkdir -p "scripts/monero_c/release/$MONERO_C_TAG" + pushd "scripts/monero_c/release/$MONERO_C_TAG" + wget -q https://github.com/MrCyjaneK/monero_c/releases/download/v0.18.4.6-RC1/release-bundle.zip + unzip -q release-bundle.zip + rm release-bundle.zip + echo "=== bundle contents (one level) ===" + ls + popd + + # iOS native lib staging: Cake's scripts/ios/setup.sh + gen_framework.sh + # expect pre-built .a archives in specific paths. The first run will + # likely surface what's missing; we iterate from there. + - name: Inspect iOS targets available in monero_c bundle + run: | + set -x + MONERO_C_TAG=$(cd scripts/monero_c && git describe --tags) + BUNDLE_DIR="scripts/monero_c/release/$MONERO_C_TAG" + # List anything iOS-y + find "$BUNDLE_DIR" -maxdepth 1 -name '*ios*' -o -name '*apple*' 2>/dev/null || true + ls "$BUNDLE_DIR" || true + + # ---- Configure: pubspec.yaml, Info.plist, GeneratedPluginRegistrant --- + - name: Run iOS configure (cakewallet profile) + run: | + set -x -e + pushd scripts/ios + source ./app_env.sh cakewallet + ./app_config.sh + popd + + # ---- Secrets --------------------------------------------------------- + - name: Generate per-module secrets.g.dart files (all empty defaults) + run: dart run tool/generate_new_secrets.dart + + - name: Inject Trocador affiliate secrets + env: + TROCADOR_API_KEY: ${{ secrets.TROCADOR_API_KEY }} + TROCADOR_MONERO_API_KEY: ${{ secrets.TROCADOR_MONERO_API_KEY }} + TROCADOR_EXCHANGE_MARKUP: ${{ secrets.TROCADOR_EXCHANGE_MARKUP }} + run: | + # macOS sed needs '' after -i; Linux sed doesn't accept that. This + # workflow runs on macos only. + sed -i '' \ + -e "s|const trocadorApiKey = '';|const trocadorApiKey = '${TROCADOR_API_KEY}';|" \ + -e "s|const trocadorMoneroApiKey = '';|const trocadorMoneroApiKey = '${TROCADOR_MONERO_API_KEY}';|" \ + -e "s|const trocadorExchangeMarkup = '';|const trocadorExchangeMarkup = '${TROCADOR_EXCHANGE_MARKUP:-1}';|" \ + lib/.secrets.g.dart + grep '^const trocador' lib/.secrets.g.dart + + # ---- Flutter init + codegen ----------------------------------------- + - name: Initialize Flutter SDK (iOS precache) + run: | + flutter --version + flutter precache --ios --no-linux --no-android --no-macos --no-windows --no-fuchsia --no-web || true + + - name: Build generated code (mobx + hive adapters) + run: bash model_generator.sh + + - name: Generate localization + run: dart run tool/generate_localization.dart + + # CocoaPods: the iOS Podfile installs Flutter plugin pods. Required + # before flutter build can link them. + - name: pod install + run: | + cd ios + pod install --repo-update + + # ---- Build iOS Simulator app (no codesign) --------------------------- + - name: Build iOS Simulator app + run: | + set -x -e + flutter build ios --simulator --no-codesign \ + --dart-define-from-file=env.json + ls -la build/ios/iphonesimulator/ + + - name: Zip Runner.app + run: | + cd build/ios/iphonesimulator + zip -r hash_wallet_ios_sim_${{ github.sha }}.zip Runner.app + + - name: Upload .app artifact + uses: actions/upload-artifact@v3 + with: + name: hash-wallet-ios-sim-${{ github.sha }} + path: build/ios/iphonesimulator/hash_wallet_ios_sim_*.zip + retention-days: 14