Skip to content

Commit ba7849a

Browse files
authored
[VertexAI] Add Swift 6 testing to CI (#14503)
1 parent 7249d3a commit ba7849a

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

.github/workflows/vertexai.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,20 @@ jobs:
128128
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
129129
strategy:
130130
matrix:
131-
target: [ios]
132-
os: [macos-14, macos-15]
133131
include:
134132
- os: macos-14
135133
xcode: Xcode_15.2
134+
swift_version: 5.9
136135
warnings: --allow-warnings
137136
- os: macos-15
138137
xcode: Xcode_16.2
138+
swift_version: 5.9
139139
warnings:
140+
#TODO: Fix remaining warning in GenerativeAIService and remove --allow-warnings.
141+
- os: macos-15
142+
xcode: Xcode_16.2
143+
swift_version: 6.0
144+
warnings: --allow-warnings
140145
runs-on: ${{ matrix.os }}
141146
steps:
142147
- uses: actions/checkout@v4
@@ -147,6 +152,8 @@ jobs:
147152
run: scripts/setup_bundler.sh
148153
- name: Xcode
149154
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
155+
- name: Set Swift swift_version
156+
run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseVertexAI.podspec
150157
- name: Build and test
151158
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseVertexAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }}
152159

FirebaseVertexAI/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [feature] The Firebase Vertex AI SDK no longer requires `@preconcurrency` when imported in Swift 6.
3+
14
# 11.9.0
25
- [feature] **Public Preview**: Added support for generating images using the
36
Imagen 3 model.

FirebaseVertexAI/Tests/Unit/MockURLProtocol.swift

+12-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ import Foundation
1616
import XCTest
1717

1818
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
19-
class MockURLProtocol: URLProtocol {
20-
static var requestHandler: ((URLRequest) throws -> (
21-
URLResponse,
22-
AsyncLineSequence<URL.AsyncBytes>?
23-
))?
24-
19+
class MockURLProtocol: URLProtocol, @unchecked Sendable {
20+
#if compiler(>=6)
21+
nonisolated(unsafe) static var requestHandler: ((URLRequest) throws -> (
22+
URLResponse,
23+
AsyncLineSequence<URL.AsyncBytes>?
24+
))?
25+
#else
26+
static var requestHandler: ((URLRequest) throws -> (
27+
URLResponse,
28+
AsyncLineSequence<URL.AsyncBytes>?
29+
))?
30+
#endif
2531
override class func canInit(with request: URLRequest) -> Bool {
2632
#if os(watchOS)
2733
print("MockURLProtocol cannot be used on watchOS.")

FirebaseVertexAI/Tests/Unit/VertexComponentTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import FirebaseCore
15+
@preconcurrency import FirebaseCore
1616
import Foundation
1717
import XCTest
1818

0 commit comments

Comments
 (0)