Skip to content

Instantly share code, notes, and snippets.

@majirosstefan
Created September 19, 2021 10:01
Show Gist options
  • Save majirosstefan/efc455ddeb9878feac27034accf66c77 to your computer and use it in GitHub Desktop.
Save majirosstefan/efc455ddeb9878feac27034accf66c77 to your computer and use it in GitHub Desktop.
booting iOS Simulator in Appcenter build pipeline (part of blog post at stefan-majiros.com)
GRACE_TIME=80
APP_ID=org.stefanmajiros.bluepass.prod
echo "Setup iOS Simulator"
echo "Installing iOS Simulator dependencies"
brew tap wix/brew
brew update
brew install applesimutils
echo "Installing pods"
cd ./ios && /usr/local/lib/ruby/gems/2.7.0/bin/pod install --repo-update && cd ..
SIMULATOR_ID=$(xcrun simctl create My-iphone12 com.apple.CoreSimulator.SimDeviceType.iPhone-12 com.apple.CoreSimulator.SimRuntime.iOS-14-4)
echo "Running $SIMULATOR_ID"
echo "Booting simulator $SIMULATOR_ID"
xcrun simctl boot "$SIMULATOR_ID"
echo "Waiting ${GRACE_TIME}s to let it boot the new simulator"
for i in $(seq 1 $GRACE_TIME); do echo -n '.'; sleep 1; done; echo " OK."
echo "Starting logging service"
xcrun simctl spawn booted log stream --debug --predicate 'subsystem == "$APP_ID"' > deviceLog.log &
# echo application logs from React Native to separate file
xcrun simctl spawn booted log stream --debug --predicate 'subsystem == "com.facebook.react.log"' > reactLog.log &
echo "Starting E2E tests"
npm run e2e:ios -- --udid "$SIMULATOR_ID"
xcrun simctl shutdown booted
xcrun simctl delete "$SIMULATOR_ID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment