install_prereqs.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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_d6a88994a5ab_key -iv $encrypted_d6a88994a5ab_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. fi
  39. }
  40. case "$PROJECT-$PLATFORM-$METHOD" in
  41. Firebase-iOS-xcodebuild)
  42. gem install xcpretty
  43. bundle exec pod install --project-directory=Example --repo-update
  44. bundle exec pod install --project-directory=Functions/Example
  45. bundle exec pod install --project-directory=GoogleUtilities/Example
  46. install_secrets
  47. ;;
  48. Firebase-*-xcodebuild)
  49. gem install xcpretty
  50. bundle exec pod install --project-directory=Example --repo-update
  51. bundle exec pod install --project-directory=GoogleUtilities/Example
  52. ;;
  53. Database-*)
  54. # Install the workspace to have better control over test runs than
  55. # pod lib lint, since the integration tests can be flaky.
  56. bundle exec pod repo update
  57. bundle exec pod gen FirebaseDatabase.podspec --local-sources=./
  58. install_secrets
  59. ;;
  60. Functions-*)
  61. # Start server for Functions integration tests.
  62. bundle exec pod repo update
  63. ./Functions/Backend/start.sh synchronous
  64. ;;
  65. Messaging-*)
  66. # Install the workspace to have better control over test runs than
  67. # pod lib lint, since the integration tests can be flaky.
  68. bundle exec pod repo update
  69. bundle exec pod gen FirebaseMessaging.podspec --local-sources=./
  70. ;;
  71. Storage-*)
  72. # Install the workspace to have better control over test runs than
  73. # pod lib lint, since the integration tests can be flaky.
  74. bundle exec pod repo update
  75. bundle exec pod gen FirebaseStorage.podspec --local-sources=./
  76. install_secrets
  77. ;;
  78. InAppMessaging-iOS-xcodebuild)
  79. gem install xcpretty
  80. bundle exec pod install --project-directory=InAppMessagingDisplay/Example --repo-update
  81. bundle exec pod install --project-directory=InAppMessaging/Example --repo-update
  82. ;;
  83. Firestore-*-xcodebuild | Firestore-*-fuzz)
  84. gem install xcpretty
  85. bundle exec pod install --project-directory=Firestore/Example --repo-update
  86. ;;
  87. *-pod-lib-lint)
  88. bundle exec pod repo update
  89. ;;
  90. Firestore-*-cmake)
  91. brew outdated cmake || brew upgrade cmake
  92. brew outdated go || brew upgrade go # Somehow the build for Abseil requires this.
  93. # Install python packages required to generate proto sources
  94. pip install six
  95. ;;
  96. SymbolCollision-*-xcodebuild)
  97. gem install xcpretty
  98. bundle exec pod install --project-directory=SymbolCollisionTest --repo-update
  99. ;;
  100. GoogleDataTransport-*-xcodebuild)
  101. gem install xcpretty
  102. bundle exec pod gen GoogleDataTransport.podspec --gen-directory=GoogleDataTransport/gen
  103. ;;
  104. GoogleDataTransportIntegrationTest-*-xcodebuild)
  105. gem install xcpretty
  106. bundle exec pod gen GoogleDataTransport.podspec --gen-directory=GoogleDataTransport/gen
  107. ;;
  108. GoogleDataTransportCCTSupport-*-xcodebuild)
  109. gem install xcpretty
  110. # TODO(mikehaney24): Remove the SpecsStaging repo once GDT is published.
  111. bundle exec pod gen GoogleDataTransportCCTSupport.podspec \
  112. --gen-directory=GoogleDataTransportCCTSupport/gen \
  113. --sources=https://github.com/Firebase/SpecsStaging.git,https://github.com/CocoaPods/Specs.git
  114. ;;
  115. *)
  116. echo "Unknown project-platform-method combo" 1>&2
  117. echo " PROJECT=$PROJECT" 1>&2
  118. echo " PLATFORM=$PLATFORM" 1>&2
  119. echo " METHOD=$METHOD" 1>&2
  120. exit 1
  121. ;;
  122. esac