From c659fcfff6affb51fc4cdae43bf541cc9d7830f8 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 17:13:01 -0400 Subject: [PATCH 01/44] feat(infra): Add script to set up SPM-based quickstarts --- scripts/setup_quickstart_spm.sh | 146 ++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100755 scripts/setup_quickstart_spm.sh diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh new file mode 100755 index 00000000000..09f982596c2 --- /dev/null +++ b/scripts/setup_quickstart_spm.sh @@ -0,0 +1,146 @@ +#!/usr/bin/env bash + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Script to run in a CI `before_install` phase to setup a SPM-based +# quickstart repo so that it can be used for integration testing. + +set -euo pipefail + +if [[ -z "${1:-}" ]]; then + cat < [nightly_release_testing|prerelease_testing] + +This script sets up a quickstart sample for SPM integration testing. + +ARGUMENTS: + The name of the quickstart sample directory (e.g., "authentication"). + +ENVIRONMENT VARIABLES: + QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. + If not set, the script will clone it from GitHub. + Example: QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication + + GHA_WORKFLOW_SECRET: Optional. Set to "true" to bypass the CI secret check for local runs. + Example: GHA_WORKFLOW_SECRET=true $(basename "$0") authentication +EOF + exit 1 +fi + +# Enable trace mode if DEBUG is set to 'true' +if [[ "${DEBUG:-false}" == "true" ]]; then + set -x +fi + +scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +root_dir="$(dirname "$scripts_dir")" + +# Source function to check if CI secrets are available. +source $scripts_dir/check_secrets.sh + +# Arguments: +# SAMPLE: The name of the quickstart sample directory. +# RELEASE_TESTING: Optional. Can be "nightly_release_testing" or "prerelease_testing". +# +# Environment Variable: +# QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. +# If not set, the script will clone it from GitHub. +# Example: +# QUICKSTART_REPO=/path/to/my/quickstart-ios ./scripts/setup_quickstart_spm.sh authentication +SAMPLE=$1 +RELEASE_TESTING=${2-} + +QUICKSTART_PROJECT_DIR="quickstart-ios/${SAMPLE}" + +# TODO: Investigate moving this to a shared prereq script. +if ! gem list -i xcpretty > /dev/null; then + gem install xcpretty +fi + +# Some quickstarts may not need a real GoogleService-Info.plist for their tests. +# When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. +if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ ${SAMPLE} == "installations" ]]; then + + # Use local quickstart repo if QUICKSTART_REPO is set, otherwise clone it. + if [[ -n "${QUICKSTART_REPO:-}" && -d "${QUICKSTART_REPO}" ]]; then + echo "Using local quickstart repository at ${QUICKSTART_REPO}" + QUICKSTART_DIR="${QUICKSTART_REPO}" + else + QUICKSTART_DIR="quickstart-ios" + if [[ -d "${QUICKSTART_DIR}" ]]; then + echo "Quickstart repository already exists at ${QUICKSTART_DIR}" + else + echo "Cloning quickstart repository into '${QUICKSTART_DIR}' directory..." + # Do a partial, sparse clone to speed up CI. See + # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${QUICKSTART_DIR}" + fi + ( + cd "${QUICKSTART_DIR}" + echo "Ensuring sparse checkout is set for ${SAMPLE}..." + # Checkout the sample and config directories. + git sparse-checkout set "${SAMPLE}" config + ) + fi + + QUICKSTART_PROJECT_DIR="${QUICKSTART_DIR}/${SAMPLE}" + + # Find the .xcodeproj file within the sample directory. + # Note: This assumes there is only one .xcodeproj file. + PROJECT_FILE=$(find "$QUICKSTART_PROJECT_DIR" -maxdepth 1 -name "*.xcodeproj" | head -n 1) + if [[ -z "$PROJECT_FILE" ]]; then + echo "Error: Could not find .xcodeproj file in ${QUICKSTART_PROJECT_DIR}" + exit 1 + fi + + # The localization script needs an absolute path to the project file. + # If QUICKSTART_REPO was provided, PROJECT_FILE is already an absolute or user-provided path. + # Otherwise, it's relative to the firebase-ios-sdk root. + if [[ -n "${QUICKSTART_REPO:-}" && -d "${QUICKSTART_REPO}" ]]; then + ABSOLUTE_PROJECT_FILE="$PROJECT_FILE" + else + ABSOLUTE_PROJECT_FILE="$root_dir/$PROJECT_FILE" + fi + + # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of + # the quickstart repo. + # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) + (cd "$QUICKSTART_DIR"; git checkout mc/spm) + + if [ "$RELEASE_TESTING" == "nightly_release_testing" ]; then + # For release testing, find the latest CocoaPods tag. + LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + if [[ -z "$LATEST_TAG" ]]; then + echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." + exit 1 + fi + echo "Setting SPM dependency to latest version: ${LATEST_TAG}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" + + elif [ "$RELEASE_TESTING" == "prerelease_testing" ]; then + # For prerelease testing, point to the tip of the main branch. + echo "Setting SPM dependency to the tip of the main branch." + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease + + else + # For PR testing, point to the current commit. + CURRENT_REVISION=$(git rev-parse HEAD) + echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" + fi + +else + echo "Skipping quickstart setup: CI secrets are not available." +fi From b4a3998995e2f21e9e118220e37fc1e804c9332b Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 17:23:54 -0400 Subject: [PATCH 02/44] doc fixes --- scripts/setup_quickstart_spm.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 09f982596c2..22a4ca1408a 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -21,12 +21,16 @@ set -euo pipefail if [[ -z "${1:-}" ]]; then cat < [nightly_release_testing|prerelease_testing] +Usage: $(basename "$0") [testing_mode] This script sets up a quickstart sample for SPM integration testing. ARGUMENTS: - The name of the quickstart sample directory (e.g., "authentication"). + The name of the quickstart sample directory (e.g., "authentication"). + [testing_mode] Optional. Specifies the testing mode. Can be one of: + - "nightly_release_testing": Points SPM to the latest CocoaPods tag. + - "prerelease_testing": Points SPM to the tip of the main branch. + - (default): Points SPM to the current commit for PR testing. ENVIRONMENT VARIABLES: QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. @@ -50,15 +54,6 @@ root_dir="$(dirname "$scripts_dir")" # Source function to check if CI secrets are available. source $scripts_dir/check_secrets.sh -# Arguments: -# SAMPLE: The name of the quickstart sample directory. -# RELEASE_TESTING: Optional. Can be "nightly_release_testing" or "prerelease_testing". -# -# Environment Variable: -# QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. -# If not set, the script will clone it from GitHub. -# Example: -# QUICKSTART_REPO=/path/to/my/quickstart-ios ./scripts/setup_quickstart_spm.sh authentication SAMPLE=$1 RELEASE_TESTING=${2-} From e289fb84d24f1a62256c16c66077da3c35172e9b Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:03:18 -0400 Subject: [PATCH 03/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 22a4ca1408a..0d185e061af 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -52,7 +52,7 @@ scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root_dir="$(dirname "$scripts_dir")" # Source function to check if CI secrets are available. -source $scripts_dir/check_secrets.sh +source "$scripts_dir/check_secrets.sh" SAMPLE=$1 RELEASE_TESTING=${2-} From 4f3d31b8e15ee3049a0e159834066958ac3d7eee Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:04:14 -0400 Subject: [PATCH 04/44] Update scripts/setup_quickstart_spm.sh --- scripts/setup_quickstart_spm.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 0d185e061af..51e821d124a 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -112,7 +112,6 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ ${SAMPLE} == "installa # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of # the quickstart repo. # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - (cd "$QUICKSTART_DIR"; git checkout mc/spm) if [ "$RELEASE_TESTING" == "nightly_release_testing" ]; then # For release testing, find the latest CocoaPods tag. From cb0236e0bc141d549cd05c9d25a34a6e65c74814 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:04:34 -0400 Subject: [PATCH 05/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 51e821d124a..6e6b904f68e 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -66,7 +66,7 @@ fi # Some quickstarts may not need a real GoogleService-Info.plist for their tests. # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. -if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ ${SAMPLE} == "installations" ]]; then +if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; then # Use local quickstart repo if QUICKSTART_REPO is set, otherwise clone it. if [[ -n "${QUICKSTART_REPO:-}" && -d "${QUICKSTART_REPO}" ]]; then From 43c34e280aac7b8ad746dee948fd117c67803abb Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:06:53 -0400 Subject: [PATCH 06/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 6e6b904f68e..72c1d5ec613 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -113,7 +113,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal # the quickstart repo. # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - if [ "$RELEASE_TESTING" == "nightly_release_testing" ]; then + if [[ "$RELEASE_TESTING" == "nightly_release_testing" ]]; then # For release testing, find the latest CocoaPods tag. LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$LATEST_TAG" ]]; then @@ -123,7 +123,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal echo "Setting SPM dependency to latest version: ${LATEST_TAG}" "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" - elif [ "$RELEASE_TESTING" == "prerelease_testing" ]; then + elif [[ "$RELEASE_TESTING" == "prerelease_testing" ]]; then # For prerelease testing, point to the tip of the main branch. echo "Setting SPM dependency to the tip of the main branch." "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease From b507d892dbf88558b1684a735d2073ac47b21927 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 18:08:53 -0400 Subject: [PATCH 07/44] remove unused --- scripts/setup_quickstart_spm.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 72c1d5ec613..c78e7babec2 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -57,8 +57,6 @@ source "$scripts_dir/check_secrets.sh" SAMPLE=$1 RELEASE_TESTING=${2-} -QUICKSTART_PROJECT_DIR="quickstart-ios/${SAMPLE}" - # TODO: Investigate moving this to a shared prereq script. if ! gem list -i xcpretty > /dev/null; then gem install xcpretty From 2e1431a602ec22932fb7fb18bd0076055a79c1c8 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 18:18:44 -0400 Subject: [PATCH 08/44] refactor constants --- scripts/setup_quickstart_spm.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index c78e7babec2..6985af25dcc 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -19,6 +19,10 @@ set -euo pipefail +# Define testing mode constants. +readonly NIGHTLY_RELEASE_TESTING="nightly_release_testing" +readonly PRERELEASE_TESTING="prerelease_testing" + if [[ -z "${1:-}" ]]; then cat < [testing_mode] @@ -28,8 +32,8 @@ This script sets up a quickstart sample for SPM integration testing. ARGUMENTS: The name of the quickstart sample directory (e.g., "authentication"). [testing_mode] Optional. Specifies the testing mode. Can be one of: - - "nightly_release_testing": Points SPM to the latest CocoaPods tag. - - "prerelease_testing": Points SPM to the tip of the main branch. + - "${NIGHTLY_RELEASE_TESTING}": Points SPM to the latest CocoaPods tag. + - "${PRERELEASE_TESTING}": Points SPM to the tip of the main branch. - (default): Points SPM to the current commit for PR testing. ENVIRONMENT VARIABLES: @@ -111,7 +115,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal # the quickstart repo. # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - if [[ "$RELEASE_TESTING" == "nightly_release_testing" ]]; then + if [[ "$RELEASE_TESTING" == "$NIGHTLY_RELEASE_TESTING" ]]; then # For release testing, find the latest CocoaPods tag. LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$LATEST_TAG" ]]; then @@ -121,7 +125,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal echo "Setting SPM dependency to latest version: ${LATEST_TAG}" "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" - elif [[ "$RELEASE_TESTING" == "prerelease_testing" ]]; then + elif [[ "$RELEASE_TESTING" == "$PRERELEASE_TESTING" ]]; then # For prerelease testing, point to the tip of the main branch. echo "Setting SPM dependency to the tip of the main branch." "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease From dd08b7f8feb54161703e6c2e849336d249f27cb9 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 18:20:27 -0400 Subject: [PATCH 09/44] switch to case --- scripts/setup_quickstart_spm.sh | 46 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 6985af25dcc..87acc361607 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -115,27 +115,31 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal # the quickstart repo. # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - if [[ "$RELEASE_TESTING" == "$NIGHTLY_RELEASE_TESTING" ]]; then - # For release testing, find the latest CocoaPods tag. - LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') - if [[ -z "$LATEST_TAG" ]]; then - echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." - exit 1 - fi - echo "Setting SPM dependency to latest version: ${LATEST_TAG}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" - - elif [[ "$RELEASE_TESTING" == "$PRERELEASE_TESTING" ]]; then - # For prerelease testing, point to the tip of the main branch. - echo "Setting SPM dependency to the tip of the main branch." - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease - - else - # For PR testing, point to the current commit. - CURRENT_REVISION=$(git rev-parse HEAD) - echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" - fi + case "$RELEASE_TESTING" in + "nightly_release_testing") + # For release testing, find the latest CocoaPods tag. + LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + if [[ -z "$LATEST_TAG" ]]; then + echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." + exit 1 + fi + echo "Setting SPM dependency to latest version: ${LATEST_TAG}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" + ;; + + "prerelease_testing") + # For prerelease testing, point to the tip of the main branch. + echo "Setting SPM dependency to the tip of the main branch." + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease + ;; + + *) + # For PR testing, point to the current commit. + CURRENT_REVISION=$(git rev-parse HEAD) + echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" + ;; + esac else echo "Skipping quickstart setup: CI secrets are not available." From e21368cb9cba9bdaaf70d27c14099dec9e211d17 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 18:53:09 -0400 Subject: [PATCH 10/44] review --- scripts/setup_quickstart_spm.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 87acc361607..18e8f3551b1 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -102,13 +102,14 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal exit 1 fi - # The localization script needs an absolute path to the project file. - # If QUICKSTART_REPO was provided, PROJECT_FILE is already an absolute or user-provided path. - # Otherwise, it's relative to the firebase-ios-sdk root. - if [[ -n "${QUICKSTART_REPO:-}" && -d "${QUICKSTART_REPO}" ]]; then - ABSOLUTE_PROJECT_FILE="$PROJECT_FILE" - else + # The update script needs an absolute path to the project file. + if [[ -z "${QUICKSTART_REPO:-}" ]]; then + # When cloning, the project file path is relative to the SDK root. ABSOLUTE_PROJECT_FILE="$root_dir/$PROJECT_FILE" + else + # When using a local repo, the path could be relative to the current + # directory. Resolve it to an absolute path. + ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" fi # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of @@ -135,7 +136,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal *) # For PR testing, point to the current commit. - CURRENT_REVISION=$(git rev-parse HEAD) + CURRENT_REVISION=$(git -C "$root_dir" rev-parse HEAD) echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" ;; From 72e8bf2f7a5dd7a8b637252a644b8f14963599e9 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 19:33:54 -0400 Subject: [PATCH 11/44] fix --- scripts/setup_quickstart_spm.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 18e8f3551b1..257c0dec824 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -70,11 +70,17 @@ fi # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; then - # Use local quickstart repo if QUICKSTART_REPO is set, otherwise clone it. - if [[ -n "${QUICKSTART_REPO:-}" && -d "${QUICKSTART_REPO}" ]]; then + # If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. + if [[ -n "${QUICKSTART_REPO:-}" ]]; then + # If the user provided a path, it must be a valid directory. + if [[ ! -d "${QUICKSTART_REPO}" ]]; then + echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 + exit 1 + fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" QUICKSTART_DIR="${QUICKSTART_REPO}" else + # QUICKSTART_REPO is not set, so clone it. QUICKSTART_DIR="quickstart-ios" if [[ -d "${QUICKSTART_DIR}" ]]; then echo "Quickstart repository already exists at ${QUICKSTART_DIR}" From 8d77513aeb370060254474de0500fefa27458585 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 19:39:25 -0400 Subject: [PATCH 12/44] more --- scripts/setup_quickstart_spm.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 257c0dec824..109a4fe85d9 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -101,12 +101,13 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal QUICKSTART_PROJECT_DIR="${QUICKSTART_DIR}/${SAMPLE}" # Find the .xcodeproj file within the sample directory. - # Note: This assumes there is only one .xcodeproj file. - PROJECT_FILE=$(find "$QUICKSTART_PROJECT_DIR" -maxdepth 1 -name "*.xcodeproj" | head -n 1) - if [[ -z "$PROJECT_FILE" ]]; then - echo "Error: Could not find .xcodeproj file in ${QUICKSTART_PROJECT_DIR}" + # Fail if there isn't exactly one. + PROJECT_FILES=($(find "$QUICKSTART_PROJECT_DIR" -maxdepth 1 -name "*.xcodeproj")) + if [[ ${#PROJECT_FILES[@]} -ne 1 ]]; then + echo "Error: Expected 1 .xcodeproj file in ${QUICKSTART_PROJECT_DIR}, but found ${#PROJECT_FILES[@]}." >&2 exit 1 fi + PROJECT_FILE="${PROJECT_FILES[0]}" # The update script needs an absolute path to the project file. if [[ -z "${QUICKSTART_REPO:-}" ]]; then From 44d276e55da763228969527863b87f0d4ac8f236 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 19:55:28 -0400 Subject: [PATCH 13/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 109a4fe85d9..a6ae78074af 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -135,7 +135,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" ;; - "prerelease_testing") + "${PRERELEASE_TESTING}") # For prerelease testing, point to the tip of the main branch. echo "Setting SPM dependency to the tip of the main branch." "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease From e09127f05ce593b0281c07a2cc1ff77be7e7e2e4 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Fri, 5 Sep 2025 19:55:36 -0400 Subject: [PATCH 14/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index a6ae78074af..e1b383f099d 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -124,7 +124,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) case "$RELEASE_TESTING" in - "nightly_release_testing") + "${NIGHTLY_RELEASE_TESTING}") # For release testing, find the latest CocoaPods tag. LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$LATEST_TAG" ]]; then From c2b6a50751f3d6f267d5c2be07410b13cdd4f6df Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 20:10:38 -0400 Subject: [PATCH 15/44] work --- scripts/setup_quickstart_spm.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index e1b383f099d..4ae1e57c100 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -102,7 +102,12 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal # Find the .xcodeproj file within the sample directory. # Fail if there isn't exactly one. - PROJECT_FILES=($(find "$QUICKSTART_PROJECT_DIR" -maxdepth 1 -name "*.xcodeproj")) + # + # Enable nullglob to ensure the glob expands to an empty list if no files are found. + shopt -s nullglob + PROJECT_FILES=("$QUICKSTART_PROJECT_DIR"/*.xcodeproj) + # Restore default globbing behavior. + shopt -u nullglob if [[ ${#PROJECT_FILES[@]} -ne 1 ]]; then echo "Error: Expected 1 .xcodeproj file in ${QUICKSTART_PROJECT_DIR}, but found ${#PROJECT_FILES[@]}." >&2 exit 1 From ecf5c27d906a14cc5fc6ba001d22bcc58a2fb7e3 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 20:15:51 -0400 Subject: [PATCH 16/44] fix env --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 4ae1e57c100..7e2b6355050 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -41,8 +41,8 @@ ENVIRONMENT VARIABLES: If not set, the script will clone it from GitHub. Example: QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication - GHA_WORKFLOW_SECRET: Optional. Set to "true" to bypass the CI secret check for local runs. - Example: GHA_WORKFLOW_SECRET=true $(basename "$0") authentication + GITHUB_WORKFLOW: Optional. Set to "true" to bypass the CI secret check for local runs. + Example: GITHUB_WORKFLOW=true $(basename "$0") authentication EOF exit 1 fi From 682605b5c344c4de47d84ee0d945a1309dfe66f2 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 20:26:49 -0400 Subject: [PATCH 17/44] careful with xcpretty --- scripts/setup_quickstart_spm.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 7e2b6355050..4da1873d6af 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -61,9 +61,11 @@ source "$scripts_dir/check_secrets.sh" SAMPLE=$1 RELEASE_TESTING=${2-} -# TODO: Investigate moving this to a shared prereq script. -if ! gem list -i xcpretty > /dev/null; then - gem install xcpretty +# Check if the xcpretty command is available in the PATH. +if ! command -v xcpretty >/dev/null 2>&1; then + echo "Error: xcpretty command not found. Please install it." >&2 + echo "You can typically install it using: 'gem install xcpretty' or 'brew install xcpretty'" >&2 + exit 1 fi # Some quickstarts may not need a real GoogleService-Info.plist for their tests. From 19c149fbaded456eb168c83d21693442f0ac7c5f Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 5 Sep 2025 20:41:19 -0400 Subject: [PATCH 18/44] quoting --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 4da1873d6af..82609f5b15d 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -58,8 +58,8 @@ root_dir="$(dirname "$scripts_dir")" # Source function to check if CI secrets are available. source "$scripts_dir/check_secrets.sh" -SAMPLE=$1 -RELEASE_TESTING=${2-} +SAMPLE="$1" +RELEASE_TESTING="${2-}" # Check if the xcpretty command is available in the PATH. if ! command -v xcpretty >/dev/null 2>&1; then From 83d6451c90174cd51b89c81aab152e03f33e642d Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 10:37:05 -0400 Subject: [PATCH 19/44] more fixes --- scripts/check_secrets.sh | 1 - scripts/setup_quickstart_spm.sh | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/check_secrets.sh b/scripts/check_secrets.sh index 4db1540f00c..ea289feb4b4 100755 --- a/scripts/check_secrets.sh +++ b/scripts/check_secrets.sh @@ -17,7 +17,6 @@ # Check if secrets are available for multiple CI's -set -x echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF:-}" echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF:-}" diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 82609f5b15d..b2826d63576 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -70,7 +70,7 @@ fi # Some quickstarts may not need a real GoogleService-Info.plist for their tests. # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. -if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; then +if [[ -n "${QUICKSTART_REPO:-}" ]] || [[ "${GHA_WORKFLOW_SECRET:-}" == "true" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; then # If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. if [[ -n "${QUICKSTART_REPO:-}" ]]; then @@ -117,14 +117,7 @@ if [[ -n "${QUICKSTART_REPO:-}" ]] || check_secrets || [[ "${SAMPLE}" == "instal PROJECT_FILE="${PROJECT_FILES[0]}" # The update script needs an absolute path to the project file. - if [[ -z "${QUICKSTART_REPO:-}" ]]; then - # When cloning, the project file path is relative to the SDK root. - ABSOLUTE_PROJECT_FILE="$root_dir/$PROJECT_FILE" - else - # When using a local repo, the path could be relative to the current - # directory. Resolve it to an absolute path. - ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" - fi + ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of # the quickstart repo. From dcfc811ea44357c97efcefae75f417d281048b1b Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 10:47:32 -0400 Subject: [PATCH 20/44] review --- scripts/setup_quickstart_spm.sh | 156 ++++++++++++++++---------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index b2826d63576..1fc65cdd04d 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -41,8 +41,8 @@ ENVIRONMENT VARIABLES: If not set, the script will clone it from GitHub. Example: QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication - GITHUB_WORKFLOW: Optional. Set to "true" to bypass the CI secret check for local runs. - Example: GITHUB_WORKFLOW=true $(basename "$0") authentication + BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check for local runs. + Example: BYPASS_SECRET_CHECK=true $(basename "$0") authentication EOF exit 1 fi @@ -70,85 +70,85 @@ fi # Some quickstarts may not need a real GoogleService-Info.plist for their tests. # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. -if [[ -n "${QUICKSTART_REPO:-}" ]] || [[ "${GHA_WORKFLOW_SECRET:-}" == "true" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; then +if ! { [[ -n "${QUICKSTART_REPO:-}" ]] || [[ "${BYPASS_SECRET_CHECK:-}" == "true" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; }; then + echo "Skipping quickstart setup: CI secrets are not available." + exit 0 +fi - # If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. - if [[ -n "${QUICKSTART_REPO:-}" ]]; then - # If the user provided a path, it must be a valid directory. - if [[ ! -d "${QUICKSTART_REPO}" ]]; then - echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 - exit 1 - fi - echo "Using local quickstart repository at ${QUICKSTART_REPO}" - QUICKSTART_DIR="${QUICKSTART_REPO}" +# If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. +if [[ -n "${QUICKSTART_REPO:-}" ]]; then + # If the user provided a path, it must be a valid directory. + if [[ ! -d "${QUICKSTART_REPO}" ]]; then + echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 + exit 1 + fi + echo "Using local quickstart repository at ${QUICKSTART_REPO}" + QUICKSTART_DIR="${QUICKSTART_REPO}" +else + # QUICKSTART_REPO is not set, so clone it. + QUICKSTART_DIR="quickstart-ios" + if [[ -d "${QUICKSTART_DIR}" ]]; then + echo "Quickstart repository already exists at ${QUICKSTART_DIR}" else - # QUICKSTART_REPO is not set, so clone it. - QUICKSTART_DIR="quickstart-ios" - if [[ -d "${QUICKSTART_DIR}" ]]; then - echo "Quickstart repository already exists at ${QUICKSTART_DIR}" - else - echo "Cloning quickstart repository into '${QUICKSTART_DIR}' directory..." - # Do a partial, sparse clone to speed up CI. See - # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ - git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${QUICKSTART_DIR}" - fi - ( - cd "${QUICKSTART_DIR}" - echo "Ensuring sparse checkout is set for ${SAMPLE}..." - # Checkout the sample and config directories. - git sparse-checkout set "${SAMPLE}" config - ) + echo "Cloning quickstart repository into '${QUICKSTART_DIR}' directory..." + # Do a partial, sparse clone to speed up CI. See + # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${QUICKSTART_DIR}" fi + ( + cd "${QUICKSTART_DIR}" + echo "Ensuring sparse checkout is set for ${SAMPLE}..." + # Checkout the sample and config directories. + git sparse-checkout set "${SAMPLE}" config + ) +fi - QUICKSTART_PROJECT_DIR="${QUICKSTART_DIR}/${SAMPLE}" - - # Find the .xcodeproj file within the sample directory. - # Fail if there isn't exactly one. - # - # Enable nullglob to ensure the glob expands to an empty list if no files are found. - shopt -s nullglob - PROJECT_FILES=("$QUICKSTART_PROJECT_DIR"/*.xcodeproj) - # Restore default globbing behavior. - shopt -u nullglob - if [[ ${#PROJECT_FILES[@]} -ne 1 ]]; then - echo "Error: Expected 1 .xcodeproj file in ${QUICKSTART_PROJECT_DIR}, but found ${#PROJECT_FILES[@]}." >&2 - exit 1 - fi - PROJECT_FILE="${PROJECT_FILES[0]}" - - # The update script needs an absolute path to the project file. - ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" - - # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of - # the quickstart repo. - # (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - - case "$RELEASE_TESTING" in - "${NIGHTLY_RELEASE_TESTING}") - # For release testing, find the latest CocoaPods tag. - LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') - if [[ -z "$LATEST_TAG" ]]; then - echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." - exit 1 - fi - echo "Setting SPM dependency to latest version: ${LATEST_TAG}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" - ;; - - "${PRERELEASE_TESTING}") - # For prerelease testing, point to the tip of the main branch. - echo "Setting SPM dependency to the tip of the main branch." - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease - ;; - - *) - # For PR testing, point to the current commit. - CURRENT_REVISION=$(git -C "$root_dir" rev-parse HEAD) - echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" - ;; - esac +QUICKSTART_PROJECT_DIR="${QUICKSTART_DIR}/${SAMPLE}" -else - echo "Skipping quickstart setup: CI secrets are not available." +# Find the .xcodeproj file within the sample directory. +# Fail if there isn't exactly one. +# +# Enable nullglob to ensure the glob expands to an empty list if no files are found. +shopt -s nullglob +PROJECT_FILES=("$QUICKSTART_PROJECT_DIR"/*.xcodeproj) +# Restore default globbing behavior. +shopt -u nullglob +if [[ ${#PROJECT_FILES[@]} -ne 1 ]]; then + echo "Error: Expected 1 .xcodeproj file in ${QUICKSTART_PROJECT_DIR}, but found ${#PROJECT_FILES[@]}." >&2 + exit 1 fi +PROJECT_FILE="${PROJECT_FILES[0]}" + +# The update script needs an absolute path to the project file. +ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" + +# NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of +# the quickstart repo. +# (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) + +case "$RELEASE_TESTING" in + "${NIGHTLY_RELEASE_TESTING}") + # For release testing, find the latest CocoaPods tag. + LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + if [[ -z "$LATEST_TAG" ]]; then + echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." + exit 1 + fi + echo "Setting SPM dependency to latest version: ${LATEST_TAG}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" + ;; + + "${PRERELEASE_TESTING}") + # For prerelease testing, point to the tip of the main branch. + echo "Setting SPM dependency to the tip of the main branch." + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease + ;; + + *) + # For PR testing, point to the current commit. + CURRENT_REVISION=$(git -C "$root_dir" rev-parse HEAD) + echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" + ;; +esac + From 529558d5a37b6064e0511d42101472b0855beaac Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 10:55:33 -0400 Subject: [PATCH 21/44] more review --- scripts/setup_quickstart_spm.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 1fc65cdd04d..77757014abe 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -70,7 +70,10 @@ fi # Some quickstarts may not need a real GoogleService-Info.plist for their tests. # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. -if ! { [[ -n "${QUICKSTART_REPO:-}" ]] || [[ "${BYPASS_SECRET_CHECK:-}" == "true" ]] || check_secrets || [[ "${SAMPLE}" == "installations" ]]; }; then +if [[ -z "${QUICKSTART_REPO:-}" ]] && \ + [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ + ! check_secrets && \ + [[ "${SAMPLE}" != "installations" ]]; then echo "Skipping quickstart setup: CI secrets are not available." exit 0 fi @@ -131,7 +134,7 @@ case "$RELEASE_TESTING" in # For release testing, find the latest CocoaPods tag. LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$LATEST_TAG" ]]; then - echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." + echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 fi echo "Setting SPM dependency to latest version: ${LATEST_TAG}" From 0e5c1b1be81b616845853bfe0134a45f9b25202d Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:00:37 -0400 Subject: [PATCH 22/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 77757014abe..7c22a596f42 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -68,8 +68,8 @@ if ! command -v xcpretty >/dev/null 2>&1; then exit 1 fi -# Some quickstarts may not need a real GoogleService-Info.plist for their tests. -# When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. +# Skip setup in CI if secrets are not available. This check is bypassed for local +# runs, if BYPASS_SECRET_CHECK is true, or for samples that don't require secrets. if [[ -z "${QUICKSTART_REPO:-}" ]] && \ [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ ! check_secrets && \ From aafe68122339ca536419c769154303c41d2d598d Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:00:44 -0400 Subject: [PATCH 23/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 7c22a596f42..16923ed7673 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -132,7 +132,7 @@ ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PR case "$RELEASE_TESTING" in "${NIGHTLY_RELEASE_TESTING}") # For release testing, find the latest CocoaPods tag. - LATEST_TAG=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + LATEST_TAG=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$LATEST_TAG" ]]; then echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 From 1fc4bc426c91183bc50fee52dc3eae89701bb976 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 11:10:33 -0400 Subject: [PATCH 24/44] Review --- scripts/setup_quickstart_spm.sh | 266 +++++++++++++++++++------------- 1 file changed, 161 insertions(+), 105 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 16923ed7673..5793ccba0c0 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -23,7 +23,15 @@ set -euo pipefail readonly NIGHTLY_RELEASE_TESTING="nightly_release_testing" readonly PRERELEASE_TESTING="prerelease_testing" -if [[ -z "${1:-}" ]]; then +# All script logic is contained in functions. The main function is called at the end. +# Global variables: +# - readonly constants are defined at the top. +# - scripts_dir and root_dir are set after constants. + +scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +root_dir="$(dirname "$scripts_dir")" + +print_usage() { cat < [testing_mode] @@ -44,114 +52,162 @@ ENVIRONMENT VARIABLES: BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check for local runs. Example: BYPASS_SECRET_CHECK=true $(basename "$0") authentication EOF - exit 1 -fi - -# Enable trace mode if DEBUG is set to 'true' -if [[ "${DEBUG:-false}" == "true" ]]; then - set -x -fi - -scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -root_dir="$(dirname "$scripts_dir")" +} -# Source function to check if CI secrets are available. -source "$scripts_dir/check_secrets.sh" - -SAMPLE="$1" -RELEASE_TESTING="${2-}" - -# Check if the xcpretty command is available in the PATH. -if ! command -v xcpretty >/dev/null 2>&1; then - echo "Error: xcpretty command not found. Please install it." >&2 - echo "You can typically install it using: 'gem install xcpretty' or 'brew install xcpretty'" >&2 - exit 1 -fi - -# Skip setup in CI if secrets are not available. This check is bypassed for local -# runs, if BYPASS_SECRET_CHECK is true, or for samples that don't require secrets. -if [[ -z "${QUICKSTART_REPO:-}" ]] && \ - [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ - ! check_secrets && \ - [[ "${SAMPLE}" != "installations" ]]; then - echo "Skipping quickstart setup: CI secrets are not available." - exit 0 -fi - -# If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. -if [[ -n "${QUICKSTART_REPO:-}" ]]; then - # If the user provided a path, it must be a valid directory. - if [[ ! -d "${QUICKSTART_REPO}" ]]; then - echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 +check_prerequisites() { + # Check if the xcpretty command is available in the PATH. + if ! command -v xcpretty >/dev/null 2>&1; then + echo "Error: xcpretty command not found. Please install it." >&2 + echo "You can typically install it using: 'gem install xcpretty' or 'brew install xcpretty'" >&2 exit 1 fi - echo "Using local quickstart repository at ${QUICKSTART_REPO}" - QUICKSTART_DIR="${QUICKSTART_REPO}" -else - # QUICKSTART_REPO is not set, so clone it. - QUICKSTART_DIR="quickstart-ios" - if [[ -d "${QUICKSTART_DIR}" ]]; then - echo "Quickstart repository already exists at ${QUICKSTART_DIR}" - else - echo "Cloning quickstart repository into '${QUICKSTART_DIR}' directory..." - # Do a partial, sparse clone to speed up CI. See - # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ - git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${QUICKSTART_DIR}" - fi - ( - cd "${QUICKSTART_DIR}" - echo "Ensuring sparse checkout is set for ${SAMPLE}..." - # Checkout the sample and config directories. - git sparse-checkout set "${SAMPLE}" config - ) -fi - -QUICKSTART_PROJECT_DIR="${QUICKSTART_DIR}/${SAMPLE}" - -# Find the .xcodeproj file within the sample directory. -# Fail if there isn't exactly one. +} + +# Clones or locates the quickstart repo. # -# Enable nullglob to ensure the glob expands to an empty list if no files are found. -shopt -s nullglob -PROJECT_FILES=("$QUICKSTART_PROJECT_DIR"/*.xcodeproj) -# Restore default globbing behavior. -shopt -u nullglob -if [[ ${#PROJECT_FILES[@]} -ne 1 ]]; then - echo "Error: Expected 1 .xcodeproj file in ${QUICKSTART_PROJECT_DIR}, but found ${#PROJECT_FILES[@]}." >&2 - exit 1 -fi -PROJECT_FILE="${PROJECT_FILES[0]}" - -# The update script needs an absolute path to the project file. -ABSOLUTE_PROJECT_FILE="$(cd "$(dirname "$PROJECT_FILE")" && pwd)/$(basename "$PROJECT_FILE")" - -# NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of -# the quickstart repo. -# (cd "$QUICKSTART_DIR"; git checkout {BRANCH_NAME}) - -case "$RELEASE_TESTING" in - "${NIGHTLY_RELEASE_TESTING}") - # For release testing, find the latest CocoaPods tag. - LATEST_TAG=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') - if [[ -z "$LATEST_TAG" ]]; then - echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 +# Globals: +# - QUICKSTART_REPO (read-only) +# Arguments: +# - $1: The name of the sample. +# Outputs: +# - Echoes the absolute path to the quickstart directory. +setup_quickstart_repo() { + local sample_name="$1" + local quickstart_dir + + # If QUICKSTART_REPO is set, use it. Otherwise, clone the repo. + if [[ -n "${QUICKSTART_REPO:-}" ]]; then + # If the user provided a path, it must be a valid directory. + if [[ ! -d "${QUICKSTART_REPO}" ]]; then + echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 exit 1 fi - echo "Setting SPM dependency to latest version: ${LATEST_TAG}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --branch "$LATEST_TAG" - ;; - - "${PRERELEASE_TESTING}") - # For prerelease testing, point to the tip of the main branch. - echo "Setting SPM dependency to the tip of the main branch." - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --prerelease - ;; - - *) - # For PR testing, point to the current commit. - CURRENT_REVISION=$(git -C "$root_dir" rev-parse HEAD) - echo "Setting SPM dependency to current revision: ${CURRENT_REVISION}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$ABSOLUTE_PROJECT_FILE" --revision "$CURRENT_REVISION" - ;; -esac + echo "Using local quickstart repository at ${QUICKSTART_REPO}" + quickstart_dir="${QUICKSTART_REPO}" + else + # QUICKSTART_REPO is not set, so clone it. + quickstart_dir="quickstart-ios" + if [[ -d "${quickstart_dir}" ]]; then + echo "Quickstart repository already exists at ${quickstart_dir}" + else + echo "Cloning quickstart repository into '${quickstart_dir}' directory..." + # Do a partial, sparse clone to speed up CI. See + # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ + git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${quickstart_dir}" + fi + ( + cd "${quickstart_dir}" + echo "Ensuring sparse checkout is set for ${sample_name}..." + # Checkout the sample and config directories. + git sparse-checkout set "${sample_name}" config + ) + fi + echo "$quickstart_dir" +} + +# Updates the SPM dependency in the Xcode project based on the testing mode. +# +# Globals: +# - NIGHTLY_RELEASE_TESTING (read-only) +# - PRERELEASE_TESTING (read-only) +# - scripts_dir (read-only) +# - root_dir (read-only) +# Arguments: +# - $1: The testing mode. +# - $2: The absolute path to the .xcodeproj file. +update_spm_dependency() { + local release_testing_mode="$1" + local absolute_project_file="$2" + + case "$release_testing_mode" in + "${NIGHTLY_RELEASE_TESTING}") + # For release testing, find the latest CocoaPods tag. + local latest_tag + latest_tag=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + if [[ -z "$latest_tag" ]]; then + echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 + exit 1 + fi + echo "Setting SPM dependency to latest version: ${latest_tag}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --branch "$latest_tag" + ;; + + "${PRERELEASE_TESTING}") + # For prerelease testing, point to the tip of the main branch. + echo "Setting SPM dependency to the tip of the main branch." + "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --prerelease + ;; + + *) + # For PR testing, point to the current commit. + local current_revision + current_revision=$(git -C "$root_dir" rev-parse HEAD) + echo "Setting SPM dependency to current revision: ${current_revision}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --revision "$current_revision" + ;; + esac +} + +main() { + # --- Argument Parsing --- + if [[ -z "${1:-}" ]]; then + print_usage + exit 1 + fi + + local sample="$1" + local release_testing="${2-}" + + # --- Environment Setup and Validation --- + # Enable trace mode if DEBUG is set to 'true' + if [[ "${DEBUG:-false}" == "true" ]]; then + set -x + fi + + check_prerequisites + + # Source function to check if CI secrets are available. + source "$scripts_dir/check_secrets.sh" + + # Some quickstarts may not need a real GoogleService-Info.plist for their tests. + # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. + if [[ -z "${QUICKSTART_REPO:-}" ]] && \ + [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ + ! check_secrets && \ + [[ "${sample}" != "installations" ]]; then + echo "Skipping quickstart setup: CI secrets are not available." + exit 0 + fi + + # --- Main Logic --- + local quickstart_dir + quickstart_dir=$(setup_quickstart_repo "$sample") + + local quickstart_project_dir="${quickstart_dir}/${sample}" + + # Find the .xcodeproj file within the sample directory. + # Fail if there isn't exactly one. + # Enable nullglob to ensure the glob expands to an empty list if no files are found. + shopt -s nullglob + local project_files=("$quickstart_project_dir"/*.xcodeproj) + # Restore default globbing behavior. + shopt -u nullglob + if [[ ${#project_files[@]} -ne 1 ]]; then + echo "Error: Expected 1 .xcodeproj file in ${quickstart_project_dir}, but found ${#project_files[@]}." >&2 + exit 1 + fi + local project_file="${project_files[0]}" + + # The update script needs an absolute path to the project file. + local absolute_project_file + absolute_project_file="$(cd "$(dirname "$project_file")" && pwd)/$(basename "$project_file")" + + # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of + # the quickstart repo. + # (cd "$quickstart_dir"; git checkout {BRANCH_NAME}) + + update_spm_dependency "$release_testing" "$absolute_project_file" +} +# Run the main function with all provided arguments. +main "$@" \ No newline at end of file From 95b032d30640f96eebfc2dc9cd805020754438a2 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 11:16:00 -0400 Subject: [PATCH 25/44] Remove xcpretty check --- scripts/setup_quickstart_spm.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 5793ccba0c0..bdd6a04217e 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -54,15 +54,6 @@ ENVIRONMENT VARIABLES: EOF } -check_prerequisites() { - # Check if the xcpretty command is available in the PATH. - if ! command -v xcpretty >/dev/null 2>&1; then - echo "Error: xcpretty command not found. Please install it." >&2 - echo "You can typically install it using: 'gem install xcpretty' or 'brew install xcpretty'" >&2 - exit 1 - fi -} - # Clones or locates the quickstart repo. # # Globals: @@ -164,8 +155,6 @@ main() { set -x fi - check_prerequisites - # Source function to check if CI secrets are available. source "$scripts_dir/check_secrets.sh" From cac3c3255ee2433c1e46f5b4337826455bfa640e Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 11:27:34 -0400 Subject: [PATCH 26/44] refactor(scripts): Improve robustness of setup_quickstart_spm.sh This commit incorporates a series of improvements to the Swift Package Manager quickstart setup script based on detailed code review feedback. The key changes include: - Refactored the entire script into functions for better readability and maintainability. - Improved handling of file paths to be more robust against relative paths and different working directories. - Made dependency checks more robust by checking for the command's existence rather than a specific installation method. - Enhanced error handling to provide clearer messages and fail faster. - Corrected inconsistencies in documentation and variable names. - Adhered to shell scripting best practices, such as quoting variable assignments and redirecting error messages to stderr. --- scripts/setup_quickstart_spm.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index bdd6a04217e..851414cf0d9 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -74,7 +74,7 @@ setup_quickstart_repo() { exit 1 fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" - quickstart_dir="${QUICKSTART_REPO}" + quickstart_dir="$(cd "${QUICKSTART_REPO}" && pwd)" else # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" @@ -174,15 +174,20 @@ main() { local quickstart_project_dir="${quickstart_dir}/${sample}" + if [[ ! -d "${quickstart_project_dir}" ]]; then + echo "Error: Sample directory not found at '${quickstart_project_dir}'" >&2 + exit 1 + fi + # Find the .xcodeproj file within the sample directory. # Fail if there isn't exactly one. # Enable nullglob to ensure the glob expands to an empty list if no files are found. shopt -s nullglob - local project_files=("$quickstart_project_dir"/*.xcodeproj) + local project_files=("${quickstart_project_dir}"/*.xcodeproj) # Restore default globbing behavior. shopt -u nullglob if [[ ${#project_files[@]} -ne 1 ]]; then - echo "Error: Expected 1 .xcodeproj file in ${quickstart_project_dir}, but found ${#project_files[@]}." >&2 + echo "Error: Expected 1 .xcodeproj file in '${quickstart_project_dir}', but found ${#project_files[@]}." >&2 exit 1 fi local project_file="${project_files[0]}" From 2194f288dbcda8a8b927ddf58b3e688ec8421553 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:34:12 -0400 Subject: [PATCH 27/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 851414cf0d9..dc684e5db3f 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -114,7 +114,7 @@ update_spm_dependency() { "${NIGHTLY_RELEASE_TESTING}") # For release testing, find the latest CocoaPods tag. local latest_tag - latest_tag=$(git tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + latest_tag=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$latest_tag" ]]; then echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 From 624b41b4267f0594d98350fa1b76404fa25a49d7 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:38:07 -0400 Subject: [PATCH 28/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index dc684e5db3f..75f5559fe3f 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -149,6 +149,14 @@ main() { local sample="$1" local release_testing="${2-}" + if [[ -n "${release_testing}" && \ + "${release_testing}" != "${NIGHTLY_RELEASE_TESTING}" && \ + "${release_testing}" != "${PRERELEASE_TESTING}" ]]; then + echo "Error: Invalid testing_mode: '${release_testing}'" >&2 + print_usage + exit 1 + fi + # --- Environment Setup and Validation --- # Enable trace mode if DEBUG is set to 'true' if [[ "${DEBUG:-false}" == "true" ]]; then From ab9042bcf64173e2b0e709da76252ddbc2e81ed5 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:39:22 -0400 Subject: [PATCH 29/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 75f5559fe3f..504365c9b34 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -93,7 +93,7 @@ setup_quickstart_repo() { git sparse-checkout set "${sample_name}" config ) fi - echo "$quickstart_dir" + cd "$quickstart_dir" && pwd } # Updates the SPM dependency in the Xcode project based on the testing mode. From 614d19fee4cdcdca78180acf7776dc4427d810da Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:42:13 -0400 Subject: [PATCH 30/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 504365c9b34..7ea7ae99e2f 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -120,7 +120,7 @@ update_spm_dependency() { exit 1 fi echo "Setting SPM dependency to latest version: ${latest_tag}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --branch "$latest_tag" + "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --version "$latest_tag" ;; "${PRERELEASE_TESTING}") From a8aa10397dbc4d4d6400aa10a7d54037c5d30495 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:43:53 -0400 Subject: [PATCH 31/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 7ea7ae99e2f..0f9c8f617b4 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -74,7 +74,7 @@ setup_quickstart_repo() { exit 1 fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" - quickstart_dir="$(cd "${QUICKSTART_REPO}" && pwd)" + quickstart_dir="${QUICKSTART_REPO}" else # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" From 123ea0b418f5de97b1b2de5b431e2db814565b51 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 11:53:18 -0400 Subject: [PATCH 32/44] review: --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 0f9c8f617b4..d6316743487 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -73,8 +73,8 @@ setup_quickstart_repo() { echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 exit 1 fi - echo "Using local quickstart repository at ${QUICKSTART_REPO}" - quickstart_dir="${QUICKSTART_REPO}" + echo "Using local quickstart repository at ${QUICKSTART_REPO}" >&2 + quickstart_dir="$(cd "${QUICKSTART_REPO}" && pwd)" else # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" From 271d1f99e8ec8bddec130e919808f5631d56b44e Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 11:58:37 -0400 Subject: [PATCH 33/44] review 1 --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index d6316743487..61602a35e07 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -74,7 +74,7 @@ setup_quickstart_repo() { exit 1 fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" >&2 - quickstart_dir="$(cd "${QUICKSTART_REPO}" && pwd)" + quickstart_dir="${QUICKSTART_REPO}" else # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" @@ -93,7 +93,7 @@ setup_quickstart_repo() { git sparse-checkout set "${sample_name}" config ) fi - cd "$quickstart_dir" && pwd + (cd "$quickstart_dir" && pwd) } # Updates the SPM dependency in the Xcode project based on the testing mode. From 4eb43b3b5c22bb31a3ac2e601fbb120e4904a452 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 12:48:44 -0400 Subject: [PATCH 34/44] more --- scripts/setup_quickstart_spm.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 61602a35e07..835f81f2863 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -79,20 +79,21 @@ setup_quickstart_repo() { # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" if [[ -d "${quickstart_dir}" ]]; then - echo "Quickstart repository already exists at ${quickstart_dir}" + echo "Quickstart repository already exists at ${quickstart_dir}" >&2 else - echo "Cloning quickstart repository into '${quickstart_dir}' directory..." + echo "Cloning quickstart repository into '${quickstart_dir}' directory..." >&2 # Do a partial, sparse clone to speed up CI. See # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${quickstart_dir}" fi ( cd "${quickstart_dir}" - echo "Ensuring sparse checkout is set for ${sample_name}..." + echo "Ensuring sparse checkout is set for ${sample_name}..." >&2 # Checkout the sample and config directories. git sparse-checkout set "${sample_name}" config ) fi + # Return the absolute path to the quickstart directory. (cd "$quickstart_dir" && pwd) } @@ -149,13 +150,18 @@ main() { local sample="$1" local release_testing="${2-}" - if [[ -n "${release_testing}" && \ - "${release_testing}" != "${NIGHTLY_RELEASE_TESTING}" && \ - "${release_testing}" != "${PRERELEASE_TESTING}" ]]; then - echo "Error: Invalid testing_mode: '${release_testing}'" >&2 - print_usage - exit 1 - fi + # Validate release_testing argument. + case "$release_testing" in + "" | "${NIGHTLY_RELEASE_TESTING}" | "${PRERELEASE_TESTING}") + # This is a valid value (or empty), so do nothing. + ;; + *) + # This is an invalid value. + echo "Error: Invalid testing_mode: '${release_testing}'" >&2 + print_usage + exit 1 + ;; + esac # --- Environment Setup and Validation --- # Enable trace mode if DEBUG is set to 'true' @@ -200,15 +206,11 @@ main() { fi local project_file="${project_files[0]}" - # The update script needs an absolute path to the project file. - local absolute_project_file - absolute_project_file="$(cd "$(dirname "$project_file")" && pwd)/$(basename "$project_file")" - # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of # the quickstart repo. # (cd "$quickstart_dir"; git checkout {BRANCH_NAME}) - update_spm_dependency "$release_testing" "$absolute_project_file" + update_spm_dependency "$release_testing" "$project_file" } # Run the main function with all provided arguments. From 3467cfca7630a18fe40a7de18db98ed7dc8d010c Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 12:57:37 -0400 Subject: [PATCH 35/44] review --- scripts/setup_quickstart_spm.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 835f81f2863..55ad060be80 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -49,8 +49,15 @@ ENVIRONMENT VARIABLES: If not set, the script will clone it from GitHub. Example: QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication + QUICKSTART_BRANCH: Optional. The branch to checkout in the quickstart repo. + Defaults to the repo's default branch. + Example: QUICKSTART_BRANCH=my-feature-branch $(basename "$0") authentication + BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check for local runs. Example: BYPASS_SECRET_CHECK=true $(basename "$0") authentication + + DEBUG: Optional. Set to "true" to enable shell trace mode (`set -x`). + Example: DEBUG=true $(basename "$0") authentication EOF } @@ -93,6 +100,17 @@ setup_quickstart_repo() { git sparse-checkout set "${sample_name}" config ) fi + + # If a branch is specified, check it out. + if [[ -n "${QUICKSTART_BRANCH:-}" ]]; then + echo "Checking out quickstart branch: ${QUICKSTART_BRANCH}" >&2 + ( + cd "${quickstart_dir}" + git fetch + git checkout "${QUICKSTART_BRANCH}" + ) + fi + # Return the absolute path to the quickstart directory. (cd "$quickstart_dir" && pwd) } From f4b789ff4df9585014cfa075d8e1e784b890125d Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 13:06:21 -0400 Subject: [PATCH 36/44] work --- scripts/setup_quickstart_spm.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 55ad060be80..d7117ecd2ab 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -224,10 +224,6 @@ main() { fi local project_file="${project_files[0]}" - # NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of - # the quickstart repo. - # (cd "$quickstart_dir"; git checkout {BRANCH_NAME}) - update_spm_dependency "$release_testing" "$project_file" } From 7018c23a9f06d82fc011c83c0027b7de3b267bc7 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 13:17:44 -0400 Subject: [PATCH 37/44] almost done --- scripts/setup_quickstart_spm.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index d7117ecd2ab..275ba15ed45 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -138,8 +138,10 @@ update_spm_dependency() { echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 fi - echo "Setting SPM dependency to latest version: ${latest_tag}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --version "$latest_tag" + local tag_revision + tag_revision=$(git -C "$root_dir" rev-list -n 1 "$latest_tag") + echo "Setting SPM dependency to revision for tag ${latest_tag}: ${tag_revision}" + "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --revision "$tag_revision" ;; "${PRERELEASE_TESTING}") From cb72289c256978abb4956c5db7514f58318e97d9 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:29:45 -0400 Subject: [PATCH 38/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 275ba15ed45..4498404c17d 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -230,4 +230,4 @@ main() { } # Run the main function with all provided arguments. -main "$@" \ No newline at end of file +main "$@" From 081b78f12b92206611f4cfa2acaf075614c6aa31 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:34:47 -0400 Subject: [PATCH 39/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 4498404c17d..27a53a5b38b 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -220,7 +220,7 @@ main() { local project_files=("${quickstart_project_dir}"/*.xcodeproj) # Restore default globbing behavior. shopt -u nullglob - if [[ ${#project_files[@]} -ne 1 ]]; then + if [[ "${#project_files[@]}" -ne 1 ]]; then echo "Error: Expected 1 .xcodeproj file in '${quickstart_project_dir}', but found ${#project_files[@]}." >&2 exit 1 fi From 70c04f151c7f5824ac282f6589ff1c23a4285a1b Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Sat, 6 Sep 2025 22:38:39 -0400 Subject: [PATCH 40/44] Update scripts/setup_quickstart_spm.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/setup_quickstart_spm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 27a53a5b38b..5081d753b11 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -82,6 +82,10 @@ setup_quickstart_repo() { fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" >&2 quickstart_dir="${QUICKSTART_REPO}" + if ! (cd "${quickstart_dir}" && git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + echo "Error: QUICKSTART_REPO ('${quickstart_dir}') is not a git repository." >&2 + exit 1 + fi else # QUICKSTART_REPO is not set, so clone it. quickstart_dir="quickstart-ios" From 5dc35f656da581289f26deb6d86b72d583bdc5ef Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 22:42:35 -0400 Subject: [PATCH 41/44] wrap to 80 --- scripts/setup_quickstart_spm.sh | 64 +++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 5081d753b11..c5c75f37a97 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -23,7 +23,8 @@ set -euo pipefail readonly NIGHTLY_RELEASE_TESTING="nightly_release_testing" readonly PRERELEASE_TESTING="prerelease_testing" -# All script logic is contained in functions. The main function is called at the end. +# All script logic is contained in functions. The main function is called at +# the end. # Global variables: # - readonly constants are defined at the top. # - scripts_dir and root_dir are set after constants. @@ -38,23 +39,30 @@ Usage: $(basename "$0") [testing_mode] This script sets up a quickstart sample for SPM integration testing. ARGUMENTS: - The name of the quickstart sample directory (e.g., "authentication"). + The name of the quickstart sample directory + (e.g., "authentication"). [testing_mode] Optional. Specifies the testing mode. Can be one of: - - "${NIGHTLY_RELEASE_TESTING}": Points SPM to the latest CocoaPods tag. - - "${PRERELEASE_TESTING}": Points SPM to the tip of the main branch. + - "${NIGHTLY_RELEASE_TESTING}": Points SPM to the latest + CocoaPods tag. + - "${PRERELEASE_TESTING}": Points SPM to the tip of the main + branch. - (default): Points SPM to the current commit for PR testing. ENVIRONMENT VARIABLES: QUICKSTART_REPO: Optional. Path to a local clone of the quickstart-ios repo. If not set, the script will clone it from GitHub. - Example: QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication + Example: + QUICKSTART_REPO=/path/to/quickstart-ios $(basename "$0") authentication QUICKSTART_BRANCH: Optional. The branch to checkout in the quickstart repo. Defaults to the repo's default branch. - Example: QUICKSTART_BRANCH=my-feature-branch $(basename "$0") authentication + Example: + QUICKSTART_BRANCH=my-feature-branch $(basename "$0") authentication - BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check for local runs. - Example: BYPASS_SECRET_CHECK=true $(basename "$0") authentication + BYPASS_SECRET_CHECK: Optional. Set to "true" to bypass the CI secret check + for local runs. + Example: + BYPASS_SECRET_CHECK=true $(basename "$0") authentication DEBUG: Optional. Set to "true" to enable shell trace mode (`set -x`). Example: DEBUG=true $(basename "$0") authentication @@ -77,13 +85,16 @@ setup_quickstart_repo() { if [[ -n "${QUICKSTART_REPO:-}" ]]; then # If the user provided a path, it must be a valid directory. if [[ ! -d "${QUICKSTART_REPO}" ]]; then - echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}', but this is not a valid directory." >&2 + echo "Error: QUICKSTART_REPO is set to '${QUICKSTART_REPO}'," \ + "but this is not a valid directory." >&2 exit 1 fi echo "Using local quickstart repository at ${QUICKSTART_REPO}" >&2 quickstart_dir="${QUICKSTART_REPO}" - if ! (cd "${quickstart_dir}" && git rev-parse --is-inside-work-tree >/dev/null 2>&1); then - echo "Error: QUICKSTART_REPO ('${quickstart_dir}') is not a git repository." >&2 + if ! (cd "${quickstart_dir}" && \ + git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + echo "Error: QUICKSTART_REPO ('${quickstart_dir}') is not a git" \ + "repository." >&2 exit 1 fi else @@ -95,7 +106,8 @@ setup_quickstart_repo() { echo "Cloning quickstart repository into '${quickstart_dir}' directory..." >&2 # Do a partial, sparse clone to speed up CI. See # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ - git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${quickstart_dir}" + git clone --filter=blob:none --sparse \ + https://github.com/firebase/quickstart-ios.git "${quickstart_dir}" fi ( cd "${quickstart_dir}" @@ -137,21 +149,25 @@ update_spm_dependency() { "${NIGHTLY_RELEASE_TESTING}") # For release testing, find the latest CocoaPods tag. local latest_tag - latest_tag=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + latest_tag=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | \ + awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') if [[ -z "$latest_tag" ]]; then echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 fi local tag_revision tag_revision=$(git -C "$root_dir" rev-list -n 1 "$latest_tag") - echo "Setting SPM dependency to revision for tag ${latest_tag}: ${tag_revision}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --revision "$tag_revision" + echo "Setting SPM dependency to revision for tag ${latest_tag}:" \ + "${tag_revision}" + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --revision "$tag_revision" ;; "${PRERELEASE_TESTING}") # For prerelease testing, point to the tip of the main branch. echo "Setting SPM dependency to the tip of the main branch." - "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --prerelease + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --prerelease ;; *) @@ -159,7 +175,8 @@ update_spm_dependency() { local current_revision current_revision=$(git -C "$root_dir" rev-parse HEAD) echo "Setting SPM dependency to current revision: ${current_revision}" - "$scripts_dir/update_firebase_spm_dependency.sh" "$absolute_project_file" --revision "$current_revision" + "$scripts_dir/update_firebase_spm_dependency.sh" \ + "$absolute_project_file" --revision "$current_revision" ;; esac } @@ -196,8 +213,9 @@ main() { # Source function to check if CI secrets are available. source "$scripts_dir/check_secrets.sh" - # Some quickstarts may not need a real GoogleService-Info.plist for their tests. - # When QUICKSTART_REPO is set, we are running locally and should skip the secrets check. + # Some quickstarts may not need a real GoogleService-Info.plist for their + # tests. When QUICKSTART_REPO is set, we are running locally and should skip + # the secrets check. if [[ -z "${QUICKSTART_REPO:-}" ]] && \ [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ ! check_secrets && \ @@ -219,13 +237,15 @@ main() { # Find the .xcodeproj file within the sample directory. # Fail if there isn't exactly one. - # Enable nullglob to ensure the glob expands to an empty list if no files are found. + # Enable nullglob to ensure the glob expands to an empty list if no files + # are found. shopt -s nullglob local project_files=("${quickstart_project_dir}"/*.xcodeproj) # Restore default globbing behavior. shopt -u nullglob if [[ "${#project_files[@]}" -ne 1 ]]; then - echo "Error: Expected 1 .xcodeproj file in '${quickstart_project_dir}', but found ${#project_files[@]}." >&2 + echo "Error: Expected 1 .xcodeproj file in" \ + "'${quickstart_project_dir}', but found ${#project_files[@]}." >&2 exit 1 fi local project_file="${project_files[0]}" @@ -234,4 +254,4 @@ main() { } # Run the main function with all provided arguments. -main "$@" +main "$@" \ No newline at end of file From bb322691e766e90f9e20ca0accaf738baf3813bc Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 22:47:31 -0400 Subject: [PATCH 42/44] fix --- scripts/setup_quickstart_spm.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index c5c75f37a97..80d17338a14 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -150,7 +150,7 @@ update_spm_dependency() { # For release testing, find the latest CocoaPods tag. local latest_tag latest_tag=$(git -C "$root_dir" tag -l "CocoaPods-*" --sort=-v:refname | \ - awk '/^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$/ { print; exit }') + grep -E '^CocoaPods-[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) if [[ -z "$latest_tag" ]]; then echo "Error: Could not find a 'CocoaPods-X.Y.Z' tag." >&2 exit 1 @@ -214,8 +214,8 @@ main() { source "$scripts_dir/check_secrets.sh" # Some quickstarts may not need a real GoogleService-Info.plist for their - # tests. When QUICKSTART_REPO is set, we are running locally and should skip - # the secrets check. + # tests. When QUICKSTART_REPO is set (for local runs) or BYPASS_SECRET_CHECK + # is true, the secrets check is skipped. if [[ -z "${QUICKSTART_REPO:-}" ]] && \ [[ "${BYPASS_SECRET_CHECK:-}" != "true" ]] && \ ! check_secrets && \ From fae5d77ce438693a43a2bf33e640221dce68b828 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Sat, 6 Sep 2025 23:23:37 -0400 Subject: [PATCH 43/44] work --- scripts/setup_quickstart_spm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 80d17338a14..39165c085ce 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -112,8 +112,8 @@ setup_quickstart_repo() { ( cd "${quickstart_dir}" echo "Ensuring sparse checkout is set for ${sample_name}..." >&2 - # Checkout the sample and config directories. - git sparse-checkout set "${sample_name}" config + # Checkout the sample directory. + git sparse-checkout set "${sample_name}" ) fi From a8c5dd781fb06552f3dc793b63f6fd59cca66cad Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Thu, 18 Sep 2025 20:35:24 -0400 Subject: [PATCH 44/44] feat(ci): Test SPM quickstarts (#15296) --- .github/workflows/abtesting.yml | 106 ++++---- .github/workflows/auth.yml | 142 +++++------ .github/workflows/common_quickstart.yml | 62 +++-- .github/workflows/crashlytics.yml | 115 +++++---- .github/workflows/database.yml | 94 ++++--- .github/workflows/firestore.yml | 2 +- .github/workflows/inappmessaging.yml | 92 ++++--- .github/workflows/installations.yml | 132 +++++----- .github/workflows/messaging.yml | 326 ++++++++++++------------ .github/workflows/performance.yml | 155 ++++++----- .github/workflows/remoteconfig.yml | 168 ++++++------ .github/workflows/storage.yml | 181 +++++++------ scripts/setup_quickstart_spm.sh | 10 +- scripts/test_quickstart.sh | 8 +- 14 files changed, 783 insertions(+), 810 deletions(-) diff --git a/.github/workflows/abtesting.yml b/.github/workflows/abtesting.yml index 78327c72ca9..f0bcb767404 100644 --- a/.github/workflows/abtesting.yml +++ b/.github/workflows/abtesting.yml @@ -25,70 +25,70 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: ABTestingUnit + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: ABTestingUnit - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseABTesting - target: FirebaseABTesting-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseABTesting + # target: FirebaseABTesting-Unit-unit - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseABTesting + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseABTesting quickstart: uses: ./.github/workflows/common_quickstart.yml with: product: ABTesting - is_legacy: true - setup_command: scripts/setup_quickstart.sh abtesting + is_legacy: false + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh abtesting plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg plist_dst_path: quickstart-ios/database/GoogleService-Info.plist secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - # Don't run on private repo. - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # quickstart-ftl-cron-only: + # # Don't run on private repo. + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Setup quickstart - env: - LEGACY: true - run: scripts/setup_quickstart.sh abtesting - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \ - quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret" - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Build swift quickstart - env: - LEGACY: true - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh ABTesting) - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Setup quickstart + # env: + # LEGACY: true + # run: scripts/setup_quickstart.sh abtesting + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \ + # quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret" + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Build swift quickstart + # env: + # LEGACY: true + # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh ABTesting) + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - abtesting-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseABTesting - platforms: '[ "ios", "tvos", "macos" ]' - flags: '[ "--use-static-frameworks" ]' + # abtesting-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseABTesting + # platforms: '[ "ios", "tvos", "macos" ]' + # flags: '[ "--use-static-frameworks" ]' diff --git a/.github/workflows/auth.yml b/.github/workflows/auth.yml index 0211c7b0589..68b9e6c4c95 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth.yml @@ -29,76 +29,76 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: AuthUnit - buildonly_platforms: macOS + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: AuthUnit + # buildonly_platforms: macOS - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseAuth - target: FirebaseAuth-Unit-unit - buildonly: true + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseAuth + # target: FirebaseAuth-Unit-unit + # buildonly: true - pod_lib_lint: - strategy: - matrix: - product: [FirebaseAuthInterop, FirebaseAuth] - uses: ./.github/workflows/common_cocoapods.yml - with: - product: ${{ matrix.product }} - buildonly_platforms: macOS + # pod_lib_lint: + # strategy: + # matrix: + # product: [FirebaseAuthInterop, FirebaseAuth] + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: ${{ matrix.product }} + # buildonly_platforms: macOS - integration-tests: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - needs: spm - strategy: - matrix: - scheme: [ObjCApiTests, SwiftApiTests, AuthenticationExampleUITests] - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: actions/cache/restore@v4 - with: - path: .build - key: ${{ needs.spm.outputs.cache_key }} - - name: Install Secrets - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthCredentials.h.gpg \ - FirebaseAuth/Tests/SampleSwift/ObjCApiTests/AuthCredentials.h "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/SwiftApplication.plist.gpg \ - FirebaseAuth/Tests/SampleSwift/AuthenticationExample/SwiftApplication.plist "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/AuthCredentials.h.gpg \ - FirebaseAuth/Tests/SampleSwift/AuthCredentials.h "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/GoogleService-Info.plist.gpg \ - FirebaseAuth/Tests/SampleSwift/GoogleService-Info.plist "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/GoogleService-Info_multi.plist.gpg \ - FirebaseAuth/Tests/SampleSwift/GoogleService-Info_multi.plist "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Sample.entitlements.gpg \ - FirebaseAuth/Tests/SampleSwift/Sample.entitlements "$plist_secret" - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Credentials.swift.gpg \ - FirebaseAuth/Tests/SampleSwift/SwiftApiTests/Credentials.swift "$plist_secret" - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: ([ -z $plist_secret ] || scripts/build.sh Auth iOS ${{ matrix.scheme }}) + # integration-tests: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # needs: spm + # strategy: + # matrix: + # scheme: [ObjCApiTests, SwiftApiTests, AuthenticationExampleUITests] + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/cache/restore@v4 + # with: + # path: .build + # key: ${{ needs.spm.outputs.cache_key }} + # - name: Install Secrets + # run: | + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthCredentials.h.gpg \ + # FirebaseAuth/Tests/SampleSwift/ObjCApiTests/AuthCredentials.h "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/SwiftApplication.plist.gpg \ + # FirebaseAuth/Tests/SampleSwift/AuthenticationExample/SwiftApplication.plist "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/AuthCredentials.h.gpg \ + # FirebaseAuth/Tests/SampleSwift/AuthCredentials.h "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/GoogleService-Info.plist.gpg \ + # FirebaseAuth/Tests/SampleSwift/GoogleService-Info.plist "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/GoogleService-Info_multi.plist.gpg \ + # FirebaseAuth/Tests/SampleSwift/GoogleService-Info_multi.plist "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Sample.entitlements.gpg \ + # FirebaseAuth/Tests/SampleSwift/Sample.entitlements "$plist_secret" + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Credentials.swift.gpg \ + # FirebaseAuth/Tests/SampleSwift/SwiftApiTests/Credentials.swift "$plist_secret" + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + # with: + # timeout_minutes: 15 + # max_attempts: 3 + # retry_wait_seconds: 120 + # command: ([ -z $plist_secret ] || scripts/build.sh Auth iOS ${{ matrix.scheme }}) quickstart: uses: ./.github/workflows/common_quickstart.yml with: product: Authentication is_legacy: false - setup_command: scripts/setup_quickstart.sh authentication + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh authentication plist_src_path: scripts/gha-encrypted/qs-authentication.plist.gpg plist_dst_path: quickstart-ios/authentication/GoogleService-Info.plist run_tests: false @@ -134,13 +134,13 @@ jobs: # testapp_dir: quickstart-ios/build-for-testing # test_type: "xctest" - auth-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseAuth - platforms: '[ "ios", "tvos --skip-tests", "macos --skip-tests", "watchos --skip-tests" ]' - flags: '[ "--use-static-frameworks" ]' - setup_command: scripts/configure_test_keychain.sh - secrets: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # auth-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseAuth + # platforms: '[ "ios", "tvos --skip-tests", "macos --skip-tests", "watchos --skip-tests" ]' + # flags: '[ "--use-static-frameworks" ]' + # setup_command: scripts/configure_test_keychain.sh + # secrets: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/common_quickstart.yml b/.github/workflows/common_quickstart.yml index a3f965796ea..ab53c784cb2 100644 --- a/.github/workflows/common_quickstart.yml +++ b/.github/workflows/common_quickstart.yml @@ -44,14 +44,6 @@ on: type: string required: true - # The type of quickstart to test. - # - # Options: [swift, objc] - quickstart_type: - type: string - required: false - default: objc - # Whether to run tests or just build. Defaults to true. run_tests: type: boolean @@ -77,38 +69,44 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + - name: Prereqs + run: gem install xcpretty - name: Xcode run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - name: Run setup command. run: ${{ inputs.setup_command }} - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh \ - ${{ inputs.plist_src_path }} \ - ${{ inputs.plist_dst_path }} \ - "$plist_secret" - - name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }}) + # - name: Install Secret GoogleService-Info.plist + # run: | + # scripts/decrypt_gha_secret.sh \ + # ${{ inputs.plist_src_path }} \ + # ${{ inputs.plist_dst_path }} \ + # "$plist_secret" + - name: Build ${{ inputs.product }} Quickstart (${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }}) uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 with: timeout_minutes: 15 max_attempts: 3 retry_wait_seconds: 120 command: | - scripts/test_quickstart.sh \ - ${{ inputs.product }} \ - ${{ inputs.run_tests }} \ - ${{ inputs.quickstart_type }} + SPM=true DIR=${{ inputs.product }} scripts/test_quickstart.sh ${{ inputs.product }} false +# command: | +# SPM=true DIR=${{ inputs.product }} scripts/test_quickstart.sh ${{ inputs.product }} ${{ inputs.run_tests }} +# scripts/test_quickstart.sh \ +# ${{ inputs.product }} \ +# ${{ inputs.run_tests }} \ +# ${{ inputs.quickstart_type }} + # Failure sequence to upload artifact. - - id: lowercase_product - if: ${{ failure() }} - run: | - lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]') - echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT - - name: Remove data before upload. - if: ${{ failure() }} - run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }} - - uses: actions/upload-artifact@v4 - if: ${{ failure() }} - with: - name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }} - path: quickstart-ios/ + # - id: lowercase_product + # if: ${{ failure() }} + # run: | + # lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]') + # echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT + # - name: Remove data before upload. + # if: ${{ failure() }} + # run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }} + # - uses: actions/upload-artifact@v4 + # if: ${{ failure() }} + # with: + # name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }} + # path: quickstart-ios/ diff --git a/.github/workflows/crashlytics.yml b/.github/workflows/crashlytics.yml index dad83ff1202..9255eec50da 100644 --- a/.github/workflows/crashlytics.yml +++ b/.github/workflows/crashlytics.yml @@ -26,29 +26,28 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: FirebaseCrashlyticsUnit + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: FirebaseCrashlyticsUnit - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseCrashlytics - target: FirebaseCrashlytics-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseCrashlytics + # target: FirebaseCrashlytics-Unit-unit - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseCrashlytics - buildonly_platforms: tvOS, macOS, watchOS + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseCrashlytics + # buildonly_platforms: tvOS, macOS, watchOS quickstart: uses: ./.github/workflows/common_quickstart.yml with: product: Crashlytics is_legacy: true - quickstart_type: swift setup_command: | scripts/setup_quickstart.sh crashlytics mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics @@ -60,48 +59,48 @@ jobs: secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - # Don't run on private repo. - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # quickstart-ftl-cron-only: + # # Don't run on private repo. + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup quickstart - run: scripts/setup_quickstart.sh crashlytics - env: - LEGACY: true - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-crashlytics.plist.gpg \ - quickstart-ios/crashlytics/GoogleService-Info.plist "$plist_secret" - - name: Build swift quickstart - run: | - mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics - # Set the deployed pod location of run and upload-symbols with the development pod version. - cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ - ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Crashlytics swift) - env: - LEGACY: true - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup quickstart + # run: scripts/setup_quickstart.sh crashlytics + # env: + # LEGACY: true + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-crashlytics.plist.gpg \ + # quickstart-ios/crashlytics/GoogleService-Info.plist "$plist_secret" + # - name: Build swift quickstart + # run: | + # mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics + # # Set the deployed pod location of run and upload-symbols with the development pod version. + # cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ + # cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/ + # ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Crashlytics swift) + # env: + # LEGACY: true + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - crashlytics-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseCrashlytics - platforms: '[ "ios", "tvos", "macos", "watchos --skip-tests" ]' - flags: '[ "--use-static-frameworks", "--use-modular-headers --skip-tests" ]' + # crashlytics-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseCrashlytics + # platforms: '[ "ios", "tvos", "macos", "watchos --skip-tests" ]' + # flags: '[ "--use-static-frameworks", "--use-modular-headers --skip-tests" ]' diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index 04396da47ab..b5f63931a42 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -29,67 +29,63 @@ concurrency: cancel-in-progress: true jobs: - spm: - strategy: - matrix: - target: [DatabaseUnit, DatabaseUnitSwift] - uses: ./.github/workflows/common.yml - with: - target: ${{ matrix.target }} + # spm: + # strategy: + # matrix: + # target: [DatabaseUnit, DatabaseUnitSwift] + # uses: ./.github/workflows/common.yml + # with: + # target: ${{ matrix.target }} - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseDatabase - target: FirebaseDatabase-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseDatabase + # target: FirebaseDatabase-Unit-unit - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseDatabase - test_specs: unit - buildonly_platforms: macOS + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseDatabase + # test_specs: unit + # buildonly_platforms: macOS - integration: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: integration${{ matrix.os }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install xcpretty - run: gem install xcpretty - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: IntegrationTest - # Only iOS to mitigate flakes. - run: scripts/third_party/travis/retry.sh scripts/build.sh Database iOS integration + # integration: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: integration${{ matrix.os }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install xcpretty + # run: gem install xcpretty + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: IntegrationTest + # # Only iOS to mitigate flakes. + # run: scripts/third_party/travis/retry.sh scripts/build.sh Database iOS integration quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Database is_legacy: false - setup_command: scripts/setup_quickstart.sh database + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh database plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg plist_dst_path: quickstart-ios/database/GoogleService-Info.plist - quickstart_type: ${{ matrix.quickstart_type }} run_tests: false secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - database-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseDatabase - platforms: '[ "ios", "tvos", "macos" ]' - flags: '[ "--skip-tests --use-static-frameworks" ]' + # database-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseDatabase + # platforms: '[ "ios", "tvos", "macos" ]' + # flags: '[ "--skip-tests --use-static-frameworks" ]' diff --git a/.github/workflows/firestore.yml b/.github/workflows/firestore.yml index 2a935f81fa0..61dc1ed3d3f 100644 --- a/.github/workflows/firestore.yml +++ b/.github/workflows/firestore.yml @@ -605,7 +605,7 @@ jobs: # with: # product: Firestore # is_legacy: true - # setup_command: scripts/setup_quickstart.sh firestore + # setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh firestore # plist_src_path: scripts/gha-encrypted/qs-firestore.plist.gpg # plist_dst_path: quickstart-ios/firestore/GoogleService-Info.plist # run_tests: false diff --git a/.github/workflows/inappmessaging.yml b/.github/workflows/inappmessaging.yml index d0633743721..7727502c2eb 100644 --- a/.github/workflows/inappmessaging.yml +++ b/.github/workflows/inappmessaging.yml @@ -24,64 +24,60 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: FirebaseInAppMessaging-Beta - platforms: iOS - buildonly_platforms: iOS + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: FirebaseInAppMessaging-Beta + # platforms: iOS + # buildonly_platforms: iOS - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseInAppMessaging - platforms: iOS, tvOS + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseInAppMessaging + # platforms: iOS, tvOS - tests: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # tests: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' -# TODO(#12770): Update to macos-14 when tests are updated for Xcode 15. - runs-on: macos-15 - strategy: - matrix: -# TODO(#8682): Reenable iPad after fixing Xcode 13 test failures. -# platform: [iOS, iPad] - platform: [iOS] - xcode: [Xcode_16.4] - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: ${{ matrix.platform }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Xcode - run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - - name: Prereqs - run: scripts/install_prereqs.sh InAppMessaging ${{ matrix.platform }} xcodebuild - - name: Build and test - run: scripts/third_party/travis/retry.sh scripts/build.sh InAppMessaging ${{ matrix.platform }} xcodebuild + # # TODO(#12770): Update to macos-14 when tests are updated for Xcode 15. + # runs-on: macos-15 + # strategy: + # matrix: + # # TODO(#8682): Reenable iPad after fixing Xcode 13 test failures. + # # platform: [iOS, iPad] + # platform: [iOS] + # xcode: [Xcode_16.4] + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: ${{ matrix.platform }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Xcode + # run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer + # - name: Prereqs + # run: scripts/install_prereqs.sh InAppMessaging ${{ matrix.platform }} xcodebuild + # - name: Build and test + # run: scripts/third_party/travis/retry.sh scripts/build.sh InAppMessaging ${{ matrix.platform }} xcodebuild - fiam-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseInAppMessaging - platforms: '[ "ios", "tvos" ]' - flags: '[ "--use-static-frameworks" ]' + # fiam-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseInAppMessaging + # platforms: '[ "ios", "tvos" ]' + # flags: '[ "--use-static-frameworks" ]' quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: InAppMessaging is_legacy: false - quickstart_type: ${{ matrix.quickstart_type }} - setup_command: scripts/setup_quickstart.sh inappmessaging + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh inappmessaging plist_src_path: scripts/gha-encrypted/qs-inappmessaging.plist.gpg plist_dst_path: quickstart-ios/inappmessaging/GoogleService-Info.plist secrets: diff --git a/.github/workflows/installations.yml b/.github/workflows/installations.yml index ff7fde15883..9850bb751b3 100644 --- a/.github/workflows/installations.yml +++ b/.github/workflows/installations.yml @@ -24,86 +24,82 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: FirebaseInstallations - buildonly_platforms: all + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: FirebaseInstallations + # buildonly_platforms: all - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseInstallations - target: FirebaseInstallations-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseInstallations + # target: FirebaseInstallations-Unit-unit - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseInstallations - setup_command: | - scripts/configure_test_keychain.sh - mkdir -p FirebaseInstallations/Source/Tests/Resources - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg \ - FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist "$plist_secret" - echo "FIS_INTEGRATION_TESTS_REQUIRED=1" >> $GITHUB_ENV - secrets: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseInstallations + # setup_command: | + # scripts/configure_test_keychain.sh + # mkdir -p FirebaseInstallations/Source/Tests/Resources + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg \ + # FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist "$plist_secret" + # echo "FIS_INTEGRATION_TESTS_REQUIRED=1" >> $GITHUB_ENV + # secrets: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Installations is_legacy: false - setup_command: scripts/setup_quickstart.sh installations + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh installations plist_src_path: scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg plist_dst_path: quickstart-ios/installations/GoogleService-Info.plist - quickstart_type: ${{ matrix.quickstart_type }} secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - # Don't run on private repo. - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # quickstart-ftl-cron-only: + # # Don't run on private repo. + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup quickstart - run: scripts/setup_quickstart.sh installations - - name: Copy mock plist - run: cp quickstart-ios/mock-GoogleService-Info.plist quickstart-ios/installations/GoogleService-Info.plist - - name: Build objc quickstart - run: scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Installations - - name: Build swift quickstart - run: scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Installations swift - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup quickstart + # run: scripts/setup_quickstart.sh installations + # - name: Copy mock plist + # run: cp quickstart-ios/mock-GoogleService-Info.plist quickstart-ios/installations/GoogleService-Info.plist + # - name: Build objc quickstart + # run: scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Installations + # - name: Build swift quickstart + # run: scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Installations swift + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - installations-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseInstallations - platforms: '[ "ios", "tvos", "macos" ]' - flags: '[ "--use-static-frameworks" ]' - setup_command: | - scripts/configure_test_keychain.sh - mkdir -p FirebaseInstallations/Source/Tests/Resources - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg \ - FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist "$plist_secret" - echo "FIS_INTEGRATION_TESTS_REQUIRED=1" >> $GITHUB_ENV - secrets: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # installations-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseInstallations + # platforms: '[ "ios", "tvos", "macos" ]' + # flags: '[ "--use-static-frameworks" ]' + # setup_command: | + # scripts/configure_test_keychain.sh + # mkdir -p FirebaseInstallations/Source/Tests/Resources + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Installations/GoogleService-Info.plist.gpg \ + # FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist "$plist_secret" + # echo "FIS_INTEGRATION_TESTS_REQUIRED=1" >> $GITHUB_ENV + # secrets: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} diff --git a/.github/workflows/messaging.yml b/.github/workflows/messaging.yml index 993cfb543dd..1cf540ecfee 100644 --- a/.github/workflows/messaging.yml +++ b/.github/workflows/messaging.yml @@ -32,188 +32,184 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: MessagingUnit - buildonly_platforms: tvOS, macOS, watchOS, catalyst, visionOS + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: MessagingUnit + # buildonly_platforms: tvOS, macOS, watchOS, catalyst, visionOS - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseMessaging - target: FirebaseMessaging-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseMessaging + # target: FirebaseMessaging-Unit-unit - pod_lib_lint: - strategy: - matrix: - product: [FirebaseMessagingInterop, FirebaseMessaging] - uses: ./.github/workflows/common_cocoapods.yml - with: - product: ${{ matrix.product }} + # pod_lib_lint: + # strategy: + # matrix: + # product: [FirebaseMessagingInterop, FirebaseMessaging] + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: ${{ matrix.product }} - # TODO(#12205) Update the build.sh script for this job from "test" instead of "build" - messaging-integration-tests: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: integration - - name: Configure test keychain - run: scripts/configure_test_keychain.sh - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install xcpretty - run: gem install xcpretty - - name: Install Secret GoogleService-Info.plist - run: | - mkdir FirebaseMessaging/Tests/IntegrationTests/Resources - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ - FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist "$plist_secret" - - name: BuildAndTest - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/build.sh Messaging all) + # # TODO(#12205) Update the build.sh script for this job from "test" instead of "build" + # messaging-integration-tests: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: integration + # - name: Configure test keychain + # run: scripts/configure_test_keychain.sh + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install xcpretty + # run: gem install xcpretty + # - name: Install Secret GoogleService-Info.plist + # run: | + # mkdir FirebaseMessaging/Tests/IntegrationTests/Resources + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ + # FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist "$plist_secret" + # - name: BuildAndTest + # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/build.sh Messaging all) quickstart: uses: ./.github/workflows/common_quickstart.yml - strategy: - matrix: - quickstart_type: [objc, swift] with: product: Messaging is_legacy: false - quickstart_type: ${{ matrix.quickstart_type }} - setup_command: scripts/setup_quickstart.sh messaging + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh messaging plist_src_path: scripts/gha-encrypted/qs-messaging.plist.gpg plist_dst_path: quickstart-ios/messaging/GoogleService-Info.plist run_tests: false secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - # Don't run on private repo. - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup quickstart - run: scripts/setup_quickstart.sh messaging - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-messaging.plist.gpg \ - quickstart-ios/messaging/GoogleService-Info.plist "$plist_secret" - - name: Build objc quickstart - run: ([ -z $plist_secret ] || - scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Messaging) - - name: Build swift quickstart - run: ([ -z $plist_secret ] || - scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Messaging swift) - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # quickstart-ftl-cron-only: + # # Don't run on private repo. + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup quickstart + # run: scripts/setup_quickstart.sh messaging + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-messaging.plist.gpg \ + # quickstart-ios/messaging/GoogleService-Info.plist "$plist_secret" + # - name: Build objc quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Messaging) + # - name: Build swift quickstart + # run: ([ -z $plist_secret ] || + # scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Messaging swift) + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - messaging-cron-only: - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseMessaging - platforms: '[ "ios", "tvos", "macos --skip-tests", "watchos --skip-tests" ]' - flags: '[ "--use-static-frameworks" ]' + # messaging-cron-only: + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseMessaging + # platforms: '[ "ios", "tvos", "macos --skip-tests", "watchos --skip-tests" ]' + # flags: '[ "--use-static-frameworks" ]' - messaging-sample-build-test: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: sample${{ matrix.os }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ - FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" - - name: Prereqs - run: scripts/install_prereqs.sh MessagingSample iOS - - name: Build - run: ([ -z $plist_secret ] || scripts/build.sh MessagingSample iOS) + # messaging-sample-build-test: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: sample${{ matrix.os }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install Secret GoogleService-Info.plist + # run: | + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ + # FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" + # - name: Prereqs + # run: scripts/install_prereqs.sh MessagingSample iOS + # - name: Build + # run: ([ -z $plist_secret ] || scripts/build.sh MessagingSample iOS) - messaging-swiftui-sample-build-test: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: sample${{ matrix.os }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ - FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" - - name: Prereqs - run: scripts/install_prereqs.sh SwiftUISample iOS - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Build - run: ([ -z $plist_secret ] || scripts/build.sh SwiftUISample iOS) + # messaging-swiftui-sample-build-test: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: sample${{ matrix.os }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install Secret GoogleService-Info.plist + # run: | + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ + # FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" + # - name: Prereqs + # run: scripts/install_prereqs.sh SwiftUISample iOS + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Build + # run: ([ -z $plist_secret ] || scripts/build.sh SwiftUISample iOS) - messaging-watchos-standalone-sample-build-test: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: watch-sample${{ matrix.os }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install Secret GoogleService-Info.plist - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ - FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" - - name: Prereqs - run: scripts/install_prereqs.sh MessagingSampleStandaloneWatchApp watchOS - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Build - run: ([ -z $plist_secret ] || scripts/build.sh MessagingSampleStandaloneWatchApp watchOS) - - name: Upload xcodebuild logs - if: failure() - uses: actions/upload-artifact@v4 - with: - name: xcodebuild-logs-${{ matrix.target }} - path: xcodebuild-*.log + # messaging-watchos-standalone-sample-build-test: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: watch-sample${{ matrix.os }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install Secret GoogleService-Info.plist + # run: | + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/messaging-sample-plist.gpg \ + # FirebaseMessaging/Apps/Shared/GoogleService-Info.plist "$plist_secret" + # - name: Prereqs + # run: scripts/install_prereqs.sh MessagingSampleStandaloneWatchApp watchOS + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Build + # run: ([ -z $plist_secret ] || scripts/build.sh MessagingSampleStandaloneWatchApp watchOS) + # - name: Upload xcodebuild logs + # if: failure() + # uses: actions/upload-artifact@v4 + # with: + # name: xcodebuild-logs-${{ matrix.target }} + # path: xcodebuild-*.log diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 9d1f35594e6..efbdf10685f 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -33,50 +33,50 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: PerformanceUnit - platforms: iOS, tvOS + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: PerformanceUnit + # platforms: iOS, tvOS - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebasePerformance - target: - buildonly: true + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebasePerformance + # target: + # buildonly: true - # Build and run the unit tests for Firebase performance SDK. - performance: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - runs-on: macos-15 - strategy: - matrix: - target: [iOS, tvOS] - test: [unit, proddev] - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: ${{ matrix.target }}${{ matrix.test }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install xcpretty - run: gem install xcpretty - - name: BuildAndTest # can be replaced with pod lib lint with CocoaPods 1.10 - run: scripts/third_party/travis/retry.sh scripts/build.sh Performance ${{ matrix.target }} ${{ matrix.test }} + # # Build and run the unit tests for Firebase performance SDK. + # performance: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # runs-on: macos-15 + # strategy: + # matrix: + # target: [iOS, tvOS] + # test: [unit, proddev] + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: ${{ matrix.target }}${{ matrix.test }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install xcpretty + # run: gem install xcpretty + # - name: BuildAndTest # can be replaced with pod lib lint with CocoaPods 1.10 + # run: scripts/third_party/travis/retry.sh scripts/build.sh Performance ${{ matrix.target }} ${{ matrix.test }} - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebasePerformance - platforms: iOS, tvOS - #TODO: tests are not supported with Xcode 15 because the test spec depends on the iOS 8 GDCWebServer - buildonly_platforms: iOS, tvOS + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebasePerformance + # platforms: iOS, tvOS + # #TODO: tests are not supported with Xcode 15 because the test spec depends on the iOS 8 GDCWebServer + # buildonly_platforms: iOS, tvOS # TODO: The legacy ObjC quickstarts don't run with Xcode 15, re-able if we get these working. quickstart: @@ -84,47 +84,46 @@ jobs: with: product: Performance is_legacy: false - quickstart_type: swift - setup_command: scripts/setup_quickstart.sh performance + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh performance plist_src_path: scripts/gha-encrypted/qs-performance.plist.gpg plist_dst_path: quickstart-ios/performance/GoogleService-Info.plist secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # quickstart-ftl-cron-only: + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Setup quickstart - run: scripts/setup_quickstart.sh performance - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-performance.plist.gpg \ - quickstart-ios/performance/GoogleService-Info.plist "$plist_secret" - - name: Build swift quickstart - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Performance swift) - # - name: Build objc quickstart - # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Performance) - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Setup quickstart + # run: scripts/setup_quickstart.sh performance + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-performance.plist.gpg \ + # quickstart-ios/performance/GoogleService-Info.plist "$plist_secret" + # - name: Build swift quickstart + # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Performance swift) + # # - name: Build objc quickstart + # # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Performance) + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - performance-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebasePerformance - platforms: '[ "ios", "tvos" ]' - flags: '[ "--skip-tests --use-static-frameworks" ]' + # performance-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebasePerformance + # platforms: '[ "ios", "tvos" ]' + # flags: '[ "--skip-tests --use-static-frameworks" ]' diff --git a/.github/workflows/remoteconfig.yml b/.github/workflows/remoteconfig.yml index 9d6fe55f330..a5cd9744c29 100644 --- a/.github/workflows/remoteconfig.yml +++ b/.github/workflows/remoteconfig.yml @@ -27,75 +27,75 @@ concurrency: cancel-in-progress: true jobs: - spm_1: - uses: ./.github/workflows/common.yml - with: - target: RemoteConfigUnit + # spm_1: + # uses: ./.github/workflows/common.yml + # with: + # target: RemoteConfigUnit - spm_2: - uses: ./.github/workflows/common.yml - with: - target: RemoteConfigFakeConsole - buildonly_platforms: watchOS + # spm_2: + # uses: ./.github/workflows/common.yml + # with: + # target: RemoteConfigFakeConsole + # buildonly_platforms: watchOS - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseRemoteConfig - target: FirebaseRemoteConfig-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseRemoteConfig + # target: FirebaseRemoteConfig-Unit-unit - remoteconfig: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - USE_REAL_CONSOLE: true - runs-on: macos-15 - strategy: - matrix: - target: [iOS] - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: rc${{ matrix.target }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install xcpretty - run: gem install xcpretty - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/RemoteConfigSwiftAPI/GoogleService-Info.plist.gpg \ - FirebaseRemoteConfig/Tests/Swift/SwiftAPI/GoogleService-Info.plist "$plist_secret" - - name: Generate Access Token for RemoteConfigConsoleAPI in IntegrationTests - if: matrix.target == 'iOS' - run: ([ -z $plist_secret ] || scripts/generate_access_token.sh "$plist_secret" scripts/gha-encrypted/RemoteConfigSwiftAPI/ServiceAccount.json.gpg - FirebaseRemoteConfig/Tests/Swift/AccessToken.json) - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Fake Console API Tests - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: scripts/build.sh RemoteConfig ${{ matrix.target }} fakeconsole - - name: IntegrationTest - if: matrix.target == 'iOS' - # No retry to avoid exhausting AccessToken quota. - run: ([ -z $plist_secret ] || scripts/build.sh RemoteConfig iOS integration) + # remoteconfig: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # USE_REAL_CONSOLE: true + # runs-on: macos-15 + # strategy: + # matrix: + # target: [iOS] + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: rc${{ matrix.target }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install xcpretty + # run: gem install xcpretty + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/RemoteConfigSwiftAPI/GoogleService-Info.plist.gpg \ + # FirebaseRemoteConfig/Tests/Swift/SwiftAPI/GoogleService-Info.plist "$plist_secret" + # - name: Generate Access Token for RemoteConfigConsoleAPI in IntegrationTests + # if: matrix.target == 'iOS' + # run: ([ -z $plist_secret ] || scripts/generate_access_token.sh "$plist_secret" scripts/gha-encrypted/RemoteConfigSwiftAPI/ServiceAccount.json.gpg + # FirebaseRemoteConfig/Tests/Swift/AccessToken.json) + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Fake Console API Tests + # uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + # with: + # timeout_minutes: 15 + # max_attempts: 3 + # retry_wait_seconds: 120 + # command: scripts/build.sh RemoteConfig ${{ matrix.target }} fakeconsole + # - name: IntegrationTest + # if: matrix.target == 'iOS' + # # No retry to avoid exhausting AccessToken quota. + # run: ([ -z $plist_secret ] || scripts/build.sh RemoteConfig iOS integration) - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseRemoteConfig + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseRemoteConfig quickstart: uses: ./.github/workflows/common_quickstart.yml with: product: Config is_legacy: false - setup_command: scripts/setup_quickstart.sh config + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh config plist_src_path: scripts/gha-encrypted/qs-config.plist.gpg plist_dst_path: quickstart-ios/config/GoogleService-Info.plist secrets: @@ -128,29 +128,29 @@ jobs: # testapp_dir: quickstart-ios/build-for-testing # test_type: "xctest" - sample-build-test: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: build-test - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Xcode - run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer - - name: Prereqs - run: scripts/install_prereqs.sh RemoteConfigSample iOS - - name: Build - run: scripts/build.sh RemoteConfigSample iOS + # sample-build-test: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: build-test + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Xcode + # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer + # - name: Prereqs + # run: scripts/install_prereqs.sh RemoteConfigSample iOS + # - name: Build + # run: scripts/build.sh RemoteConfigSample iOS - remoteconfig-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseRemoteConfig - platforms: '[ "ios", "tvos", "macos" ]' - flags: '[ "--skip-tests --use-static-frameworks" ]' + # remoteconfig-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseRemoteConfig + # platforms: '[ "ios", "tvos", "macos" ]' + # flags: '[ "--skip-tests --use-static-frameworks" ]' diff --git a/.github/workflows/storage.yml b/.github/workflows/storage.yml index 12bbb9bf86d..b310e3aa47f 100644 --- a/.github/workflows/storage.yml +++ b/.github/workflows/storage.yml @@ -26,111 +26,110 @@ concurrency: cancel-in-progress: true jobs: - spm: - uses: ./.github/workflows/common.yml - with: - target: FirebaseStorageUnit + # spm: + # uses: ./.github/workflows/common.yml + # with: + # target: FirebaseStorageUnit - catalyst: - uses: ./.github/workflows/common_catalyst.yml - with: - product: FirebaseStorage - target: FirebaseStorage-Unit-unit + # catalyst: + # uses: ./.github/workflows/common_catalyst.yml + # with: + # product: FirebaseStorage + # target: FirebaseStorage-Unit-unit - storage-integration-tests: - # Don't run on private repo unless it is a PR. - if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' - strategy: - matrix: - language: [Swift, ObjC] - include: - - os: macos-15 - xcode: Xcode_16.4 - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 - with: - cache_key: integration${{ matrix.os }} - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - name: Setup Bundler - run: scripts/setup_bundler.sh - - name: Install xcpretty - run: gem install xcpretty - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/storage-db-plist.gpg \ - FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret" - - name: Install Credentials.h - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.h.gpg \ - FirebaseStorage/Tests/ObjCIntegration/Credentials.h "$plist_secret" - - name: Install Credentials.swift - run: | - scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.swift.gpg \ - FirebaseStorage/Tests/Integration/Credentials.swift "$plist_secret" - - name: Xcode - run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 - with: - timeout_minutes: 15 - max_attempts: 3 - retry_wait_seconds: 120 - command: ([ -z $plist_secret ] || scripts/build.sh Storage${{ matrix.language }} all) + # storage-integration-tests: + # # Don't run on private repo unless it is a PR. + # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' + # strategy: + # matrix: + # language: [Swift, ObjC] + # include: + # - os: macos-15 + # xcode: Xcode_16.4 + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v4 + # - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 + # with: + # cache_key: integration${{ matrix.os }} + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - name: Setup Bundler + # run: scripts/setup_bundler.sh + # - name: Install xcpretty + # run: gem install xcpretty + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/storage-db-plist.gpg \ + # FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret" + # - name: Install Credentials.h + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.h.gpg \ + # FirebaseStorage/Tests/ObjCIntegration/Credentials.h "$plist_secret" + # - name: Install Credentials.swift + # run: |\ + # scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.swift.gpg \ + # FirebaseStorage/Tests/Integration/Credentials.swift "$plist_secret" + # - name: Xcode + # run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer + # - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + # with: + # timeout_minutes: 15 + # max_attempts: 3 + # retry_wait_seconds: 120 + # command: ([ -z $plist_secret ] || scripts/build.sh Storage${{ matrix.language }} all) quickstart: # TODO: See #12399 and restore Objective-C testing for Xcode 15 if GHA is fixed. uses: ./.github/workflows/common_quickstart.yml with: product: Storage - quickstart_type: swift is_legacy: true - setup_command: scripts/setup_quickstart.sh storage + setup_command: QUICKSTART_BRANCH=mc/spm scripts/setup_quickstart_spm.sh storage plist_src_path: scripts/gha-encrypted/qs-storage.plist.gpg plist_dst_path: quickstart-ios/storage/GoogleService-Info.plist run_tests: false secrets: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - quickstart-ftl-cron-only: - # Don't run on private repo. - if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' - env: - plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - LEGACY: true - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Setup quickstart - run: scripts/setup_quickstart.sh storage - - name: Install Secret GoogleService-Info.plist - run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-storage.plist.gpg \ - quickstart-ios/storage/GoogleService-Info.plist "$plist_secret" - # - name: Build objc quickstart - # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Storage) - - name: Build swift quickstart - run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Storage swift) - - id: ftl_test - uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 - with: - credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} - testapp_dir: quickstart-ios/build-for-testing - test_type: "xctest" + # quickstart-ftl-cron-only: + # # Don't run on private repo. + # if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule' + # env: + # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} + # LEGACY: true + # runs-on: macos-15 + # steps: + # - uses: actions/checkout@v4 + # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + # - name: Setup quickstart + # run: scripts/setup_quickstart.sh storage + # - name: Install Secret GoogleService-Info.plist + # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-storage.plist.gpg \ + # quickstart-ios/storage/GoogleService-Info.plist "$plist_secret" + # # - name: Build objc quickstart + # # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Storage) + # - name: Build swift quickstart + # run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh Storage swift) + # - id: ftl_test + # uses: FirebaseExtended/github-actions/firebase-test-lab@v1.4 + # with: + # credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }} + # testapp_dir: quickstart-ios/build-for-testing + # test_type: "xctest" - pod_lib_lint: - uses: ./.github/workflows/common_cocoapods.yml - with: - product: FirebaseStorage - test_specs: unit + # pod_lib_lint: + # uses: ./.github/workflows/common_cocoapods.yml + # with: + # product: FirebaseStorage + # test_specs: unit - storage-cron-only: - needs: pod_lib_lint - uses: ./.github/workflows/common_cocoapods_cron.yml - with: - product: FirebaseStorage - platforms: '[ "ios", "tvos", "macos", "watchos" ]' - flags: '[ "--use-static-frameworks --skip-tests" ]' + # storage-cron-only: + # needs: pod_lib_lint + # uses: ./.github/workflows/common_cocoapods_cron.yml + # with: + # product: FirebaseStorage + # platforms: '[ "ios", "tvos", "macos", "watchos" ]' + # flags: '[ "--use-static-frameworks --skip-tests" ]' diff --git a/scripts/setup_quickstart_spm.sh b/scripts/setup_quickstart_spm.sh index 39165c085ce..4c3145e2d33 100755 --- a/scripts/setup_quickstart_spm.sh +++ b/scripts/setup_quickstart_spm.sh @@ -112,8 +112,8 @@ setup_quickstart_repo() { ( cd "${quickstart_dir}" echo "Ensuring sparse checkout is set for ${sample_name}..." >&2 - # Checkout the sample directory. - git sparse-checkout set "${sample_name}" + # Checkout the sample and scripts directories. + git sparse-checkout set "${sample_name}" scripts shared ) fi @@ -122,8 +122,8 @@ setup_quickstart_repo() { echo "Checking out quickstart branch: ${QUICKSTART_BRANCH}" >&2 ( cd "${quickstart_dir}" - git fetch - git checkout "${QUICKSTART_BRANCH}" + git fetch --quiet + git checkout --quiet "${QUICKSTART_BRANCH}" ) fi @@ -254,4 +254,4 @@ main() { } # Run the main function with all provided arguments. -main "$@" \ No newline at end of file +main "$@" diff --git a/scripts/test_quickstart.sh b/scripts/test_quickstart.sh index 4db82009d3f..2a3f533fc1d 100755 --- a/scripts/test_quickstart.sh +++ b/scripts/test_quickstart.sh @@ -20,17 +20,11 @@ set -xeuo pipefail sample="$1" test="$2" -language="${3-}" # Source function to check if CI secrets are available. source scripts/check_secrets.sh if check_secrets; then cd quickstart-ios - if [ "$language" = "swift" ]; then - have_secrets=true SAMPLE="$sample" TEST="$test" SWIFT_SUFFIX="Swift" ./scripts/test.sh - else - have_secrets=true SAMPLE="$sample" TEST="$test" ./scripts/test.sh - fi - + have_secrets=true SAMPLE="$sample" TEST="$test" ./scripts/test.sh fi