Skip to content
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

chore: setup SwiftLint #13

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 4 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ on:

jobs:
test-ios:
runs-on: macos-13
runs-on: macos-13-arm64

steps:
- uses: actions/checkout@v3

- name: Build and test
run: xcodebuild test -scheme OllamaKit -destination 'platform=iOS Simulator,name=iPhone 14 Pro'
run: xcodebuild test -scheme OllamaKit -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

test-macos:
runs-on: macos-13
runs-on: macos-13-arm64

steps:
- uses: actions/checkout@v3

- name: Build and test
run: xcodebuild test -scheme OllamaKit -destination 'platform=macOS,arch=x86_64'
run: xcodebuild test -scheme OllamaKit -destination 'platform=macOS,arch=arm64'
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
disabled_rules:
- line_length
- nesting
- trailing_whitespace
81 changes: 81 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,42 @@
"version" : "5.8.1"
}
},
{
"identity" : "collectionconcurrencykit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
"state" : {
"revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
"version" : "0.2.0"
}
},
{
"identity" : "cryptoswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c",
"version" : "1.8.1"
}
},
{
"identity" : "sourcekitten",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/SourceKitten.git",
"state" : {
"revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
"version" : "0.34.1"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
Expand All @@ -26,6 +62,51 @@
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "swiftlint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/SwiftLint",
"state" : {
"revision" : "f17a4f9dfb6a6afb0408426354e4180daaf49cee",
"version" : "0.54.0"
}
},
{
"identity" : "swiftytexttable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
"state" : {
"revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
"version" : "0.9.0"
}
},
{
"identity" : "swxmlhash",
"kind" : "remoteSourceControl",
"location" : "https://github.com/drmohundro/SWXMLHash.git",
"state" : {
"revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
"version" : "7.0.2"
}
},
{
"identity" : "yams",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/Yams.git",
"state" : {
"revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
"version" : "5.0.6"
}
}
],
"version" : 2
Expand Down
14 changes: 10 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ let package = Package(
name: "OllamaKit",
platforms: [
.iOS(.v13),
.macOS(.v11),
.macCatalyst(.v13)
.macOS(.v12)
],
products: [
.library(
Expand All @@ -17,12 +16,19 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.8.1")),
.package(url: "https://github.com/apple/swift-docc-plugin.git", .upToNextMajor(from: "1.3.0"))
.package(url: "https://github.com/apple/swift-docc-plugin.git", .upToNextMajor(from: "1.3.0")),
.package(url: "https://github.com/realm/SwiftLint.git", .upToNextMajor(from: "0.54.0"))
],
targets: [
.target(
name: "OllamaKit",
dependencies: ["Alamofire"]),
dependencies: [
.product(name: "Alamofire", package: "Alamofire")
],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "SwiftLint")
]
),
.testTarget(
name: "OllamaKitTests",
dependencies: ["OllamaKit", "Alamofire"]),
Expand Down
2 changes: 1 addition & 1 deletion Sources/OllamaKit/OllamaKit+CopyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension OllamaKit {
///
/// - Parameter data: The ``OKCopyModelRequestData`` containing the details needed to copy the model.
/// - Throws: An error if the request to copy the model fails.
public func copyModel(data: OKCopyModelRequestData) async throws -> Void {
public func copyModel(data: OKCopyModelRequestData) async throws {
let request = AF.request(router.copyModel(data: data)).validate()
_ = try await request.serializingData().response.result.get()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OllamaKit/OllamaKit+DeleteModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension OllamaKit {
///
/// - Parameter data: The ``OKDeleteModelRequestData`` containing the details needed to delete the model.
/// - Throws: An error if the request to delete the model fails.
public func deleteModel(data: OKDeleteModelRequestData) async throws -> Void {
public func deleteModel(data: OKDeleteModelRequestData) async throws {
let request = AF.request(router.deleteModel(data: data)).validate()
_ = try await request.serializingData().response.result.get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct OKGenerateEmbeddingsRequestData: Encodable {
public var options: OKCompletionOptions?

/// Optionally control how long the model will stay loaded into memory following the request (default: 5m)
public var keep_alive: String?
public var keepAlive: String?

public init(model: String, prompt: String) {
self.model = model
Expand Down
Loading