Skip to content

Commit 914777a

Browse files
authored
[Firebase AI] Add initial project structure (#14737)
1 parent 912d8c0 commit 914777a

File tree

121 files changed

+1550
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1550
-300
lines changed

.github/workflows/firebaseai.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: firebaseai
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'FirebaseAI**'
7+
- '.github/workflows/firebaseai.yml'
8+
- 'Gemfile*'
9+
schedule:
10+
# Run every day at 11pm (PST) - cron uses UTC times
11+
- cron: '0 7 * * *'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read # Needed for actions/checkout
20+
actions: write # Needed for actions/cache (save and restore)
21+
22+
jobs:
23+
spm-package-resolved:
24+
runs-on: macos-14
25+
outputs:
26+
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
27+
env:
28+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Generate Swift Package.resolved
32+
id: swift_package_resolve
33+
run: |
34+
swift package resolve
35+
- name: Generate cache key
36+
id: generate_cache_key
37+
run: |
38+
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
39+
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
40+
- uses: actions/cache/save@v4
41+
id: cache
42+
with:
43+
path: .build
44+
key: ${{ steps.generate_cache_key.outputs.cache_key }}
45+
46+
spm-unit:
47+
strategy:
48+
matrix:
49+
include:
50+
- os: macos-14
51+
xcode: Xcode_16.2
52+
target: iOS
53+
- os: macos-15
54+
xcode: Xcode_16.3
55+
target: iOS
56+
- os: macos-15
57+
xcode: Xcode_16.3
58+
target: tvOS
59+
- os: macos-15
60+
xcode: Xcode_16.3
61+
target: macOS
62+
- os: macos-15
63+
xcode: Xcode_16.3
64+
target: watchOS
65+
- os: macos-15
66+
xcode: Xcode_16.3
67+
target: catalyst
68+
- os: macos-15
69+
xcode: Xcode_16.3
70+
target: visionOS
71+
runs-on: ${{ matrix.os }}
72+
needs: spm-package-resolved
73+
env:
74+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
75+
steps:
76+
- uses: actions/checkout@v4
77+
- uses: actions/cache/restore@v4
78+
with:
79+
path: .build
80+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
81+
- name: Clone mock responses
82+
run: scripts/update_vertexai_responses.sh
83+
- name: Xcode
84+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
85+
- name: Install visionOS, if needed.
86+
if: matrix.target == 'visionOS'
87+
run: xcodebuild -downloadPlatform visionOS
88+
- name: Initialize xcodebuild
89+
run: scripts/setup_spm_tests.sh
90+
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
91+
with:
92+
timeout_minutes: 120
93+
max_attempts: 3
94+
retry_on: error
95+
retry_wait_seconds: 120
96+
command: scripts/build.sh FirebaseAIUnit ${{ matrix.target }} spm
97+
98+
testapp-integration:
99+
strategy:
100+
matrix:
101+
target: [iOS]
102+
os: [macos-15]
103+
include:
104+
- os: macos-15
105+
xcode: Xcode_16.3
106+
runs-on: ${{ matrix.os }}
107+
needs: spm-package-resolved
108+
env:
109+
TEST_RUNNER_FIRAAppCheckDebugToken: ${{ secrets.VERTEXAI_INTEGRATION_FAC_DEBUG_TOKEN }}
110+
TEST_RUNNER_VTXIntegrationImagen: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
111+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
112+
secrets_passphrase: ${{ secrets.GHASecretsGPGPassphrase1 }}
113+
steps:
114+
- uses: actions/checkout@v4
115+
- uses: actions/cache/restore@v4
116+
with:
117+
path: .build
118+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
119+
- name: Install Secret GoogleService-Info.plist
120+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info.plist.gpg \
121+
FirebaseAI/Tests/TestApp/Resources/GoogleService-Info.plist "$secrets_passphrase"
122+
- name: Install Secret GoogleService-Info-Spark.plist
123+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info-Spark.plist.gpg \
124+
FirebaseAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist "$secrets_passphrase"
125+
- name: Install Secret Credentials.swift
126+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-Credentials.swift.gpg \
127+
FirebaseAI/Tests/TestApp/Tests/Integration/Credentials.swift "$secrets_passphrase"
128+
- name: Xcode
129+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
130+
- name: Run IntegrationTests
131+
run: scripts/build.sh FirebaseAIIntegration ${{ matrix.target }}
132+
133+
pod-lib-lint:
134+
# Don't run on private repo unless it is a PR.
135+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
136+
strategy:
137+
matrix:
138+
include:
139+
- os: macos-14
140+
xcode: Xcode_16.2
141+
swift_version: 5.9
142+
warnings:
143+
- os: macos-15
144+
xcode: Xcode_16.3
145+
swift_version: 5.9
146+
warnings:
147+
- os: macos-15
148+
xcode: Xcode_16.3
149+
swift_version: 6.0
150+
warnings:
151+
runs-on: ${{ matrix.os }}
152+
steps:
153+
- uses: actions/checkout@v4
154+
- name: Clone mock responses
155+
run: scripts/update_vertexai_responses.sh
156+
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
157+
- name: Setup Bundler
158+
run: scripts/setup_bundler.sh
159+
- name: Xcode
160+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
161+
- name: Set Swift swift_version
162+
run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseAI.podspec
163+
- name: Build and test
164+
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }}

.github/workflows/vertexai.yml

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: vertexai
33
on:
44
pull_request:
55
paths:
6+
- 'FirebaseAI**'
67
- 'FirebaseVertexAI**'
78
- '.github/workflows/vertexai.yml'
89
- 'Gemfile*'
@@ -74,8 +75,6 @@ jobs:
7475
with:
7576
path: .build
7677
key: ${{needs.spm-package-resolved.outputs.cache_key}}
77-
- name: Clone mock responses
78-
run: scripts/update_vertexai_responses.sh
7978
- name: Xcode
8079
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
8180
- name: Install visionOS, if needed.
@@ -91,41 +90,6 @@ jobs:
9190
retry_wait_seconds: 120
9291
command: scripts/build.sh FirebaseVertexAIUnit ${{ matrix.target }} spm
9392

94-
testapp-integration:
95-
strategy:
96-
matrix:
97-
target: [iOS]
98-
os: [macos-15]
99-
include:
100-
- os: macos-15
101-
xcode: Xcode_16.3
102-
runs-on: ${{ matrix.os }}
103-
needs: spm-package-resolved
104-
env:
105-
TEST_RUNNER_FIRAAppCheckDebugToken: ${{ secrets.VERTEXAI_INTEGRATION_FAC_DEBUG_TOKEN }}
106-
TEST_RUNNER_VTXIntegrationImagen: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
107-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
108-
secrets_passphrase: ${{ secrets.GHASecretsGPGPassphrase1 }}
109-
steps:
110-
- uses: actions/checkout@v4
111-
- uses: actions/cache/restore@v4
112-
with:
113-
path: .build
114-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
115-
- name: Install Secret GoogleService-Info.plist
116-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info.plist.gpg \
117-
FirebaseVertexAI/Tests/TestApp/Resources/GoogleService-Info.plist "$secrets_passphrase"
118-
- name: Install Secret GoogleService-Info-Spark.plist
119-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info-Spark.plist.gpg \
120-
FirebaseVertexAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist "$secrets_passphrase"
121-
- name: Install Secret Credentials.swift
122-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-Credentials.swift.gpg \
123-
FirebaseVertexAI/Tests/TestApp/Tests/Integration/Credentials.swift "$secrets_passphrase"
124-
- name: Xcode
125-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
126-
- name: Run IntegrationTests
127-
run: scripts/build.sh VertexIntegration ${{ matrix.target }}
128-
12993
pod-lib-lint:
13094
# Don't run on private repo unless it is a PR.
13195
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
@@ -147,8 +111,6 @@ jobs:
147111
runs-on: ${{ matrix.os }}
148112
steps:
149113
- uses: actions/checkout@v4
150-
- name: Clone mock responses
151-
run: scripts/update_vertexai_responses.sh
152114
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
153115
- name: Setup Bundler
154116
run: scripts/setup_bundler.sh

FirebaseAI.podspec

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'FirebaseAI'
3+
s.version = '11.13.0'
4+
s.summary = 'Firebase AI SDK'
5+
6+
s.description = <<-DESC
7+
Build AI-powered apps and features with the Gemini API using the Firebase AI SDK.
8+
DESC
9+
10+
s.homepage = 'https://firebase.google.com'
11+
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
12+
s.authors = 'Google, Inc.'
13+
14+
s.source = {
15+
:git => 'https://github.com/firebase/firebase-ios-sdk.git',
16+
:tag => 'CocoaPods-' + s.version.to_s
17+
}
18+
19+
s.social_media_url = 'https://twitter.com/Firebase'
20+
21+
ios_deployment_target = '15.0'
22+
osx_deployment_target = '12.0'
23+
tvos_deployment_target = '15.0'
24+
watchos_deployment_target = '8.0'
25+
26+
s.ios.deployment_target = ios_deployment_target
27+
s.osx.deployment_target = osx_deployment_target
28+
s.tvos.deployment_target = tvos_deployment_target
29+
s.watchos.deployment_target = watchos_deployment_target
30+
31+
s.cocoapods_version = '>= 1.12.0'
32+
s.prefix_header_file = false
33+
34+
s.source_files = [
35+
'FirebaseAI/Sources/**/*.swift',
36+
]
37+
38+
s.swift_version = '5.9'
39+
40+
s.framework = 'Foundation'
41+
s.ios.framework = 'UIKit'
42+
s.osx.framework = 'AppKit'
43+
s.tvos.framework = 'UIKit'
44+
s.watchos.framework = 'WatchKit'
45+
46+
s.dependency 'FirebaseAppCheckInterop', '~> 11.4'
47+
s.dependency 'FirebaseAuthInterop', '~> 11.4'
48+
s.dependency 'FirebaseCore', '~> 11.13.0'
49+
s.dependency 'FirebaseCoreExtension', '~> 11.13.0'
50+
51+
s.test_spec 'unit' do |unit_tests|
52+
unit_tests_dir = 'FirebaseAI/Tests/Unit/'
53+
unit_tests.scheme = { :code_coverage => true }
54+
unit_tests.platforms = {
55+
:ios => ios_deployment_target,
56+
:osx => osx_deployment_target,
57+
:tvos => tvos_deployment_target
58+
}
59+
unit_tests.source_files = [
60+
unit_tests_dir + '**/*.swift',
61+
]
62+
unit_tests.exclude_files = [
63+
unit_tests_dir + 'Snippets/**/*.swift',
64+
]
65+
unit_tests.resources = [
66+
unit_tests_dir + 'vertexai-sdk-test-data/mock-responses/vertexai',
67+
unit_tests_dir + 'Resources/**/*',
68+
]
69+
end
70+
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)