Skip to content

Commit 7f9bb20

Browse files
committed
move commands to separate script for easier debugging
1 parent 10d6946 commit 7f9bb20

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

.github/workflows/integration_tests.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,5 @@ jobs:
153153
OUTPUT_FILE: APIGatewayLambda
154154
LIBS_TO_CHECK: "libFoundation.so libFoundationInternationalization.so lib_FoundationICU.so"
155155
run: |
156-
pushd Examples/${EXAMPLE}
157-
158-
# recompile the example without the --static-swift-stdlib flag
159-
LAMBDA_USE_LOCAL_DEPS=../.. swift build -c release -Xlinker -s
160-
161-
echo "Checking for Foundation or ICU dependencies in ${OUTPUT_DIR}/${OUTPUT_FILE}"
162-
for LIB in ${LIBS_TO_CHECK}; do
163-
# check if the binary has a dependency on Foundation or ICU
164-
ldd ${OUTPUT_DIR}/${OUTPUT_FILE} | grep ${LIB} # return 1 if not found
165-
# 1 is success (grep failed to find the lib), 0 is failure (grep successly found the lib)
166-
SUCCESS=$?
167-
[ $SUCCESS -eq 0 ] && echo "${LIB} found" && break
168-
done
169-
170-
popd
156+
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-docs.sh | bash
171157
172-
# exit code is the opposite of the grep exit code
173-
echo "Success: $SUCCESS"
174-
[ $SUCCESS -eq 0 ] && exit 1 || exit 0
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the SwiftAWSLambdaRuntime open source project
5+
##
6+
## Copyright (c) 2017-2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
16+
#!/bin/bash
17+
18+
EXAMPLE=APIGateway
19+
OUTPUT_DIR=.build/release
20+
OUTPUT_FILE=${OUTPUT_DIR}/APIGatewayLambda
21+
LIBS_TO_CHECK="libFoundation.so libFoundationInternationalization.so lib_FoundationICU.so"
22+
23+
pushd Examples/${EXAMPLE} || exit 1
24+
25+
# recompile the example without the --static-swift-stdlib flag
26+
LAMBDA_USE_LOCAL_DEPS=../.. swift build -c release -Xlinker -s
27+
28+
# check if the binary exists
29+
if [ ! -f "${OUTPUT_FILE}" ]; then
30+
echo "${OUTPUT_FILE} does not exist."
31+
exit 1
32+
fi
33+
34+
# Checking for Foundation or ICU dependencies
35+
echo "Checking for Foundation or ICU dependencies in ${OUTPUT_DIR}/${OUTPUT_FILE}."
36+
LIBRARIES=$(ldd ${OUTPUT_FILE} | awk '{print $1}')
37+
for LIB in ${LIBS_TO_CHECK}; do
38+
echo -n "Checking for ${LIB}... "
39+
40+
# check if the binary has a dependency on Foundation or ICU
41+
echo "${LIBRARIES}" | grep "${LIB}" # return 1 if not found
42+
43+
# 1 is success (grep failed to find the lib), 0 is failure (grep successly found the lib)
44+
SUCCESS=$?
45+
[ "$SUCCESS" -eq 0 ] && echo "${LIB} found." && break || echo "${LIB} not found."
46+
done
47+
48+
popd || exit 1
49+
50+
# exit code is the opposite of the grep exit code
51+
[ "$SUCCESS" -eq 0 ] && echo "❌ At least one foundation lib was found, reporting the error." && exit 1 || echo "✅ No foundation lib found, congrats!" && exit 0

0 commit comments

Comments
 (0)