@@ -20,28 +20,30 @@ fatal() { error "$@"; exit 1; }
2020test -n " ${EXAMPLE:- } " || fatal " EXAMPLE unset"
2121
2222OUTPUT_DIR=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager
23- OUTPUT_FILE=${OUTPUT_DIR} /MyLambda/bootstrap
24- ZIP_FILE=${OUTPUT_DIR} /MyLambda/MyLambda.zip
2523
2624pushd " Examples" || exit 1
2725
2826# package the example (docker and swift toolchain are installed on the GH runner)
2927LAMBDA_USE_LOCAL_DEPS=.. swift package archive --product " ${EXAMPLE} " --allow-network-connections docker || exit 1
3028
29+ # find the zip file in the OUTPUT_FILE directory
30+ ZIP_FILE=$( find " ${OUTPUT_DIR} " -type f -name " *.zip" | head -n 1)
31+ OUTPUT_FILE=$( find " ${OUTPUT_DIR} " -type f -name " bootstrap" | head -n 1)
32+
3133# did the plugin generated a Linux binary?
32- [ -f " ${OUTPUT_FILE} " ]
33- file " ${OUTPUT_FILE} " | grep --silent ELF
34+ [ -f " ${OUTPUT_FILE} " ] || exit 1
35+ file " ${OUTPUT_FILE} " | grep --silent ELF || exit 1
3436
3537# did the plugin created a ZIP file?
36- [ -f " ${ZIP_FILE} " ]
38+ [ -f " ${ZIP_FILE} " ] || exit 1
3739
3840# does the ZIP file contain the bootstrap?
39- unzip -l " ${ZIP_FILE} " | grep --silent bootstrap
41+ unzip -l " ${ZIP_FILE} " | grep --silent bootstrap || exit 1
4042
4143# if EXAMPLE is ResourcesPackaging, check if the ZIP file contains hello.txt
4244if [ " $EXAMPLE " == " ResourcesPackaging" ]; then
4345 echo " Checking if resource was added to the ZIP file"
44- unzip -l " ${ZIP_FILE} " | grep --silent hello.txt
46+ unzip -l " ${ZIP_FILE} " | grep --silent hello.txt
4547 SUCCESS=$?
4648 if [ " $SUCCESS " -eq 1 ]; then
4749 log " ❌ Resource not found." && exit 1
0 commit comments