Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ jobs:
- name: Cache SPM dependencies
uses: actions/cache@v5
with:
path: Examples/APIGatewayV2/.build
key: spm-foundation-${{ runner.os }}-${{ hashFiles('Examples/APIGatewayV2/Package.swift') }}
path: Examples/HelloWorldNoTraits/.build
key: spm-foundation-${{ runner.os }}-${{ hashFiles('Examples/HelloWorldNoTraits/Package.swift') }}
restore-keys: |
spm-foundation-${{ runner.os }}-

Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/scripts/check-link-foundation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ log() { printf -- "** %s\n" "$*" >&2; }
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
fatal() { error "$@"; exit 1; }

EXAMPLE=APIGatewayV2
EXAMPLE=HelloWorldNoTraits
OUTPUT_DIR=.build/release
OUTPUT_FILE=${OUTPUT_DIR}/APIGatewayLambda
OUTPUT_FILE=${OUTPUT_DIR}/MyLambda
LIBS_TO_CHECK="libFoundation.so libFoundationInternationalization.so lib_FoundationICU.so"

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

# recompile the example without the --static-swift-stdlib flag
swift build -c release || fatal "Failed to build the example."
Expand All @@ -39,21 +39,20 @@ for LIB in ${LIBS_TO_CHECK}; do
echo -n "Checking for ${LIB}... "

# check if the binary has a dependency on Foundation or ICU
echo "${LIBRARIES}" | grep "${LIB}" # return 1 if not found

# 1 is success (grep failed to find the lib), 0 is failure (grep successly found the lib)
SUCCESS=$?
if [ "$SUCCESS" -eq 0 ]; then
# grep -q suppresses output; returns 0 if found, 1 if not found
echo "${LIBRARIES}" | grep -q "${LIB}"
FOUND=$?
if [ "$FOUND" -eq 0 ]; then
log "❌ ${LIB} found." && break
else
log "✅ ${LIB} not found."
fi
done

popd || fatal "Failed to change directory back to the root directory."
popd > /dev/null || fatal "Failed to change directory back to the root directory."

# exit code is the opposite of the grep exit code
if [ "$SUCCESS" -eq 0 ]; then
# FOUND is 0 if grep matched (lib was found), 1 if not
if [ "$FOUND" -eq 0 ]; then
fatal "❌ At least one foundation lib was found, reporting the error."
else
log "✅ No foundation lib found, congrats!" && exit 0
Expand Down
5 changes: 3 additions & 2 deletions Examples/HelloWorldNoTraits/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ let package = Package(
],
dependencies: [
// For local development (default)
.package(name: "swift-aws-lambda-runtime", path: "../..")
// No traits are enabled — this example deliberately avoids Foundation
.package(name: "swift-aws-lambda-runtime", path: "../..", traits: [])

// 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.0.0", traits: []),
],
targets: [
.executableTarget(
Expand Down