Apple TV support 3: Run Travis CI for tvOS in separate script

Summary:
* Motivation

Fix a possible issue with Travis CI by running tvOS tests in a separate script.
Closes https://github.com/facebook/react-native/pull/10268

Differential Revision: D3980775

Pulled By: matryoshcow

fbshipit-source-id: 66dc52f4c0e5c492eb51d53fba209fc25361ce3e
This commit is contained in:
dlowder-salesforce 2016-10-06 03:16:41 -07:00 committed by Facebook Github Bot
parent 467b637656
commit ccea759b71
3 changed files with 56 additions and 29 deletions

View File

@ -16,6 +16,7 @@ install:
script: script:
- if [[ "$TEST_TYPE" = objc ]]; then travis_retry travis_wait ./scripts/objc-test.sh; fi - if [[ "$TEST_TYPE" = objc ]]; then travis_retry travis_wait ./scripts/objc-test.sh; fi
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait ./scripts/objc-test-tvos.sh; fi
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi - if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
- if [[ "$TEST_TYPE" = js ]]; then npm run flow check; fi - if [[ "$TEST_TYPE" = js ]]; then npm run flow check; fi
- if [[ "$TEST_TYPE" = js ]]; then npm test -- --maxWorkers=1; fi - if [[ "$TEST_TYPE" = js ]]; then npm test -- --maxWorkers=1; fi
@ -24,6 +25,7 @@ env:
matrix: matrix:
- TEST_TYPE=e2e-objc - TEST_TYPE=e2e-objc
- TEST_TYPE=objc - TEST_TYPE=objc
- TEST_TYPE=objc-tvos
- TEST_TYPE=js - TEST_TYPE=js
branches: branches:

54
scripts/objc-test-tvos.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
set -ex
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)
cd $ROOT
function cleanup {
EXIT_CODE=$?
set +e
if [ $EXIT_CODE -ne 0 ];
then
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
fi
# kill whatever is occupying port 8081
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
}
trap cleanup EXIT
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
XCODE_SCHEME="UIExplorer-tvOS"
XCODE_SDK="appletvsimulator"
if [ -z "$XCODE_DESTINATION" ]; then
XCODE_DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p,OS=9.2"
fi
# Support for environments without xcpretty installed
set +e
OUTPUT_TOOL=$(which xcpretty)
set -e
# TODO: We use xcodebuild because xctool would stall when collecting info about
# the tests before running them. Switch back when this issue with xctool has
# been resolved.
if [ -z "$OUTPUT_TOOL" ]; then
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test
else
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test | $OUTPUT_TOOL && exit ${PIPESTATUS[0]}
fi

View File

@ -33,35 +33,6 @@ set +e
OUTPUT_TOOL=$(which xcpretty) OUTPUT_TOOL=$(which xcpretty)
set -e set -e
# TODO: We use xcodebuild because xctool would stall when collecting info about
# the tests before running them. Switch back when this issue with xctool has
# been resolved.
if [ -z "$OUTPUT_TOOL" ]; then
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test
else
xcodebuild \
-project $XCODE_PROJECT \
-scheme $XCODE_SCHEME \
-sdk $XCODE_SDK \
-destination "$XCODE_DESTINATION" \
test | $OUTPUT_TOOL
fi
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
XCODE_SCHEME="UIExplorer-tvOS"
XCODE_SDK="appletvsimulator"
XCODE_DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p,OS=9.2"
# Support for environments without xcpretty installed
set +e
OUTPUT_TOOL=$(which xcpretty)
set -e
# TODO: We use xcodebuild because xctool would stall when collecting info about # TODO: We use xcodebuild because xctool would stall when collecting info about
# the tests before running them. Switch back when this issue with xctool has # the tests before running them. Switch back when this issue with xctool has
# been resolved. # been resolved.