setup_quickstart.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. WORKSPACE_DIR="quickstart-ios/${SAMPLE}"
  25. PODFILE="quickstart-ios/"$SAMPLE"/Podfile"
  26. if [[ ! -z "${LEGACY:-}" ]]; then
  27. WORKSPACE_DIR="quickstart-ios/${SAMPLE}/Legacy${SAMPLE}Quickstart"
  28. PODFILE="quickstart-ios/"$SAMPLE"/Legacy${SAMPLE}Quickstart/Podfile"
  29. fi
  30. # Installations is the only quickstart that doesn't need a real
  31. # GoogleService-Info.plist for its tests.
  32. if check_secrets || [[ ${SAMPLE} == "installations" ]]; then
  33. # Specify repo so the Firebase module and header can be found in a
  34. # development pod install. This is needed for the `pod install` command.
  35. export FIREBASE_POD_REPO_FOR_DEV_POD=`pwd`
  36. #TODO: Delete the branch option after the 9.0 release.
  37. git clone --branch v9 https://github.com/firebase/quickstart-ios.git
  38. $scripts_dir/localize_podfile.swift "$WORKSPACE_DIR"/Podfile "$RELEASE_TESTING"
  39. if [ "$RELEASE_TESTING" == "nightly_release_testing" ]; then
  40. set +x
  41. sed -i "" '1i\'$'\n'"source 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting.git'"$'\n' "$PODFILE"
  42. set -x
  43. echo "Source of Podfile for nightly release testing is updated."
  44. fi
  45. if [ "$RELEASE_TESTING" == "prerelease_testing" ]; then
  46. set +x
  47. sed -i "" '1i\'$'\n'"source 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsReleasing.git'"$'\n' "$PODFILE"
  48. set -x
  49. echo "Source of Podfile for prerelease testing is updated."
  50. fi
  51. cd "${WORKSPACE_DIR}"
  52. # To test a branch, uncomment the following line
  53. # git checkout {BRANCH_NAME}
  54. bundle update --bundler
  55. bundle install
  56. pod update
  57. fi