Skip to content

Build SPM quickstart for FirebaseAI #14818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/firebaseai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
paths:
- 'FirebaseAI**'
- '.github/workflows/firebaseai.yml'
- 'scripts/quickstart_build_spm.sh'
- 'scripts/quickstart_spm_xcodeproj.sh'
- 'Gemfile*'
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
Expand Down Expand Up @@ -162,3 +164,14 @@ jobs:
run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseAI.podspec
- name: Build and test
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }}

quickstart:
# Verifies the quickstart builds with this PR. Only run on pulls where branch is available.
if: github.event_name == 'pull_request'
runs-on: macos-15
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Build Quickstart
run: scripts/quickstart_build_spm.sh FirebaseAI
40 changes: 40 additions & 0 deletions scripts/quickstart_build_spm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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.


# Verifies changes to firebase-ios-sdk repo can continue to build the
# product's SPM quickstart.

set -xeuo pipefail

SAMPLE=$1

scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

"$scripts_dir/setup_bundler.sh"

gem install xcpretty

git clone https://github.com/firebase/quickstart-ios.git

cd quickstart-ios

source "$scripts_dir/quickstart_spm_xcodeproj.sh" "$SAMPLE"

# Placeholder GoogleService-Info.plist good enough for build only testing.
cp ./mock-GoogleService-Info.plist ./firebaseai/GoogleService-Info.plist

SAMPLE=$1 DIR=$1 SPM="true" TEST="false" ./scripts/test.sh
31 changes: 31 additions & 0 deletions scripts/quickstart_spm_xcodeproj.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/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.


# Modify a .xcodeproj to use a specific branch.
# TODO: Update to transform from a release, as well as from `main`.

set -xeuo pipefail

SAMPLE=$1
XCODEPROJ=${SAMPLE}/${SAMPLE}Example.xcodeproj/project.pbxproj

if grep -q "branch = main;" "$XCODEPROJ"; then
sed -i "" "s#branch = main;#branch = $BRANCH_NAME;#" "$XCODEPROJ"
else
echo "Failed to update quickstart's Xcode project to the current branch"
exit 1
fi
Loading