Skip to content

Instantly share code, notes, and snippets.

@transitive-bullshit
Created June 19, 2019 18:20
Show Gist options
  • Save transitive-bullshit/b7b000de5eaca24f56a0b91548d1c958 to your computer and use it in GitHub Desktop.
Save transitive-bullshit/b7b000de5eaca24f56a0b91548d1c958 to your computer and use it in GitHub Desktop.
GitLab CI Detox React Native Example
stages:
- E2E
.ios_base:
tags:
- macOS
- swiftlint
cache:
paths:
- node_modules
- ios/vendor
before_script:
- npm i
- cd ios
- bundle install --without=documentation --deployment
Detox:
extends: .ios_base
stage: Detox
variables:
E2E: "true"
tags:
- macOS
- simulator
only:
- merge_requests
before_script:
- xcodebuild -version
- node --version
- brew tap wix/brew > /dev/null 2>&1
- brew install applesimutils > /dev/null 2>&1
- npm i -g npx > /dev/null 2>&1
- rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/haste-*
- rm -rf ios/build
- killall node || echo
- xcrun simctl shutdown all
script:
- E2E=true npm start -- --port 8081 &
- npx detox build > /dev/null 2>&1
- npx detox test --cleanup --loglevel info
- kill -9 $(lsof -n -i4TCP:8081)
after_script:
- xcrun simctl shutdown all
- (if [ "$(lsof -n -i4TCP:8081)" != "" ]; then kill -9 $(lsof -n -i4TCP:8081); else echo "Cleaned"; exit 33; fi);
@transitive-bullshit
Copy link
Author

Some extra useful bits for anyone working on this:

- brew install jq > /dev/null 2>&1
- xcrun simctl boot $(applesimutils --list --byName 'iPhone X' | jq -r '.[0].udid')
- open -a Simulator.app

@hieutrandn9889
Copy link

pls provide the repo for this file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment