|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2021 Google |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | + |
| 18 | +# Build the quickstart. If we're running on the main repo (not a fork), we |
| 19 | +# also run the tests along with the decoded GoogleService-Info.plist files. |
| 20 | + |
| 21 | +set -euo pipefail |
| 22 | + |
| 23 | +# Set have_secrets to true or false. |
| 24 | +have_secrets=false |
| 25 | + |
| 26 | +. ./scripts/check_secrets.sh |
| 27 | + |
| 28 | +if [[ "$have_secrets" == true ]]; then |
| 29 | + xcodebuild \ |
| 30 | + -project "${DIR}/${SAMPLE}Example.xcodeproj" \ |
| 31 | + -scheme "${SAMPLE}Example (${OS})" \ |
| 32 | + -sdk "${PLATFORM}simulator" \ |
| 33 | + -destination "platform=${OS} Simulator,name=${DEVICE}" \ |
| 34 | + build \ |
| 35 | + test \ |
| 36 | + ONLY_ACTIVE_ARCH=YES \ |
| 37 | + OTHER_SWIFT_FLAGS=${SWIFT_DEFINES} \ |
| 38 | + | xcpretty |
| 39 | +else |
| 40 | + # Skip running tests if GoogleService-Info.plist's weren't decoded. |
| 41 | + xcodebuild \ |
| 42 | + -project "${DIR}/${SAMPLE}Example.xcodeproj" \ |
| 43 | + -scheme "${SAMPLE}Example (${OS})" \ |
| 44 | + -sdk "${PLATFORM}simulator" \ |
| 45 | + -destination "platform=${OS} Simulator,name=${DEVICE}" \ |
| 46 | + build \ |
| 47 | + ONLY_ACTIVE_ARCH=YES \ |
| 48 | + OTHER_SWIFT_FLAGS=${SWIFT_DEFINES} \ |
| 49 | + | xcpretty |
| 50 | + echo "Missing secrets: tests did not run." |
| 51 | +fi |
0 commit comments