install_prereqs.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 && $secrets_installed != true ]]; then
  25. secrets_installed=true
  26. openssl aes-256-cbc -K $encrypted_5dda5f491369_key -iv $encrypted_5dda5f491369_iv \
  27. -in scripts/travis-encrypted/Secrets.tar.enc \
  28. -out scripts/travis-encrypted/Secrets.tar -d
  29. tar xvf scripts/travis-encrypted/Secrets.tar
  30. cp Secrets/Auth/Sample/Application.plist Example/Auth/Sample/Application.plist
  31. cp Secrets/Auth/Sample/AuthCredentials.h Example/Auth/Sample/AuthCredentials.h
  32. cp Secrets/Auth/Sample/GoogleService-Info_multi.plist Example/Auth/Sample/GoogleService-Info_multi.plist
  33. cp Secrets/Auth/Sample/GoogleService-Info.plist Example/Auth/Sample/GoogleService-Info.plist
  34. cp Secrets/Auth/Sample/Sample.entitlements Example/Auth/Sample/Sample.entitlements
  35. cp Secrets/Auth/ApiTests/AuthCredentials.h Example/Auth/ApiTests/AuthCredentials.h
  36. cp Secrets/Storage/App/GoogleService-Info.plist FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  37. cp Secrets/Storage/App/GoogleService-Info.plist Example/Database/App/GoogleService-Info.plist
  38. cp Secrets/Metrics/database.config Metrics/database.config
  39. # Firebase Installations
  40. fis_resources_dir=FirebaseInstallations/Source/Tests/Resources/
  41. mkdir -p "$fis_resources_dir"
  42. cp Secrets/Installations/GoogleService-Info.plist "$fis_resources_dir"
  43. # FirebaseInstanceID
  44. iid_resources_dir=Example/InstanceID/Resources/
  45. mkdir -p "$iid_resources_dir"
  46. cp Secrets/Installations/GoogleService-Info.plist "$iid_resources_dir"
  47. fi
  48. }
  49. if [[ ! -z $QUICKSTART ]]; then
  50. install_secrets
  51. ./scripts/setup_quickstart.sh "$QUICKSTART"
  52. fi
  53. case "$PROJECT-$PLATFORM-$METHOD" in
  54. FirebasePod-iOS-xcodebuild)
  55. gem install xcpretty
  56. bundle exec pod install --project-directory=CoreOnly/Tests/FirebasePodTest --repo-update
  57. ;;
  58. Auth-*)
  59. # Install the workspace for integration testing.
  60. gem install xcpretty
  61. bundle exec pod install --project-directory=Example/Auth/AuthSample --repo-update
  62. ;;
  63. Crashlytics-*)
  64. ;;
  65. Database-*)
  66. ;;
  67. Functions-*)
  68. # Start server for Functions integration tests.
  69. ./Functions/Backend/start.sh synchronous
  70. ;;
  71. Storage-*)
  72. ;;
  73. Installations-*)
  74. install_secrets
  75. ;;
  76. InstanceID*)
  77. install_secrets
  78. ;;
  79. InAppMessaging-*-xcodebuild)
  80. gem install xcpretty
  81. bundle exec pod install --project-directory=FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp --no-repo-update
  82. ;;
  83. Firestore-*-xcodebuild | Firestore-*-fuzz)
  84. if [[ $XCODE_VERSION == "8."* ]]; then
  85. # Firestore still compiles with Xcode 8 to help verify general
  86. # conformance with C++11 by using an older compiler that doesn't have as
  87. # many extensions from later versions of the language. However, Firebase
  88. # as a whole does not support this environment and @available checks in
  89. # GoogleDataTransport would otherwise break this build.
  90. #
  91. # This drops the dependency that adds GoogleDataTransport into
  92. # Firestore's dependencies.
  93. sed -i.bak "/s.dependency 'FirebaseCoreDiagnostics'/d" FirebaseCore.podspec
  94. fi
  95. gem install xcpretty
  96. bundle exec pod install --project-directory=Firestore/Example --repo-update
  97. ;;
  98. *-pod-lib-lint)
  99. ;;
  100. Firestore-*-cmake)
  101. brew outdated cmake || brew upgrade cmake
  102. brew outdated go || brew upgrade go # Somehow the build for Abseil requires this.
  103. brew install ccache
  104. # Install python packages required to generate proto sources
  105. pip install six
  106. ;;
  107. SymbolCollision-*-xcodebuild)
  108. gem install xcpretty
  109. bundle exec pod install --project-directory=SymbolCollisionTest --repo-update
  110. ;;
  111. *)
  112. echo "Unknown project-platform-method combo" 1>&2
  113. echo " PROJECT=$PROJECT" 1>&2
  114. echo " PLATFORM=$PLATFORM" 1>&2
  115. echo " METHOD=$METHOD" 1>&2
  116. exit 1
  117. ;;
  118. esac