setup_quickstart.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. SAMPLE=$1
  23. RELEASE_TESTING=${2-}
  24. # Installations is the only quickstart that doesn't need a real
  25. # GoogleService-Info.plist for its tests.
  26. if check_secrets || [[ ${SAMPLE} == "installations" ]]; then
  27. # Specify repo so the Firebase module and header can be found in a
  28. # development pod install. This is needed for the `pod install` command.
  29. export FIREBASE_POD_REPO_FOR_DEV_POD=`pwd`
  30. git clone https://github.com/firebase/quickstart-ios.git
  31. $scripts_dir/localize_podfile.swift quickstart-ios/"$SAMPLE"/Podfile "$RELEASE_TESTING"
  32. if [ ! -z "$RELEASE_TESTING" ]; then
  33. set +x
  34. sed -i "" '1i\'$'\n'"source 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting.git'"$'\n' quickstart-ios/"$SAMPLE"/Podfile
  35. set -x
  36. echo "Podfile is updated."
  37. fi
  38. cd quickstart-ios/"$SAMPLE"
  39. # To test a branch, uncomment the following line
  40. # git checkout {BRANCH_NAME}
  41. bundle update --bundler
  42. bundle install
  43. if [ ! -z "$RELEASE_TESTING" ]; then
  44. bundle exec pod update --silent
  45. else
  46. bundle exec pod install
  47. fi
  48. # Add GoogleService-Info.plist to Xcode project
  49. ruby ../scripts/info_script.rb "${SAMPLE}"
  50. cd -
  51. fi