From 6770e9098c51738a30ad95359d1a7a71178dc23b Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Mon, 3 Mar 2025 18:05:53 -0800 Subject: [PATCH 01/28] Enable Integration Tests in Git --- .github/workflows/spm.yml | 4 +-- Tests/Integration/Emulator/start-emulator.sh | 37 ++++++++++++++++++++ Tests/Integration/IntegrationTestBase.swift | 6 ++-- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 Tests/Integration/Emulator/start-emulator.sh diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 34acac4..067f5e3 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -30,7 +30,6 @@ jobs: env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 FIREBASE_MAIN: 1 - DISABLE_INTEGRATION_TESTS: 1 steps: - uses: actions/checkout@v4 - name: Generate Swift Package.resolved @@ -62,7 +61,6 @@ jobs: env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 FIREBASE_MAIN: 1 - DISABLE_INTEGRATION_TESTS: 1 steps: - uses: actions/checkout@v4 - uses: actions/cache/restore@v4 @@ -75,3 +73,5 @@ jobs: run: ./setup-scripts.sh - name: Unit Tests run: scripts/third_party/travis/retry.sh scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm + - name: Integration Test Server + run: Tests/Integration/Emulator/start-emulator.sh synchronous diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh new file mode 100644 index 0000000..4cb48ba --- /dev/null +++ b/Tests/Integration/Emulator/start-emulator.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright 2018 Google +# +# 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. + +# Sets up Firebase Data Connect emulator and starts it to run +# integration tests. + +set -e + +# Get the absolute path to the directory containing this script. +SCRIPT_DIR="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)" +TEMP_DIR="$(mktemp -d -t firebase-data-connect)" +echo "Starting Firebase Data Connect emulator in ${TEMP_DIR}" +cd "${TEMP_DIR}" + +EMULATOR_VERSION="1.8.3" +EMULATOR_FILENAME="dataconnect-emulator-macos-v${EMULATOR_VERSION}" +EMULATOR_URL="https://storage.googleapis.com/firemat-preview-drop/emulator/${EMULATOR_FILENAME}" +echo "Downloading emulator from ${EMULATOR_URL}" + +curl -o "${EMULATOR_FILENAME}" "${EMULATOR_URL}" + +chmod 755 "${EMULATOR_FILENAME}" + +./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628" diff --git a/Tests/Integration/IntegrationTestBase.swift b/Tests/Integration/IntegrationTestBase.swift index ca2faed..ff18989 100644 --- a/Tests/Integration/IntegrationTestBase.swift +++ b/Tests/Integration/IntegrationTestBase.swift @@ -37,8 +37,10 @@ class IntegrationTestBase: XCTestCase { ) override class func setUp() { - FirebaseApp.configure(options: options) - defaultApp = FirebaseApp.app() + if defaultApp == nil { + FirebaseApp.configure(options: options) + defaultApp = FirebaseApp.app() + } DataConnect.kitchenSinkConnector.useEmulator(port: 3628) } } From 0877c2d28a103b293d13c39d73d7b801e88502de Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 08:31:18 -0800 Subject: [PATCH 02/28] Rearrange workflow step Move setup before tests --- .github/workflows/spm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 067f5e3..8bc5d39 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -71,7 +71,7 @@ jobs: run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - name: Setup Scripts Directory run: ./setup-scripts.sh + - name: Integration Test Setup + run: Tests/Integration/Emulator/start-emulator.sh synchronous - name: Unit Tests run: scripts/third_party/travis/retry.sh scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm - - name: Integration Test Server - run: Tests/Integration/Emulator/start-emulator.sh synchronous From c0194e17646218b4c13d731eeea58588d2e624fe Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 08:37:11 -0800 Subject: [PATCH 03/28] Remove chmod and check --- Tests/Integration/Emulator/start-emulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh index 4cb48ba..25bbeb3 100644 --- a/Tests/Integration/Emulator/start-emulator.sh +++ b/Tests/Integration/Emulator/start-emulator.sh @@ -32,6 +32,6 @@ echo "Downloading emulator from ${EMULATOR_URL}" curl -o "${EMULATOR_FILENAME}" "${EMULATOR_URL}" -chmod 755 "${EMULATOR_FILENAME}" +#chmod 755 "${EMULATOR_FILENAME}" ./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628" From 20524c929c5308fac546a9948efe5fee13d41500 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 08:53:35 -0800 Subject: [PATCH 04/28] Make script executable --- Tests/Integration/Emulator/start-emulator.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 Tests/Integration/Emulator/start-emulator.sh diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh old mode 100644 new mode 100755 From 375c46675a131414ce57fe98a7a616e791f45281 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 09:25:23 -0800 Subject: [PATCH 05/28] Update run config for tests --- .github/workflows/spm.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 8bc5d39..71cc954 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -56,7 +56,11 @@ jobs: os: [macos-14] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 target: [iOS, tvOS, macOS, catalyst] - xcode: [Xcode_15.2, Xcode_15.4, Xcode_16] + include: + - os: macos-15 + xcode: Xcode_16.2 + - os: macos-14 + xcode: Xcode_15.3 runs-on: ${{ matrix.os }} env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 From 8693cf8c293c71a91e6afca6d2a0aa6e149f2b5c Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 09:29:07 -0800 Subject: [PATCH 06/28] Reinstate chmod for the downloaded emulator binary --- Tests/Integration/Emulator/start-emulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh index 25bbeb3..4cb48ba 100755 --- a/Tests/Integration/Emulator/start-emulator.sh +++ b/Tests/Integration/Emulator/start-emulator.sh @@ -32,6 +32,6 @@ echo "Downloading emulator from ${EMULATOR_URL}" curl -o "${EMULATOR_FILENAME}" "${EMULATOR_URL}" -#chmod 755 "${EMULATOR_FILENAME}" +chmod 755 "${EMULATOR_FILENAME}" ./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628" From d4263e9b00db0e9473ae6be9c740652c17a15e57 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 10:06:24 -0800 Subject: [PATCH 07/28] Start emulator binary in background --- Tests/Integration/Emulator/start-emulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh index 4cb48ba..0a65e36 100755 --- a/Tests/Integration/Emulator/start-emulator.sh +++ b/Tests/Integration/Emulator/start-emulator.sh @@ -34,4 +34,4 @@ curl -o "${EMULATOR_FILENAME}" "${EMULATOR_URL}" chmod 755 "${EMULATOR_FILENAME}" -./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628" +./${EMULATOR_FILENAME} --logtostderr dev --listen="127.0.0.1:3628" & From 221a83916e02531d82673a870019852d28dd0366 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 10:23:49 -0800 Subject: [PATCH 08/28] match main sdk file --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 71cc954..135ccbb 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -78,4 +78,4 @@ jobs: - name: Integration Test Setup run: Tests/Integration/Emulator/start-emulator.sh synchronous - name: Unit Tests - run: scripts/third_party/travis/retry.sh scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm + run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm From 95bc0744945c621db259418c5c365bd195b5d56b Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 10:38:33 -0800 Subject: [PATCH 09/28] Updated to match main SDK workflow files --- .github/workflows/spm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 135ccbb..510ec0c 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -59,8 +59,10 @@ jobs: include: - os: macos-15 xcode: Xcode_16.2 + test: spm - os: macos-14 xcode: Xcode_15.3 + test: spm runs-on: ${{ matrix.os }} env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 From bfa113d22a1c12c0ce32ff3fddeaccd783f91e45 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 10:58:55 -0800 Subject: [PATCH 10/28] reinstate previous run config --- .github/workflows/spm.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 510ec0c..75de938 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -56,13 +56,7 @@ jobs: os: [macos-14] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 target: [iOS, tvOS, macOS, catalyst] - include: - - os: macos-15 - xcode: Xcode_16.2 - test: spm - - os: macos-14 - xcode: Xcode_15.3 - test: spm + xcode: [Xcode_15.4, Xcode_16.2] runs-on: ${{ matrix.os }} env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 From 9ad6d8ee3cab09a4ac95cb641e0cc1bc82a7f34a Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 14:37:40 -0800 Subject: [PATCH 11/28] Test build script change --- setup-scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-scripts.sh b/setup-scripts.sh index 42eecd6..3ef2a81 100755 --- a/setup-scripts.sh +++ b/setup-scripts.sh @@ -17,6 +17,6 @@ git clone \ https://github.com/firebase/firebase-ios-sdk.git \ ; cd firebase-ios-sdk -git checkout main -- scripts +git checkout ap/dataconnect-build-script -- scripts cd .. ln -s firebase-ios-sdk/scripts scripts From 758b0747e54423a478fe3d9500cb073f2ff469b5 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 14:42:02 -0800 Subject: [PATCH 12/28] Test script use commit hash --- setup-scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-scripts.sh b/setup-scripts.sh index 3ef2a81..a90ce2b 100755 --- a/setup-scripts.sh +++ b/setup-scripts.sh @@ -17,6 +17,6 @@ git clone \ https://github.com/firebase/firebase-ios-sdk.git \ ; cd firebase-ios-sdk -git checkout ap/dataconnect-build-script -- scripts +git checkout 96fc6d50d8ae1c8a851b25f01cfe6ac96e5c9a68 -- scripts cd .. ln -s firebase-ios-sdk/scripts scripts From 55d5c4d4fe7758b2fcfc628f1549887448aaf122 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 15:17:11 -0800 Subject: [PATCH 13/28] Test Reinstate main branch now that PR has merged --- setup-scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-scripts.sh b/setup-scripts.sh index a90ce2b..42eecd6 100755 --- a/setup-scripts.sh +++ b/setup-scripts.sh @@ -17,6 +17,6 @@ git clone \ https://github.com/firebase/firebase-ios-sdk.git \ ; cd firebase-ios-sdk -git checkout 96fc6d50d8ae1c8a851b25f01cfe6ac96e5c9a68 -- scripts +git checkout main -- scripts cd .. ln -s firebase-ios-sdk/scripts scripts From e91fd844193438cb64ffe39d201f64ccfc8d5a51 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 15:34:03 -0800 Subject: [PATCH 14/28] Removing tvOS tests temporarily. --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 75de938..6037870 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -55,7 +55,7 @@ jobs: matrix: os: [macos-14] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 - target: [iOS, tvOS, macOS, catalyst] + target: [iOS, macOS, catalyst] xcode: [Xcode_15.4, Xcode_16.2] runs-on: ${{ matrix.os }} env: From c4d1c134a913719df3e79b28ea9a90c2cbfd8b64 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 16:44:47 -0800 Subject: [PATCH 15/28] Setup spm tests --- .github/workflows/spm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 6037870..967cc73 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -71,6 +71,8 @@ jobs: run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - name: Setup Scripts Directory run: ./setup-scripts.sh + - name: Initialize xcodebuild + run: scripts/setup_spm_tests.sh - name: Integration Test Setup run: Tests/Integration/Emulator/start-emulator.sh synchronous - name: Unit Tests From e7057d1abaada963c6acc7e235869e735374ddb2 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 4 Mar 2025 19:14:54 -0800 Subject: [PATCH 16/28] Install iOS platform --- .github/workflows/spm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 967cc73..fdd0144 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -71,6 +71,8 @@ jobs: run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - name: Setup Scripts Directory run: ./setup-scripts.sh + - name: Install iOS Platform + run: xcodebuild -downloadPlatform iOS - name: Initialize xcodebuild run: scripts/setup_spm_tests.sh - name: Integration Test Setup From d8e91e8e2168d89b62da59ba77a4c7f4d6c6002c Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 11:17:10 -0800 Subject: [PATCH 17/28] Test on xcode 16 only --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index fdd0144..67bf674 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -56,7 +56,7 @@ jobs: os: [macos-14] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 target: [iOS, macOS, catalyst] - xcode: [Xcode_15.4, Xcode_16.2] + xcode: [Xcode_16.2] runs-on: ${{ matrix.os }} env: FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 From 532a3ab56b717ed32398fff7d5ed5fcb744fa7da Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 11:23:54 -0800 Subject: [PATCH 18/28] update to macos 15 --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 67bf674..ddd261b 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -53,7 +53,7 @@ jobs: strategy: matrix: - os: [macos-14] + os: [macos-15] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 target: [iOS, macOS, catalyst] xcode: [Xcode_16.2] From 30a6c9a626ba2973d6013d295a61b6466cda2e66 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 11:46:45 -0800 Subject: [PATCH 19/28] Update python version to 3.11 --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5ae56f7..5e02f01 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Cache Mint packages uses: actions/cache@v4 From 443fbc167cef3c1541112d00915665f06ddfea2f Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 12:02:47 -0800 Subject: [PATCH 20/28] Print main sdk HEAD commit --- setup-scripts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup-scripts.sh b/setup-scripts.sh index 42eecd6..31f095e 100755 --- a/setup-scripts.sh +++ b/setup-scripts.sh @@ -18,5 +18,6 @@ git clone \ ; cd firebase-ios-sdk git checkout main -- scripts +git rev-parse HEAD cd .. ln -s firebase-ios-sdk/scripts scripts From 651889c36f15cf61c943d48d6db6a99752c37512 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:50:48 -0500 Subject: [PATCH 21/28] [Infra] Bump clang-format to v20 (#44) --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5e02f01..fdfee42 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,7 +34,7 @@ jobs: - name: Setup check run: | brew update - brew install clang-format@19 + brew install clang-format@20 brew install mint mint bootstrap From 1328218bced81668f5d98336fc0c5bdc011b1bb1 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:54:00 -0500 Subject: [PATCH 22/28] [Infra] Update check.yml --- .github/workflows/check.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fdfee42..44cefe6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -32,11 +32,7 @@ jobs: run: ./setup-scripts.sh - name: Setup check - run: | - brew update - brew install clang-format@20 - brew install mint - mint bootstrap + run: scripts/setup_check.sh - name: Style run: scripts/style.sh test-only From aa69f88ebf2b6114b12e39ac6c4c8c51f65c2a41 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 13:16:05 -0800 Subject: [PATCH 23/28] Revert setup_spm_tests step --- .github/workflows/spm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index ddd261b..c96bbd9 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -73,8 +73,6 @@ jobs: run: ./setup-scripts.sh - name: Install iOS Platform run: xcodebuild -downloadPlatform iOS - - name: Initialize xcodebuild - run: scripts/setup_spm_tests.sh - name: Integration Test Setup run: Tests/Integration/Emulator/start-emulator.sh synchronous - name: Unit Tests From 9a41f387c4f551b57a46e2f13c7ff1b6cab1e57c Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 13:36:03 -0800 Subject: [PATCH 24/28] Add check for app already configured --- Tests/Unit/InstanceTests.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Tests/Unit/InstanceTests.swift b/Tests/Unit/InstanceTests.swift index 2ebf1dd..6ef4c19 100644 --- a/Tests/Unit/InstanceTests.swift +++ b/Tests/Unit/InstanceTests.swift @@ -52,11 +52,15 @@ class InstanceTests: XCTestCase { ) override class func setUp() { - FirebaseApp.configure(options: options) - defaultApp = FirebaseApp.app() - - FirebaseApp.configure(name: "app-two", options: optionsTwo) - appTwo = FirebaseApp.app(name: "app-two") + if defaultApp == nil { + FirebaseApp.configure(options: options) + defaultApp = FirebaseApp.app() + } + + if appTwo == nil { + FirebaseApp.configure(name: "app-two", options: optionsTwo) + appTwo = FirebaseApp.app(name: "app-two") + } } // same connector config, same app, instance returned should be same From fb297e85ca70a4c9b454e0ade89451e6952a9c4d Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 13:55:19 -0800 Subject: [PATCH 25/28] Convert app creation to lazy init --- Tests/Unit/InstanceTests.swift | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Tests/Unit/InstanceTests.swift b/Tests/Unit/InstanceTests.swift index 6ef4c19..b49db12 100644 --- a/Tests/Unit/InstanceTests.swift +++ b/Tests/Unit/InstanceTests.swift @@ -19,8 +19,15 @@ import XCTest @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) class InstanceTests: XCTestCase { - static var defaultApp: FirebaseApp? - static var appTwo: FirebaseApp? + static var defaultApp: FirebaseApp? = { + FirebaseApp.configure(options: options) + return FirebaseApp.app() + }() + + static var appTwo: FirebaseApp? = { + FirebaseApp.configure(name: "app-two", options: optionsTwo) + return FirebaseApp.app(name: "app-two") + }() static var options: FirebaseOptions = { let options = FirebaseOptions(googleAppID: "0:0000000000000:ios:0000000000000000", @@ -51,18 +58,6 @@ class InstanceTests: XCTestCase { connector: "blogs" ) - override class func setUp() { - if defaultApp == nil { - FirebaseApp.configure(options: options) - defaultApp = FirebaseApp.app() - } - - if appTwo == nil { - FirebaseApp.configure(name: "app-two", options: optionsTwo) - appTwo = FirebaseApp.app(name: "app-two") - } - } - // same connector config, same app, instance returned should be same func testSameInstance() throws { let dcOne = DataConnect.dataConnect(connectorConfig: fakeConnectorConfigOne) From 3c1d0c829bd60d06daf7205f8d25d910e8ef7a3c Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 14:08:40 -0800 Subject: [PATCH 26/28] Add back tvOS tests --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index c96bbd9..10c0099 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -55,7 +55,7 @@ jobs: matrix: os: [macos-15] # GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 - target: [iOS, macOS, catalyst] + target: [iOS, macOS, tvOS, catalyst] xcode: [Xcode_16.2] runs-on: ${{ matrix.os }} env: From 73fcdda50fec1008e4a6e886be74bf9b6fca22d6 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 14:30:42 -0800 Subject: [PATCH 27/28] Update run unit name to indicate integration tests --- .github/workflows/spm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 10c0099..0c71433 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -75,5 +75,5 @@ jobs: run: xcodebuild -downloadPlatform iOS - name: Integration Test Setup run: Tests/Integration/Emulator/start-emulator.sh synchronous - - name: Unit Tests + - name: Unit and Integration Tests run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm From 2b9c08022991ddba6b45bc5cdf5d4db3725ccec0 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Wed, 5 Mar 2025 15:10:11 -0800 Subject: [PATCH 28/28] Nick feedback --- .github/workflows/spm.yml | 2 +- Tests/Integration/Emulator/start-emulator.sh | 4 ++-- setup-scripts.sh | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/spm.yml b/.github/workflows/spm.yml index 0c71433..6177753 100644 --- a/.github/workflows/spm.yml +++ b/.github/workflows/spm.yml @@ -74,6 +74,6 @@ jobs: - name: Install iOS Platform run: xcodebuild -downloadPlatform iOS - name: Integration Test Setup - run: Tests/Integration/Emulator/start-emulator.sh synchronous + run: Tests/Integration/Emulator/start-emulator.sh - name: Unit and Integration Tests run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm diff --git a/Tests/Integration/Emulator/start-emulator.sh b/Tests/Integration/Emulator/start-emulator.sh index 0a65e36..ab10f79 100755 --- a/Tests/Integration/Emulator/start-emulator.sh +++ b/Tests/Integration/Emulator/start-emulator.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2018 Google +# 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. @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Sets up Firebase Data Connect emulator and starts it to run +# Sets up Firebase Data Connect emulator to execute # integration tests. set -e diff --git a/setup-scripts.sh b/setup-scripts.sh index 31f095e..42eecd6 100755 --- a/setup-scripts.sh +++ b/setup-scripts.sh @@ -18,6 +18,5 @@ git clone \ ; cd firebase-ios-sdk git checkout main -- scripts -git rev-parse HEAD cd .. ln -s firebase-ios-sdk/scripts scripts