Skip to content

Commit 34af672

Browse files
Support for Swift 6 (#15)
1 parent 75766d6 commit 34af672

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+183
-156
lines changed

.github/workflows/build-examples.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
image:
21-
- swift:5.10.1-amazonlinux2
21+
- swift:6.1.2-amazonlinux2
2222
services:
2323
localstack:
2424
image: localstack/localstack
@@ -46,12 +46,12 @@ jobs:
4646
- name: Build ItemAPI
4747
run: |
4848
cd $GITHUB_WORKSPACE/src/Examples/ItemAPI/BreezeItemAPI
49-
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache
49+
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache --allow-network-connections docker
5050
- name: Build WebHook
5151
run: |
5252
cd $GITHUB_WORKSPACE/src/Examples/Webhook/BreezeWebHook
53-
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache
53+
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache --allow-network-connections docker
5454
- name: Build GitHubWebHook
5555
run: |
5656
cd $GITHUB_WORKSPACE/src/Examples/GitHubWebhook/BreezeGitHubWebHook
57-
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache
57+
swift package archive -c release --cache-path $GITHUB_WORKSPACE/cache --allow-network-connections docker
File renamed without changes.

.github/workflows/swift-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
image:
21-
- swift:5.7.3
22-
- swift:5.8.1
23-
- swift:5.9.2
21+
- swift:6.1.2
2422
- swift:5.10.1
2523
services:
2624
localstack:

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "swift",
5+
"request": "launch",
6+
"args": [],
7+
"cwd": "${workspaceFolder:Breeze}",
8+
"name": "Debug breeze",
9+
"program": "${workspaceFolder:Breeze}/.build/debug/breeze",
10+
"preLaunchTask": "swift: Build Debug breeze"
11+
},
12+
{
13+
"type": "swift",
14+
"request": "launch",
15+
"args": [],
16+
"cwd": "${workspaceFolder:Breeze}",
17+
"name": "Release breeze",
18+
"program": "${workspaceFolder:Breeze}/.build/release/breeze",
19+
"preLaunchTask": "swift: Build Release breeze"
20+
}
21+
]
22+
}

Docs/GenerateLambdaAPI.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ Refer to the [DynamoDB documentation](https://docs.aws.amazon.com/amazondynamodb
7171
To package the Lambda is required to create a Swift Package using the following `Package.swift` file.
7272

7373
```swift
74-
// swift-tools-version:5.7
74+
// swift-tools-version:6.1
7575
// The swift-tools-version declares the minimum version of Swift required to build this package.
7676

7777
import PackageDescription
7878

7979
let package = Package(
8080
name: "swift-breeze-item-api",
8181
platforms: [
82-
.macOS(.v13),
82+
.macOS(.v15),
8383
],
8484
products: [
8585
.executable(name: "ItemAPI", targets: ["ItemAPI"]),
@@ -97,7 +97,6 @@ let package = Package(
9797
)
9898
]
9999
)
100-
101100
```
102101

103102
To be executed on a Lambda, the package needs to be built on `AmazonLinux2` and deployed.

Examples/GitHubWebhook/BreezeGitHubWebHook/Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:6.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "BreezeGitHubWebHook",
88
platforms: [
9-
.macOS(.v13),
9+
.macOS(.v15),
1010
],
1111
products: [
1212
.executable(name: "GitHubWebHook", targets: ["GitHubWebHook"]),
1313
],
1414
dependencies: [
1515
.package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"),
16-
.package(url: "https://github.com/swift-serverless/BreezeLambdaWebHook.git", from: "0.5.0"),
17-
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha.2")
16+
.package(url: "https://github.com/swift-serverless/BreezeLambdaWebHook.git", branch: "main"),
17+
.package(url: "https://github.com/andrea-scuderi/swift-aws-lambda-runtime.git", branch: "main"),
1818
],
1919
targets: [
2020
.executableTarget(

Examples/GitHubWebhook/BreezeGitHubWebHook/Sources/GitHubWebHook/GitHubWebHook.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616
import AWSLambdaEvents
17-
import AWSLambdaRuntimeCore
17+
import AWSLambdaRuntime
1818
import BreezeLambdaWebHook
1919

2020
enum GitHubWebHookError: Error {
@@ -31,7 +31,7 @@ class GitHubWebHook: BreezeLambdaWebHookHandler {
3131
self.handlerContext = handlerContext
3232
}
3333

34-
private func validateGitHubSignature(context: AWSLambdaRuntimeCore.LambdaContext, event: AWSLambdaEvents.APIGatewayV2Request) throws -> String {
34+
private func validateGitHubSignature(context: LambdaContext, event: AWSLambdaEvents.APIGatewayV2Request) throws -> String {
3535
guard let key = Lambda.env("WEBHOOK_SECRET") else {
3636
throw GitHubWebHookError.invalidKey
3737
}
@@ -47,7 +47,7 @@ class GitHubWebHook: BreezeLambdaWebHookHandler {
4747
return payload
4848
}
4949

50-
func handle(context: AWSLambdaRuntimeCore.LambdaContext, event: AWSLambdaEvents.APIGatewayV2Request) async -> AWSLambdaEvents.APIGatewayV2Response {
50+
func handle(_ event: APIGatewayV2Request, context: LambdaContext) async -> APIGatewayV2Response {
5151
do {
5252
context.logger.info("event: \(event)")
5353
let payload = try validateGitHubSignature(context: context, event: event)

Examples/GitHubWebhook/BreezeGitHubWebHook/Sources/GitHubWebHook/main.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
import Foundation
1616
import AWSLambdaEvents
17-
import AWSLambdaRuntimeCore
17+
import AWSLambdaRuntime
1818
import BreezeLambdaWebHook
19+
import Logging
1920

20-
BreezeLambdaWebHook<GitHubWebHook>.main()
21+
try await BreezeLambdaWebHook<GitHubWebHook>(name:"GitHubWebHook").run()

Examples/GitHubWebhook/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM swift:5.10.1-amazonlinux2 as builder
1+
FROM swift:6.1.2-amazonlinux2 as builder
22
RUN yum -y update && \
33
yum -y install git zip

Examples/GitHubWebhook/Makefile

Lines changed: 2 additions & 2 deletions
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-
SWIFT_VERSION=5.10.1
15+
SWIFT_VERSION=6.1.2
1616
SWIFT_DOCKER_IMAGE=swift-amazonlinux2-builder:$(SWIFT_VERSION)
1717
SWIFT_CONFIGURATION=release
1818

@@ -32,7 +32,7 @@ archive_lambda: create_build_directory
3232
--volume "$(MOUNT_ROOT)/:/src" \
3333
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
3434
$(SWIFT_DOCKER_IMAGE) \
35-
/bin/bash -c "swift package archive -c $(SWIFT_CONFIGURATION) --verbose --output-path /src/$(DOCKER_BUILD_PATH)"
35+
/bin/bash -c "swift package archive -c $(SWIFT_CONFIGURATION) --verbose --output-path /src/$(DOCKER_BUILD_PATH) --allow-network-connections docker"
3636

3737
build_lambda:
3838
docker run \

0 commit comments

Comments
 (0)