From 16d05a62fff4ed4f9f3b498090f4260c8fc6a594 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke <25844542+YogendraShelke@users.noreply.github.com> Date: Wed, 22 Jul 2026 18:33:40 +0530 Subject: [PATCH] add simslim to boost ios sim --- .github/scripts/launch-ios-simulator.sh | 12 ++++++++++ .github/workflows/ios.yml | 29 ++++++++++++++++++++++++- example/package.json | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/scripts/launch-ios-simulator.sh b/.github/scripts/launch-ios-simulator.sh index 0752b82..6269ddc 100755 --- a/.github/scripts/launch-ios-simulator.sh +++ b/.github/scripts/launch-ios-simulator.sh @@ -65,6 +65,18 @@ if pgrep -x "Simulator" > /dev/null; then sleep 2 fi +# `killall Simulator` only closes the UI app; simctl-booted devices keep running. +# Any leftover booted device makes `xcrun simctl booted` ambiguous, so shut +# them all down before booting the one we actually want. +BOOTED_DEVICES=$(xcrun simctl list devices --json | \ + jq -r '.devices[] | .[] | select(.state == "Booted") | "\(.name) (\(.udid))"') +if [ -n "$BOOTED_DEVICES" ]; then + log_warning "Found booted simulator(s), shutting down for a clean state:" + printf ' %s\n' "$BOOTED_DEVICES" + xcrun simctl shutdown all 2>/dev/null || true + sleep 2 +fi + # Find the device UDID log_info "Finding device UDID for '$DEVICE_NAME' with iOS $OS_VERSION..." diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index bae9dc6..9c75c8c 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -47,6 +47,31 @@ jobs: working-directory: example run: yarn pod + - name: "Optimize simulator with simslim" + run: | + if ! command -v jq &> /dev/null; then + brew install jq + fi + brew install mobai-app/tap/simslim + + # Only optimize the exact device+runtime used for testing (saves ~3-4 min vs + # optimizing all simulators). Several runtimes expose the same device name, so + # both the name AND the OS version must match, otherwise we slim a simulator + # the tests never use. + UDID=$(simslim list --json | jq -r \ + --arg name "${{ env.DEVICE_MODEL }}" --arg os "${{ env.IOS_VERSION }}" \ + 'first(.[] | select(.name == $name and (.osVersion == $os or (.osVersion | startswith($os + ".")))) | .udid) // empty') + + if [ -n "$UDID" ]; then + echo "Optimizing ${{ env.DEVICE_MODEL }} (iOS ${{ env.IOS_VERSION }}) - $UDID..." + # --preserve-boot-state leaves the simulator shut down afterwards. The slim + # config persists in launchd overrides, and leaving a second simulator booted + # makes `simctl booted` ambiguous in later steps. + simslim --boot-timeout 15m on --preserve-boot-state "$UDID" + else + echo "::warning::${{ env.DEVICE_MODEL }} with iOS ${{ env.IOS_VERSION }} not found, skipping simslim optimization" + fi + # Build iOS app (only if not cached) - name: Build iOS app for simulator if: steps.cache-ios-app.outputs.cache-hit != 'true' @@ -84,4 +109,6 @@ jobs: # Run tests - name: Run Harness E2E tests working-directory: example - run: yarn harness:ios + run: | + export NODE_OPTIONS="--max-old-space-size=6144" + yarn harness:ios diff --git a/example/package.json b/example/package.json index eafae15..293313a 100644 --- a/example/package.json +++ b/example/package.json @@ -10,7 +10,7 @@ "build:ios": "react-native build-ios --mode Debug", "pod": "bundle install && bundle exec pod install --project-directory=ios", "app:package:ios": "xcodebuild -workspace ios/MendixNativeExample.xcworkspace -scheme MendixNativeExample -configuration Debug -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath ios/build build", - "app:install:ios": "xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/MendixNativeExample.app", + "app:install:ios": "xcrun simctl install \"${SIMULATOR_UDID:-booted}\" ios/build/Build/Products/Debug-iphonesimulator/MendixNativeExample.app", "app:package:android": "(cd android && ./gradlew assembleDebug --no-daemon)", "app:install:android": "adb install -r android/app/build/outputs/apk/debug/app-debug.apk", "harness": "react-native-harness --verbose",