expo/expo-cli

Allow for expo start -i in CI environments

0618 opened this issue · 1 comments

0618 commented

Summary

The old issue was closed without a resolution. #1597

The problem is still there.

The following is copied from #1597

Expected Behavior

I would expect the iOS app to be able to open on a macOS build runner.

Observed Behavior

When running osascript -e 'tell app "System Events" to count processes whose name is "Simulator"', Apple prompts the user to give permissions like this:

image

In a CI environment, this will time out after a few minutes with the error:

execution error: System Events got an error: AppleEvent timed out. (-1712)

I looked initially to set the permissions through the terminal but Apple's permissions util tccutil only allows clearing perms. In this case System Events needs to be given permission to control Simulator.

Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.3.1
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 18.16.0 - ~/hostedtoolcache/node/18.16.0/x64/bin/node
      Yarn: 1.22.19 - ~/.yarn/bin/yarn
      npm: 9.5.1 - ~/hostedtoolcache/node/18.16.0/x64/bin/npm
      Watchman: 2023.05.08.00 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /usr/local/lib/ruby/gems/3.0.0/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
      Android SDK:
        API Levels: 27, 28, 29, 30, 31, 32, 33, 33, 33
        Build Tools: 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 33.0.1, 33.0.2
        Android NDK: 25.2.[95](https://github.com/0618/amplify-ui/actions/runs/5139315951/jobs/9249624028#step:12:96)1[96](https://github.com/0618/amplify-ui/actions/runs/5139315951/jobs/9249624028#step:12:97)53
    IDEs:
      Xcode: 14.2/14C18 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~48.0.18 => 48.0.19 
      react: 18.2.0 => 18.2.0 
      react-native: 0.71.8 => 0.71.8 
    Expo Workflow: managed

Please specify your device/emulator/simulator platform, model and version

Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1

Error output

node:internal/errors:867
  const err = new Error(message);
              ^

Error: Command failed: osascript -e tell app "System Events" to count processes whose name is "Simulator"
28:69: execution error: System Events got an error: AppleEvent timed out. (-1712)

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:[109](https://github.com/0618/amplify-ui/actions/runs/5139315951/jobs/9249624028#step:14:110)1:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:322:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'osascript -e tell app "System Events" to count processes whose name is "Simulator"'
}

Reproducible demo or steps to reproduce from a blank project

This is specific to GH actions, but using this yml shows the timeout after two minutes.

name: Applescript Test

on: push

jobs:
  applescript-test:
    name: Applescript test
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v1
      - run: osascript -e 'tell app "System Events" to count processes whose name is "Simulator"'

Hi @0618! Thanks for filing the issue, unfortunately this seems to touch on functionality outside of Expo. If you start Expo in "normal" mode, it simply needs to be able to control the simulator.

But, there are other ways to create the bundle or app and run it in CI. E.g. you could use npx expo export --platform android --platform ios to generate a bundle. Or, since you referred to a PR containing tests for React Native Community CLI, you could use npx expo prebuild and use the exact same setup that you have for the RNC CLI with Expo (build from xcode source).

If you disagree or still think this is something we have to support, please open a new issue on github.com/expo/expo.

Hope this helps!