Skip to content

Commit 67837bf

Browse files
authored
Update CI workflow to add --build-tests to build step (#85)
* Update CI workflow to add --build-tests to build step * Fix compiler warnings in MockLanguageModel * Fix broken multimodal CoreML tests
1 parent eca7b8f commit 67837bf

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ jobs:
4242
${{ runner.os }}-swift-${{ matrix.swift }}-spm-
4343
4444
- name: Build
45-
run: swift build --traits MLX,Llama,CoreML
45+
run: swift build --build-tests --traits MLX,Llama,CoreML
4646

4747
- name: Test
48-
run: swift test
48+
run: swift test --skip-build
4949

5050
test-linux:
5151
name: Swift ${{ matrix.swift-version }} on Linux

Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,33 +138,31 @@ import Testing
138138
func multimodal_rejectsImageURL() async throws {
139139
let model = try await getModel()
140140
let session = LanguageModelSession(model: model)
141-
let prompt = Transcript.Prompt(segments: [
142-
.text(.init(content: "Describe this image")),
143-
.image(.init(url: testImageURL)),
144-
])
145141
do {
146-
_ = try await session.respond(to: prompt)
142+
_ = try await session.respond(
143+
to: "Describe this image",
144+
image: .init(url: testImageURL)
145+
)
147146
Issue.record("Expected error when image segments are present")
148147
} catch {
149148
// CoreMLUnsupportedFeatureError is a private struct, so we just check that an error is thrown
150-
#expect(true)
149+
#expect(Bool(true))
151150
}
152151
}
153152

154153
@Test @available(macOS 15.0, iOS 18.0, tvOS 18.0, visionOS 2.0, watchOS 11.0, *)
155154
func multimodal_rejectsImageData() async throws {
156155
let model = try await getModel()
157156
let session = LanguageModelSession(model: model)
158-
let prompt = Transcript.Prompt(segments: [
159-
.text(.init(content: "Describe this image")),
160-
.image(.init(data: testImageData, mimeType: "image/jpeg")),
161-
])
162157
do {
163-
_ = try await session.respond(to: prompt)
158+
_ = try await session.respond(
159+
to: "Describe this image",
160+
image: .init(data: testImageData, mimeType: "image/jpeg")
161+
)
164162
Issue.record("Expected error when image segments are present")
165163
} catch {
166164
// CoreMLUnsupportedFeatureError is a private struct, so we just check that an error is thrown
167-
#expect(true)
165+
#expect(Bool(true))
168166
}
169167
}
170168
}

Tests/AnyLanguageModelTests/MockLanguageModelTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct MockLanguageModelTests {
9494
try await Task.sleep(for: .milliseconds(50))
9595
#expect(asyncSession.isResponding == true)
9696

97-
let response = try await asyncTask.value
97+
_ = try await asyncTask.value
9898
try await Task.sleep(for: .milliseconds(10))
9999
#expect(asyncSession.isResponding == false)
100100
#expect(asyncSession.transcript.count == 2)

0 commit comments

Comments
 (0)