install_prereqs.sh 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Copyright 2018 Google
  2. #
  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. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Within Travis, installs prerequisites for a build.
  15. # Examines the following configured environment variables that should be
  16. # specified in an env: block
  17. # - PROJECT - Firebase or Firestore
  18. # - METHOD - xcodebuild or cmake; default is xcodebuild
  19. bundle install
  20. function install_secrets() {
  21. # Set up secrets for integration tests and metrics collection. This does not work for pull
  22. # requests from forks. See
  23. # https://docs.travis-ci.com/user/pull-requests#pull-requests-and-security-restrictions
  24. if [[ ! -z $encrypted_d6a88994a5ab_key ]]; then
  25. openssl aes-256-cbc -K $encrypted_3360571ebe7a_key -iv $encrypted_3360571ebe7a_iv \
  26. -in scripts/travis-encrypted/Secrets.tar.enc \
  27. -out scripts/travis-encrypted/Secrets.tar -d
  28. tar xvf scripts/travis-encrypted/Secrets.tar
  29. cp Secrets/Auth/Sample/Application.plist Example/Auth/Sample/Application.plist
  30. cp Secrets/Auth/Sample/AuthCredentials.h Example/Auth/Sample/AuthCredentials.h
  31. cp Secrets/Auth/Sample/GoogleService-Info_multi.plist Example/Auth/Sample/GoogleService-Info_multi.plist
  32. cp Secrets/Auth/Sample/GoogleService-Info.plist Example/Auth/Sample/GoogleService-Info.plist
  33. cp Secrets/Auth/Sample/Sample.entitlements Example/Auth/Sample/Sample.entitlements
  34. cp Secrets/Auth/ApiTests/AuthCredentials.h Example/Auth/ApiTests/AuthCredentials.h
  35. cp Secrets/Storage/App/GoogleService-Info.plist Example/Storage/App/GoogleService-Info.plist
  36. cp Secrets/Storage/App/GoogleService-Info.plist Example/Database/App/GoogleService-Info.plist
  37. cp Secrets/Metrics/database.config Metrics/database.config
  38. # Firebase Installations
  39. fis_resources_dir=FirebaseInstallations/Source/Tests/Resources/
  40. mkdir -p "$fis_resources_dir"
  41. cp Secrets/Installations/GoogleService-Info.plist "$fis_resources_dir"
  42. fi
  43. }
  44. function pod_gen() {
  45. # Call pod gen with a podspec and additonal optional arguments.
  46. bundle exec pod gen --local-sources=./ --sources=https://cdn.cocoapods.org/ "$@"
  47. }
  48. case "$PROJECT-$PLATFORM-$METHOD" in
  49. Firebase-iOS-xcodebuild)
  50. gem install xcpretty
  51. bundle exec pod install --project-directory=Example --repo-update
  52. bundle exec pod install --project-directory=Functions/Example
  53. bundle exec pod install --project-directory=GoogleUtilities/Example
  54. install_secrets
  55. ;;
  56. Firebase-*-xcodebuild)
  57. gem install xcpretty
  58. bundle exec pod install --project-directory=Example --repo-update
  59. bundle exec pod install --project-directory=GoogleUtilities/Example
  60. ;;
  61. Auth-*)
  62. # Install the workspace for integration testing.
  63. gem install xcpretty
  64. bundle exec pod install --project-directory=Example/Auth/AuthSample --repo-update
  65. install_secrets
  66. ;;
  67. Database-*)
  68. # Install the workspace to have better control over test runs than
  69. # pod lib lint, since the integration tests can be flaky.
  70. pod_gen FirebaseDatabase.podspec
  71. install_secrets
  72. ;;
  73. Functions-*)
  74. # Start server for Functions integration tests.
  75. ./Functions/Backend/start.sh synchronous
  76. ;;
  77. Messaging-*)
  78. # Install the workspace to have better control over test runs than
  79. # pod lib lint, since the integration tests can be flaky.
  80. pod_gen FirebaseMessaging.podspec
  81. ;;
  82. Storage-*)
  83. # Install the workspace to have better control over test runs than
  84. # pod lib lint, since the integration tests can be flaky.
  85. pod_gen FirebaseStorage.podspec
  86. install_secrets
  87. ;;
  88. Installations-*)
  89. install_secrets
  90. ;;
  91. InAppMessaging-iOS-xcodebuild)
  92. gem install xcpretty
  93. bundle exec pod install --project-directory=InAppMessagingDisplay/Example --repo-update
  94. bundle exec pod install --project-directory=InAppMessaging/Example --repo-update
  95. ;;
  96. Firestore-*-xcodebuild | Firestore-*-fuzz)
  97. if [[ $XCODE_VERSION == "8."* ]]; then
  98. # Firestore still compiles with Xcode 8 to help verify general
  99. # conformance with C++11 by using an older compiler that doesn't have as
  100. # many extensions from later versions of the language. However, Firebase
  101. # as a whole does not support this environment and @available checks in
  102. # GoogleDataTransport would otherwise break this build.
  103. #
  104. # This drops the dependency that adds GoogleDataTransport into
  105. # Firestore's dependencies.
  106. sed -i.bak "/s.dependency 'FirebaseCoreDiagnostics'/d" FirebaseCore.podspec
  107. fi
  108. gem install xcpretty
  109. bundle exec pod install --project-directory=Firestore/Example --repo-update
  110. ;;
  111. *-pod-lib-lint)
  112. ;;
  113. Firestore-*-cmake)
  114. brew outdated cmake || brew upgrade cmake
  115. brew outdated go || brew upgrade go # Somehow the build for Abseil requires this.
  116. # Install python packages required to generate proto sources
  117. pip install six
  118. ;;
  119. SymbolCollision-*-xcodebuild)
  120. gem install xcpretty
  121. bundle exec pod install --project-directory=SymbolCollisionTest --repo-update
  122. ;;
  123. FirebaseCoreDiagnostics-*-xcodebuild)
  124. gem install xcpretty
  125. pod_gen FirebaseCoreDiagnostics.podspec
  126. ;;
  127. GoogleDataTransport-*-xcodebuild)
  128. gem install xcpretty
  129. pod_gen GoogleDataTransport.podspec
  130. ;;
  131. GoogleDataTransportIntegrationTest-*-xcodebuild)
  132. gem install xcpretty
  133. pod_gen GoogleDataTransport.podspec
  134. ;;
  135. GoogleDataTransportCCTSupport-*-xcodebuild)
  136. gem install xcpretty
  137. pod_gen GoogleDataTransportCCTSupport.podspec
  138. ;;
  139. *)
  140. echo "Unknown project-platform-method combo" 1>&2
  141. echo " PROJECT=$PROJECT" 1>&2
  142. echo " PLATFORM=$PLATFORM" 1>&2
  143. echo " METHOD=$METHOD" 1>&2
  144. exit 1
  145. ;;
  146. esac