Skip to content

Commit 8cadfee

Browse files
authored
Merge pull request #11 from FunctionCalling/feature/lint
add github actions and fix lint
2 parents b510b88 + c1addc0 commit 8cadfee

4 files changed

Lines changed: 36 additions & 9 deletions

File tree

.github/workflows/swift.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: Swift
5+
6+
on:
7+
push:
8+
branches: "*"
9+
pull_request:
10+
branches: "*"
11+
jobs:
12+
build:
13+
runs-on: macos-15
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install swiftlint
17+
run: |
18+
brew update
19+
brew install swiftlint
20+
- name: Lint
21+
run: swiftlint
22+
- name: Build
23+
run: swift build -v
24+
- name: Run tests
25+
run: swift test -v

Package.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ let package = Package(
1313
// Products define the executables and libraries a package produces, making them visible to other packages.
1414
.library(
1515
name: "FunctionCalling-AWSBedrock",
16-
targets: ["FunctionCalling-AWSBedrock"]),
16+
targets: ["FunctionCalling-AWSBedrock"]
17+
)
1718
],
1819
dependencies: [
1920
.package(url: "https://github.com/FunctionCalling/FunctionCalling", from: "0.5.0"),
20-
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.36"),
21+
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.36")
2122
],
2223
targets: [
2324
// Targets are the basic building blocks of a package, defining a module or a test suite.
@@ -32,6 +33,6 @@ let package = Package(
3233
.testTarget(
3334
name: "FunctionCalling-AWSBedrockTests",
3435
dependencies: ["FunctionCalling-AWSBedrock"]
35-
),
36+
)
3637
]
3738
)

Sources/FunctionCalling-AWSBedrock/FunctionCalling-AWSBedrock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Foundation
77

88
extension ToolContainer {
99
typealias FunctionCallingTool = FunctionCalling.Tool
10-
10+
1111
public var bedrockAllTools: [BedrockRuntimeClientTypes.Tool] {
1212
get throws {
1313
guard let functionCallingTools = allTools else {

Tests/FunctionCalling-AWSBedrockTests/FunctionCalling-AWSBedrockTests.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ actor BedrockTests {
1212
func getWeather(location: String) -> String {
1313
return "Sunny"
1414
}
15-
15+
1616
@CallableFunction
1717
func getStock(args: String) -> Int {
1818
return 0
@@ -21,18 +21,19 @@ actor BedrockTests {
2121

2222
@Test func checkConvertedResults() async throws {
2323
let functions = try FunctionContainer().bedrockAllTools
24-
24+
2525
#expect(functions.count == 2)
26-
26+
2727
let getWeather = try #require(functions.first?.toolSpecification)
2828
#expect(getWeather.name == "getWeather")
29+
// swiftlint:disable line_length
2930
#expect(getWeather.description == """
3031
Return current weather of location that passed by the argument- Parameter location: location that- Returns: string of weather
3132
""")
32-
33+
// swiftlint:enable line_length
34+
3335
let getStock = try #require(functions[1].toolSpecification)
3436
#expect(getStock.name == "getStock")
3537
#expect(getStock.description == "")
3638
}
3739
}
38-

0 commit comments

Comments
 (0)