Add a flag to support a simplified iOS test - just compile, don't run packager and tests

Reviewed By: gfosco

Differential Revision: D4690887

fbshipit-source-id: e6299c9146e1ac97a0606f538e9d10539f147a67
This commit is contained in:
Martin Konicek 2017-03-16 15:18:20 -07:00 committed by Facebook Github Bot
parent 3637bce479
commit e1f493ebd2
4 changed files with 21 additions and 5 deletions

View File

@ -17,7 +17,7 @@ install:
- $yarn install - $yarn install
script: script:
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh; fi - if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh test; fi
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait ./scripts/objc-test-tvos.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" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && ./scripts/process-podspecs.sh; fi - if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && ./scripts/process-podspecs.sh; fi

View File

@ -97,7 +97,7 @@ See the following for example usage and integration points:
You can run integration tests locally with cmd+U in the IntegrationTest and UIExplorer apps in Xcode, or by running the following in the command line on macOS: You can run integration tests locally with cmd+U in the IntegrationTest and UIExplorer apps in Xcode, or by running the following in the command line on macOS:
$ cd react-native $ cd react-native
$ ./scripts/objc-test-ios.sh $ ./scripts/objc-test-ios.sh test
> Your Xcode install will come with a variety of Simulators running the latest OS. You may need to manually create a new Simulator to match what the `XCODE_DESTINATION` param in the test script. > Your Xcode install will come with a variety of Simulators running the latest OS. You may need to manually create a new Simulator to match what the `XCODE_DESTINATION` param in the test script.

View File

@ -26,6 +26,12 @@ function cleanup {
} }
trap cleanup INT TERM EXIT trap cleanup INT TERM EXIT
# If first argument is "test", actually start the packager and run tests.
# Otherwise, just build UIExplorer for tvOS and exit
if [ "$1" = "test" ];
then
# Start the packager # Start the packager
(exec "./packager/launchPackager.command" || echo "Can't start packager automatically") & (exec "./packager/launchPackager.command" || echo "Can't start packager automatically") &
(exec "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically") & (exec "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically") &
@ -60,6 +66,7 @@ rm temp.bundle
curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle rm temp.bundle
# Build and test for iOS
# 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.
@ -70,3 +77,13 @@ xcodebuild \
-destination "platform=iOS Simulator,name=iPhone 5s,OS=10.1" \ -destination "platform=iOS Simulator,name=iPhone 5s,OS=10.1" \
build test build test
else
# Only build for iOS (check there are no missing files in the Xcode project)
xcodebuild \
-project "Examples/UIExplorer/UIExplorer.xcodeproj" \
-scheme "UIExplorer" \
-sdk "iphonesimulator" \
build
fi

View File

@ -23,7 +23,7 @@ function cleanup {
} }
trap cleanup EXIT trap cleanup EXIT
# If first argument is "test", actually start the packager and run tests as in the iOS script # If first argument is "test", actually start the packager and run tests.
# Otherwise, just build UIExplorer for tvOS and exit # Otherwise, just build UIExplorer for tvOS and exit
if [ "$1" = "test" ]; if [ "$1" = "test" ];
@ -57,12 +57,11 @@ xcodebuild \
else else
# Build only (no test) for tvOS, to make sure there are no missing files # Only build for tvOS (check there are no missing files in the Xcode project)
xcodebuild \ xcodebuild \
-project "Examples/UIExplorer/UIExplorer.xcodeproj" \ -project "Examples/UIExplorer/UIExplorer.xcodeproj" \
-scheme "UIExplorer-tvOS" \ -scheme "UIExplorer-tvOS" \
-sdk "appletvsimulator" \ -sdk "appletvsimulator" \
-destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=10.1" \
build build
fi fi