Skip to content

Commit f630aae

Browse files
authored
Add a test for Swift 6.1 with Lambda Runtime v2 (#2585)
* Add a test for Swift 6.1 with Lambda Runtime v2 * update README
1 parent 955dccc commit f630aae

9 files changed

Lines changed: 151 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ s3-uploader/runtimes/llrt_on_provided_al2023/bootstrap
2323
s3-uploader/runtimes/llrt_on_provided_al2023/llrt-lambda-x64.zip
2424
s3-uploader/runtimes/llrt_on_provided_al2023/llrt-lambda-arm64.zip
2525
s3-uploader/runtimes/*/code*.zip
26+
s3-uploader/runtimes/swift*/.build
2627

2728
result-builder/node_modules
2829

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ in addition to the following custom runtimes:
5858
- `graalvm java21` on `provided.al2023`
5959
- `graalvm java23` on `provided.al2023`
6060
- `apple swift 5.8` on `provided.al2`
61+
- `apple swift 6.1` on `provided.al2`
6162
- `bun` on `provided.al2` (with and without layer)
6263
- `llrt` on `provided.al2023`
6364
- `shell` on `provided.al2`

manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"memorySizes": [128, 256, 512, 1024],
33
"runtimes": [
4+
{
5+
"displayName": "apple swift 6.1 (prov.al2)",
6+
"runtime": "provided.al2",
7+
"handler": "SimpleLambdaHandler",
8+
"path": "swift61_on_provided_al2",
9+
"architectures": ["x86_64", "arm64"],
10+
"image": {
11+
"baseImage": "public.ecr.aws/lambda/provided:al2"
12+
}
13+
},
414
{
515
"displayName": "apple swift 5.8 (prov.al2)",
616
"runtime": "provided.al2",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/
2+
.swiftpm/
3+
.build/
4+
*.zip
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM public.ecr.aws/docker/library/swift:6.1-amazonlinux2 AS builder
2+
RUN mkdir -p /tmp/app/src
3+
COPY . /tmp/app/src/
4+
WORKDIR /tmp/app/src/
5+
RUN yum install zip -y
6+
RUN swift package archive --allow-network-connections docker --output-path /tmp/app/ --verbose 2
7+
8+
FROM scratch
9+
COPY --from=builder /tmp/app/MaxdayLambda/MaxdayLambda.zip /code.zip
10+
ENTRYPOINT ["/code.zip"]

s3-uploader/runtimes/swift61_on_provided_al2/Package.resolved

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// swift-tools-version: 6.1
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "MaxdayLambda",
7+
platforms: [.macOS(.v15)],
8+
products: [
9+
.executable(name: "MaxdayLambda", targets: ["MaxdayLambda"]),
10+
],
11+
dependencies: [
12+
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "2.0.0-beta.3"),
13+
],
14+
targets: [
15+
.executableTarget(name: "MaxdayLambda", dependencies: [
16+
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
17+
]),
18+
]
19+
)
20+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import AWSLambdaRuntime
2+
3+
let runtime = LambdaRuntime {
4+
(event: String, context: LambdaContext) in
5+
"OK"
6+
}
7+
8+
try await runtime.run()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
DIR_NAME="./runtimes/$1"
4+
5+
if [ $2 = "x86_64" ]; then
6+
ARCH="linux/amd64"
7+
elif [ $2 = "arm64" ]; then
8+
ARCH="linux/arm64/v8"
9+
else
10+
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
11+
exit 1
12+
fi
13+
14+
rm ${DIR_NAME}/code_${2}.zip 2> /dev/null
15+
16+
docker build ${DIR_NAME} --platform ${ARCH} -t maxday/swift61_on_provided_al2_${2}
17+
dockerId=$(docker create maxday/swift61_on_provided_al2_${2})
18+
19+
docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip

0 commit comments

Comments
 (0)