test.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/usr/bin/env bash
  2. # Copyright 2017 Google
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. set -eo pipefail
  13. test_iOS() {
  14. xcodebuild \
  15. -workspace Example/Firebase.xcworkspace \
  16. -scheme AllUnitTests_iOS \
  17. -sdk iphonesimulator \
  18. -destination 'platform=iOS Simulator,name=iPhone 7' \
  19. build \
  20. test \
  21. ONLY_ACTIVE_ARCH=YES \
  22. CODE_SIGNING_REQUIRED=NO \
  23. | xcpretty
  24. }
  25. test_macOS() {
  26. xcodebuild \
  27. -workspace Example/Firebase.xcworkspace \
  28. -scheme AllUnitTests_macOS \
  29. -sdk macosx \
  30. -destination 'platform=OS X,arch=x86_64' \
  31. build \
  32. test \
  33. ONLY_ACTIVE_ARCH=YES \
  34. CODE_SIGNING_REQUIRED=NO \
  35. | xcpretty
  36. }
  37. test_tvOS() {
  38. xcodebuild \
  39. -workspace Example/Firebase.xcworkspace \
  40. -scheme AllUnitTests_tvOS \
  41. -sdk appletvsimulator \
  42. -destination 'platform=tvOS Simulator,name=Apple TV' \
  43. build \
  44. test \
  45. ONLY_ACTIVE_ARCH=YES \
  46. CODE_SIGNING_REQUIRED=NO \
  47. | xcpretty
  48. }
  49. test_iOS; RESULT=$?
  50. if [ $RESULT != 0 ]; then exit $RESULT; fi
  51. test_macOS; RESULT=$?
  52. if [ $RESULT == 65 ]; then
  53. echo "xcodebuild exited with 65, retrying"
  54. sleep 5
  55. test_macOS; RESULT=$?
  56. fi
  57. if [ $RESULT != 0 ]; then exit $RESULT; fi
  58. test_tvOS; RESULT=$?
  59. if [ $RESULT != 0 ]; then exit $RESULT; fi
  60. # Also test Firestore
  61. Firestore/test.sh