diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index e0ceaa0d..be37e1d8 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -88,6 +88,29 @@ jobs: - name: Setup iOS working-directory: ./Samples/SimpleMixpanel/ios run: pod install --repo-update + - name: List available simulators + run: xcrun simctl list devices available + - name: Boot iOS Simulator + run: | + # Get list of available iPhone simulators + # Note: jq is pre-installed on macOS GitHub Actions runners + SIMULATOR_ID=$(xcrun simctl list devices available -j | jq -r '.devices | to_entries[] | .value[] | select(.name | contains("iPhone")) | .udid' | head -n 1) + if [ -z "$SIMULATOR_ID" ]; then + echo "Error: No iPhone simulator found" + exit 1 + fi + echo "Found simulator: $SIMULATOR_ID" + # Check if simulator is already booted + DEVICE_LIST=$(xcrun simctl list devices) + if echo "$DEVICE_LIST" | grep -q "$SIMULATOR_ID.*Booted"; then + echo "Simulator already booted" + else + echo "Booting simulator..." + xcrun simctl boot "$SIMULATOR_ID" + fi + # Verify simulator is booted + echo "Booted simulators:" + xcrun simctl list devices | grep Booted - name: Test iOS working-directory: ./Samples/SimpleMixpanel run: react-native run-ios