mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
Establishes the integration testing foundation and parameterized test suites for `GeminiLanguageModel`, enabling fast local execution via `swift test` and automated CI verification on iOS Simulator. Key Changes: - `IntegrationTestingBackend`: Defines canonical backend configurations (`.developerAPI`, `.firebaseAILogicDeveloperAPI`, and `.firebaseAILogicAgentPlatform`), dynamically resolving endpoints, model resource paths, and auth headers from available credentials. - `IntegrationTestEnvironment`: Centralizes credential discovery (`GEMINI_API_KEY`, `GOOGLE_API_KEY`, and `FIREBASE_PLIST_PATH`) into an immutable, thread-safe configuration struct with cached process access to avoid redundant disk I/O. - `AppCheckDebugClient`: Implements a lightweight client to exchange debug tokens for App Check tokens without Keychain dependencies, deduplicating token requests across test runs with an in-memory cache. - Parameterized Tests: Adds `BasicContentGenerationIntegrationTests` running against all available backends, tagged with `@Tag.integration` and gated by condition traits to cleanly skip when credentials are missing. - CI Workflow: Adds `.github/workflows/sdk.geminilanguagemodel.yml` to run integration tests against Firebase AI Logic on iOS Simulator using decrypted repo secrets.
91 lines
2.4 KiB
Swift
91 lines
2.4 KiB
Swift
// swift-tools-version: 6.1
|
|
|
|
// Copyright 2026 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.
|
|
|
|
import PackageDescription
|
|
|
|
let defaultSwiftSettings: [SwiftSetting] = [
|
|
.enableUpcomingFeature("ExistentialAny"),
|
|
.enableUpcomingFeature("InternalImportsByDefault"),
|
|
.enableUpcomingFeature("MemberImportVisibility"),
|
|
]
|
|
|
|
let package = Package(
|
|
name: "gemini-for-foundation-models",
|
|
platforms: [.iOS(.v15), .macCatalyst(.v15), .macOS(.v10_15), .tvOS(.v15), .watchOS(.v7)],
|
|
products: [
|
|
.library(
|
|
name: "GeminiLanguageModel",
|
|
targets: ["GeminiLanguageModel"]
|
|
)
|
|
],
|
|
targets: [
|
|
.target(
|
|
name: "GeminiLanguageModel",
|
|
dependencies: [
|
|
"GeminiAPIClient",
|
|
"GeminiAPIDataModels",
|
|
],
|
|
swiftSettings: defaultSwiftSettings
|
|
),
|
|
.target(
|
|
name: "GeminiTestUtilities",
|
|
dependencies: [
|
|
"GeminiAPIClient"
|
|
],
|
|
path: "Tests/GeminiTestUtilities",
|
|
exclude: [
|
|
"README.md"
|
|
],
|
|
swiftSettings: defaultSwiftSettings
|
|
),
|
|
.testTarget(
|
|
name: "GeminiLanguageModelTests",
|
|
dependencies: [
|
|
"GeminiLanguageModel",
|
|
"GeminiTestUtilities",
|
|
],
|
|
exclude: [
|
|
"IntegrationTests/README.md",
|
|
"README.md",
|
|
],
|
|
swiftSettings: defaultSwiftSettings
|
|
),
|
|
.target(
|
|
name: "GeminiAPIClient",
|
|
dependencies: [
|
|
"GeminiAPIDataModels"
|
|
],
|
|
swiftSettings: defaultSwiftSettings
|
|
),
|
|
.testTarget(
|
|
name: "GeminiAPIClientTests",
|
|
dependencies: [
|
|
"GeminiAPIClient",
|
|
"GeminiTestUtilities",
|
|
],
|
|
swiftSettings: defaultSwiftSettings
|
|
),
|
|
.target(
|
|
name: "GeminiAPIDataModels",
|
|
swiftSettings: [
|
|
.enableUpcomingFeature("ExistentialAny"),
|
|
.enableUpcomingFeature("MemberImportVisibility"),
|
|
]
|
|
),
|
|
],
|
|
swiftLanguageModes: [.v6]
|
|
)
|