Skip to content

Commit 3e109ec

Browse files
add simslim to boost ios sim
1 parent 18adfcc commit 3e109ec

4 files changed

Lines changed: 42 additions & 6 deletions

File tree

.github/scripts/launch-ios-simulator.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ if pgrep -x "Simulator" > /dev/null; then
6565
sleep 2
6666
fi
6767

68+
# `killall Simulator` only closes the UI app; simctl-booted devices keep running.
69+
# Any leftover booted device makes `xcrun simctl <cmd> booted` ambiguous, so shut
70+
# them all down before booting the one we actually want.
71+
BOOTED_DEVICES=$(xcrun simctl list devices --json | \
72+
jq -r '.devices[] | .[] | select(.state == "Booted") | "\(.name) (\(.udid))"')
73+
if [ -n "$BOOTED_DEVICES" ]; then
74+
log_warning "Found booted simulator(s), shutting down for a clean state:"
75+
printf ' %s\n' "$BOOTED_DEVICES"
76+
xcrun simctl shutdown all 2>/dev/null || true
77+
sleep 2
78+
fi
79+
6880
# Find the device UDID
6981
log_info "Finding device UDID for '$DEVICE_NAME' with iOS $OS_VERSION..."
7082

.github/workflows/ios.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,31 @@ jobs:
4747
working-directory: example
4848
run: yarn pod
4949

50+
- name: "Optimize simulator with simslim"
51+
run: |
52+
if ! command -v jq &> /dev/null; then
53+
brew install jq
54+
fi
55+
brew install mobai-app/tap/simslim
56+
57+
# Only optimize the exact device+runtime used for testing (saves ~3-4 min vs
58+
# optimizing all simulators). Several runtimes expose the same device name, so
59+
# both the name AND the OS version must match, otherwise we slim a simulator
60+
# the tests never use.
61+
UDID=$(simslim list --json | jq -r \
62+
--arg name "${{ env.DEVICE_MODEL }}" --arg os "${{ env.IOS_VERSION }}" \
63+
'first(.[] | select(.name == $name and (.osVersion == $os or (.osVersion | startswith($os + ".")))) | .udid) // empty')
64+
65+
if [ -n "$UDID" ]; then
66+
echo "Optimizing ${{ env.DEVICE_MODEL }} (iOS ${{ env.IOS_VERSION }}) - $UDID..."
67+
# --preserve-boot-state leaves the simulator shut down afterwards. The slim
68+
# config persists in launchd overrides, and leaving a second simulator booted
69+
# makes `simctl <cmd> booted` ambiguous in later steps.
70+
simslim --boot-timeout 15m on --preserve-boot-state "$UDID"
71+
else
72+
echo "::warning::${{ env.DEVICE_MODEL }} with iOS ${{ env.IOS_VERSION }} not found, skipping simslim optimization"
73+
fi
74+
5075
# Build iOS app (only if not cached)
5176
- name: Build iOS app for simulator
5277
if: steps.cache-ios-app.outputs.cache-hit != 'true'
@@ -84,4 +109,6 @@ jobs:
84109
# Run tests
85110
- name: Run Harness E2E tests
86111
working-directory: example
87-
run: yarn harness:ios
112+
run: |
113+
export NODE_OPTIONS="--max-old-space-size=6144"
114+
yarn harness:ios

example/ios/MendixNativeExample/AppDelegate.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ class AppDelegate: ReactAppProvider {
1616
bundleUrl: bundleUrl,
1717
runtimeUrl: URL(string: "http://localhost:8081")!,
1818
warningsFilter: .none,
19-
isDeveloperApp: false,
19+
isDeveloperApp: true,
2020
clearDataAtLaunch: false,
2121
splashScreenPresenter: nil,
2222
reactLoading: nil,
2323
enableThreeFingerGestures: false
2424
)
2525

26-
AppPreferences.devModeEnabled = true
27-
AppPreferences.remoteDebuggingEnabled = true
28-
2926
ReactNative.shared.setup(mendixApp, launchOptions: nil)
3027
ReactNative.shared.start()
3128
return super.application(application, didFinishLaunchingWithOptions: launchOptions)

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build:ios": "react-native build-ios --mode Debug",
1111
"pod": "bundle install && bundle exec pod install --project-directory=ios",
1212
"app:package:ios": "xcodebuild -workspace ios/MendixNativeExample.xcworkspace -scheme MendixNativeExample -configuration Debug -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath ios/build build",
13-
"app:install:ios": "xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/MendixNativeExample.app",
13+
"app:install:ios": "xcrun simctl install \"${SIMULATOR_UDID:-booted}\" ios/build/Build/Products/Debug-iphonesimulator/MendixNativeExample.app",
1414
"app:package:android": "(cd android && ./gradlew assembleDebug --no-daemon)",
1515
"app:install:android": "adb install -r android/app/build/outputs/apk/debug/app-debug.apk",
1616
"harness": "react-native-harness --verbose",

0 commit comments

Comments
 (0)