Skip to content

Commit

Permalink
[VertexAI] Add Swift 6 testing to CI (#14503)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Feb 27, 2025
1 parent 7249d3a commit ba7849a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/vertexai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,20 @@ jobs:
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
strategy:
matrix:
target: [ios]
os: [macos-14, macos-15]
include:
- os: macos-14
xcode: Xcode_15.2
swift_version: 5.9
warnings: --allow-warnings
- os: macos-15
xcode: Xcode_16.2
swift_version: 5.9
warnings:
#TODO: Fix remaining warning in GenerativeAIService and remove --allow-warnings.
- os: macos-15
xcode: Xcode_16.2
swift_version: 6.0
warnings: --allow-warnings
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -147,6 +152,8 @@ jobs:
run: scripts/setup_bundler.sh
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Set Swift swift_version
run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseVertexAI.podspec
- name: Build and test
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseVertexAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }}

Expand Down
3 changes: 3 additions & 0 deletions FirebaseVertexAI/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
- [feature] The Firebase Vertex AI SDK no longer requires `@preconcurrency` when imported in Swift 6.

# 11.9.0
- [feature] **Public Preview**: Added support for generating images using the
Imagen 3 model.
Expand Down
18 changes: 12 additions & 6 deletions FirebaseVertexAI/Tests/Unit/MockURLProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ import Foundation
import XCTest

@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
class MockURLProtocol: URLProtocol {
static var requestHandler: ((URLRequest) throws -> (
URLResponse,
AsyncLineSequence<URL.AsyncBytes>?
))?

class MockURLProtocol: URLProtocol, @unchecked Sendable {
#if compiler(>=6)
nonisolated(unsafe) static var requestHandler: ((URLRequest) throws -> (
URLResponse,
AsyncLineSequence<URL.AsyncBytes>?
))?
#else
static var requestHandler: ((URLRequest) throws -> (
URLResponse,
AsyncLineSequence<URL.AsyncBytes>?
))?
#endif
override class func canInit(with request: URLRequest) -> Bool {
#if os(watchOS)
print("MockURLProtocol cannot be used on watchOS.")
Expand Down
2 changes: 1 addition & 1 deletion FirebaseVertexAI/Tests/Unit/VertexComponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import FirebaseCore
@preconcurrency import FirebaseCore
import Foundation
import XCTest

Expand Down

0 comments on commit ba7849a

Please sign in to comment.