setup_quickstart.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright 2019 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. # Script to run in a CI `before_install` phase to setup the quickstart repo
  15. # so that it can be used for integration testing.
  16. set -xeuo pipefail
  17. scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  18. root_dir="$(dirname "$scripts_dir")"
  19. $scripts_dir/setup_bundler.sh
  20. # Source function to check if CI secrets are available.
  21. source $scripts_dir/check_secrets.sh
  22. if check_secrets; then
  23. SAMPLE=$1
  24. # Specify repo so the Firebase module and header can be found in a
  25. # development pod install. This is needed for the `pod install` command.
  26. export FIREBASE_POD_REPO_FOR_DEV_POD=`pwd`
  27. git clone https://github.com/firebase/quickstart-ios.git
  28. $scripts_dir/localize_podfile.swift quickstart-ios/"$SAMPLE"/Podfile
  29. cd quickstart-ios/"$SAMPLE"
  30. # To test a branch, uncomment the following line
  31. # git checkout {BRANCH_NAME}
  32. bundle update --bundler
  33. bundle install
  34. bundle exec pod install
  35. # Add GoogleService-Info.plist to Xcode project
  36. ruby ../scripts/info_script.rb "${SAMPLE}"
  37. # Secrets are repo specific, so we need to override with the firebase-ios-sdk
  38. # version. GHA manages the secrets in its action script.
  39. PLIST_FILE=$root_dir/Secrets/quickstart-ios/"$SAMPLE"/GoogleService-Info.plist
  40. if [[ -n "${TRAVIS_PULL_REQUEST:-}" ]]; then
  41. if [[ -f "$PLIST_FILE" ]]; then
  42. cp $root_dir/Secrets/quickstart-ios/"$SAMPLE"/GoogleService-Info.plist ./
  43. cp $root_dir/Secrets/quickstart-ios/TestUtils/FIREGSignInInfo.h ../TestUtils/
  44. if [[ ${SAMPLE} == "DynamicLinks" ]]; then
  45. sed -i '' 's#DYNAMIC_LINK_DOMAIN#https://qpf6m.app.goo.gl#' DynamicLinksExample/DynamicLinksExample.entitlements
  46. sed -i '' 's#YOUR_DOMAIN_URI_PREFIX";#https://qpf6m.app.goo.gl";#' DynamicLinksExample/ViewController.m
  47. elif [[ ${SAMPLE} == "Functions" ]]; then
  48. sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' FunctionsExample/Info.plist
  49. fi
  50. else
  51. cp ../mock-GoogleService-Info.plist ./GoogleService-Info.plist
  52. fi
  53. fi
  54. cd -
  55. fi