Skip to content

Commit 1bcb098

Browse files
authored
Attempt to fix CI (#162)
* Temporarily remove Swift 6.1 from the CI matrix. mlx-swift-lm 3.x upgraded Swift version, which fails to compile with strict concurrency for SDKs earlier than 26. An alternative would be to test the "MLX" trait separately on just Xcode 26, and keep the full matrix for the rest of traits. * Use NIOCore to restore Linux compatibility. Graph resolution changed after the bump to mlx-swift-lm 3 and it looks like NIOFoundationCompat is no longer there.
1 parent d191b22 commit 1bcb098

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
include:
23-
- macos: "15"
24-
swift: "6.1"
25-
xcode: "16.3"
26-
traits: ""
27-
- macos: "15"
28-
swift: "6.1"
29-
xcode: "16.3"
30-
traits: "AsyncHTTPClient"
23+
# Temporarily remove Swift 6.1 because mlx-swift-lm 3 uses Swift 6 mode and there's
24+
# a strict concurrency error on a non-sendable CIContext.
25+
# - macos: "15"
26+
# swift: "6.1"
27+
# xcode: "16.3"
28+
# traits: ""
29+
# - macos: "15"
30+
# swift: "6.1"
31+
# xcode: "16.3"
32+
# traits: "AsyncHTTPClient"
3133
- macos: "26"
3234
swift: "6.2"
3335
xcode: "26.0"

Sources/AnyLanguageModel/Extensions/HTTPClient+Extensions.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import Foundation
1414
import NIOCore
1515
import NIOHTTP1
16-
import NIOFoundationCompat
1716

1817
extension HTTPClient {
1918
func fetch<T: Decodable>(
@@ -32,21 +31,21 @@
3231
}
3332

3433
if let body {
35-
request.body = .bytes(ByteBuffer(data: body))
34+
request.body = .bytes(ByteBuffer(bytes: body))
3635
request.headers.add(name: "Content-Type", value: "application/json")
3736
}
3837

3938
let response = try await self.execute(request, timeout: .seconds(180))
4039

4140
guard (200 ..< 300).contains(response.status.code) else {
42-
let bodyData = try await Data(buffer: response.body.collect(upTo: 1024 * 1024))
41+
let bodyData = try await Data(response.body.collect(upTo: 1024 * 1024).readableBytesView)
4342
if let errorString = String(data: bodyData, encoding: .utf8) {
4443
throw HTTPClientError.httpError(statusCode: Int(response.status.code), detail: errorString)
4544
}
4645
throw HTTPClientError.httpError(statusCode: Int(response.status.code), detail: "Invalid response")
4746
}
4847

49-
let bodyData = try await Data(buffer: response.body.collect(upTo: 1024 * 1024))
48+
let bodyData = try await Data(response.body.collect(upTo: 1024 * 1024).readableBytesView)
5049

5150
let decoder = JSONDecoder()
5251
decoder.dateDecodingStrategy = dateDecodingStrategy
@@ -80,14 +79,14 @@
8079
}
8180

8281
if let body {
83-
request.body = .bytes(ByteBuffer(data: body))
82+
request.body = .bytes(ByteBuffer(bytes: body))
8483
request.headers.add(name: "Content-Type", value: "application/json")
8584
}
8685

8786
let response = try await self.execute(request, timeout: .seconds(60))
8887

8988
guard (200 ..< 300).contains(response.status.code) else {
90-
let bodyData = try await Data(buffer: response.body.collect(upTo: 1024 * 1024))
89+
let bodyData = try await Data(response.body.collect(upTo: 1024 * 1024).readableBytesView)
9190
if let errorString = String(data: bodyData, encoding: .utf8) {
9291
throw HTTPClientError.httpError(
9392
statusCode: Int(response.status.code),
@@ -149,14 +148,14 @@
149148
}
150149

151150
if let body {
152-
request.body = .bytes(ByteBuffer(data: body))
151+
request.body = .bytes(ByteBuffer(bytes: body))
153152
request.headers.add(name: "Content-Type", value: "application/json")
154153
}
155154

156155
let response = try await self.execute(request, timeout: .seconds(60))
157156

158157
guard (200 ..< 300).contains(response.status.code) else {
159-
let bodyData = try await Data(buffer: response.body.collect(upTo: 1024 * 1024))
158+
let bodyData = try await Data(response.body.collect(upTo: 1024 * 1024).readableBytesView)
160159
if let errorString = String(data: bodyData, encoding: .utf8) {
161160
throw HTTPClientError.httpError(
162161
statusCode: Int(response.status.code),

0 commit comments

Comments
 (0)