Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/scripts/launch-ios-simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cmd> 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..."

Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cmd> 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'
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading