Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/scripts/check-archive-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ fatal() { error "$@"; exit 1; }

test -n "${EXAMPLE:-}" || fatal "EXAMPLE unset"

# Use the local checkout of swift-aws-lambda-runtime instead of the published release
.github/workflows/scripts/use-local-deps.sh "Examples/${EXAMPLE}/Package.swift"

OUTPUT_DIR=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager
OUTPUT_FILE=${OUTPUT_DIR}/MyLambda/bootstrap
ZIP_FILE=${OUTPUT_DIR}/MyLambda/MyLambda.zip
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scripts/check-link-foundation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ OUTPUT_DIR=.build/release
OUTPUT_FILE=${OUTPUT_DIR}/APIGatewayLambda
LIBS_TO_CHECK="libFoundation.so libFoundationInternationalization.so lib_FoundationICU.so"

# Use the local checkout of swift-aws-lambda-runtime instead of the published release
.github/workflows/scripts/use-local-deps.sh "Examples/${EXAMPLE}/Package.swift"

pushd Examples/${EXAMPLE} || fatal "Failed to change directory to Examples/${EXAMPLE}."

# recompile the example without the --static-swift-stdlib flag
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ test -n "${SWIFT_VERSION:-}" || fatal "SWIFT_VERSION unset"
test -n "${COMMAND:-}" || fatal "COMMAND unset"
test -n "${EXAMPLE:-}" || fatal "EXAMPLE unset"

# Use the local checkout of swift-aws-lambda-runtime instead of the published release
.github/workflows/scripts/use-local-deps.sh "Examples/$EXAMPLE/Package.swift"

pushd Examples/"$EXAMPLE" > /dev/null

log "Running command with Swift $SWIFT_VERSION"
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/scripts/use-local-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftAWSLambdaRuntime open source project
##
## Copyright (c) 2017-2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##

# Rewrites a Package.swift to use the local path dependency instead of the remote URL.
# This ensures CI tests against the current branch.
#
# Usage: .github/workflows/scripts/use-local-deps.sh <path-to-Package.swift>

set -euo pipefail

log() { printf -- "** %s\n" "$*" >&2; }

PACKAGE_FILE="${1:?Usage: use-local-deps.sh <path-to-Package.swift>}"

log "Switching swift-aws-lambda-runtime dependency to local path in $PACKAGE_FILE"
sed -i \
-e 's|// *\.package(name: "swift-aws-lambda-runtime", path: "\.\./\.\.")|.package(name: "swift-aws-lambda-runtime", path: "../..")|' \
-e 's|\.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime\.git", from: "[^"]*")|// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "0.0.0")|' \
"$PACKAGE_FILE"
7 changes: 3 additions & 4 deletions Examples/APIGatewayV1/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "APIGatewayLambda", targets: ["APIGatewayLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/APIGatewayV2+LambdaAuthorizer/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ let package = Package(
.executable(name: "AuthorizerLambda", targets: ["AuthorizerLambda"]),
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/APIGatewayV2/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "APIGatewayLambda", targets: ["APIGatewayLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/BackgroundTasks/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "BackgroundTasks", targets: ["BackgroundTasks"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
7 changes: 3 additions & 4 deletions Examples/CDK/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "APIGatewayLambda", targets: ["APIGatewayLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/HelloJSON/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "HelloJSON", targets: ["HelloJSON"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
7 changes: 3 additions & 4 deletions Examples/HelloWorld/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "MyLambda", targets: ["MyLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
7 changes: 3 additions & 4 deletions Examples/HelloWorldNoTraits/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "MyLambda", targets: ["MyLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
9 changes: 3 additions & 6 deletions Examples/JSONLogging/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ let package = Package(
.executable(name: "JSONLogging", targets: ["JSONLogging"])
],
dependencies: [
// For local development (default)
// When using the below line, use LAMBDA_USE_LOCAL_DEPS=../.. for swift package archive command, e.g.
// `LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker`
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
2 changes: 1 addition & 1 deletion Examples/JSONLogging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ AWS_LAMBDA_LOG_FORMAT=JSON swift run

```bash
swift build
LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker
swift package archive --allow-network-connections docker
```

The deployment package will be at:
Expand Down
9 changes: 3 additions & 6 deletions Examples/ManagedInstances/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ let package = Package(
.executable(name: "BackgroundTasks", targets: ["BackgroundTasks"]),
],
dependencies: [
// For local development (default)
// When using the below line, use LAMBDA_USE_LOCAL_DEPS=../.. for swift package archive command, e.g.
// `LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker`
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
5 changes: 1 addition & 4 deletions Examples/ManagedInstances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ arn:aws:lambda:us-west-2:486652066693:capacity-provider:TestEC2
## Deployment

```bash
# Build the Swift packages
# when compiling a standalone or new project
# Build and package the Swift Lambda function
swift package archive --allow-network-connections docker
# When compiling the example in this repository
# LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker

# Change the values below to match your setup
REGION=us-west-2
Expand Down
7 changes: 3 additions & 4 deletions Examples/MultiSourceAPI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "MultiSourceAPI", targets: ["MultiSourceAPI"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/MultiTenant/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ let package = Package(
.executable(name: "MultiTenantLocal", targets: ["MultiTenantLocal"]),
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/ResourcesPackaging/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "MyLambda", targets: ["MyLambda"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../..")

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0")
],
targets: [
.executableTarget(
Expand Down
7 changes: 3 additions & 4 deletions Examples/S3EventNotifier/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ let package = Package(
name: "S3EventNotifier",
platforms: [.macOS(.v15)],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/S3_AWSSDK/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "AWSSDKExample", targets: ["AWSSDKExample"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.0"),
Expand Down
7 changes: 3 additions & 4 deletions Examples/S3_Soto/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "SotoExample", targets: ["SotoExample"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
.package(url: "https://github.com/soto-project/soto.git", from: "7.0.0"),
Expand Down
7 changes: 3 additions & 4 deletions Examples/ServiceLifecycle+Postgres/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.macOS(.v15)
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.4.0"),
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.30.0"),
Expand Down
7 changes: 3 additions & 4 deletions Examples/Streaming+APIGateway/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "StreamingNumbers", targets: ["StreamingNumbers"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
targets: [
Expand Down
7 changes: 3 additions & 4 deletions Examples/Streaming+Codable/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ let package = Package(
name: "StreamingCodable",
platforms: [.macOS(.v15)],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
7 changes: 3 additions & 4 deletions Examples/Streaming+FunctionUrl/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ let package = Package(
.executable(name: "StreamingNumbers", targets: ["StreamingNumbers"])
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../.."),
// For local development, uncomment the line below and comment the remote dependency:
// .package(name: "swift-aws-lambda-runtime", path: "../.."),

// For standalone usage, comment the line above and uncomment below:
// .package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0"),
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.9.0"),

.package(url: "https://github.com/awslabs/swift-aws-lambda-events.git", from: "1.0.0"),
],
Expand Down
Loading
Loading