Skip to content

Commit 1c4527b

Browse files
committed
fix ci
1 parent fa2a6e3 commit 1c4527b

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

.github/workflows/integration_tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ on:
1919
type: boolean
2020
description: "Boolean to enable the compilation of examples. Defaults to true."
2121
default: true
22+
archive_plugin_examples:
23+
type: string
24+
description: "The list of examples to run through the archive plugin test. Pass a String with a valid JSON array such as \"[ 'HelloWorld', 'APIGateway' ]\""
25+
required: true
26+
default: ""
2227
archive_plugin_enabled:
2328
type: boolean
2429
description: "Boolean to enable the test of the archive plugin. Defaults to true."
@@ -54,7 +59,7 @@ jobs:
5459
# We are using only one Swift version
5560
swift:
5661
- image: ${{ inputs.matrix_linux_swift_container_image }}
57-
swift_version: "6.0.1-amazonlinux2"
62+
swift_version: "6.0.3-amazonlinux2"
5863
container:
5964
image: ${{ matrix.swift.image }}
6065
steps:
@@ -98,6 +103,10 @@ jobs:
98103
name: Test archive plugin
99104
if: ${{ inputs.archive_plugin_enabled }}
100105
runs-on: ubuntu-latest
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
examples: ${{ fromJson(inputs.archive_plugin_examples) }}
101110
steps:
102111
- name: Checkout repository
103112
uses: actions/checkout@v4
@@ -107,8 +116,10 @@ jobs:
107116
# https://github.com/actions/checkout/issues/766
108117
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
109118
- name: Test the archive plugin
119+
env:
120+
EXAMPLE: ${{ matrix.examples }}
110121
run: |
111-
.github/workflows/scripts/check-archive-plugin.sh
122+
.github/workflows/scripts/check-archive-plugin.sh
112123
113124
check-foundation:
114125
name: No dependencies on Foundation

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
# We pass the list of examples here, but we can't pass an array as argument
3737
# Instead, we pass a String with a valid JSON array.
3838
# The workaround is mentioned here https://github.com/orgs/community/discussions/11692
39-
examples: "[ 'APIGateway', 'APIGateway+LambdaAuthorizer', 'BackgroundTasks', 'HelloJSON', 'HelloWorld', 'ResourcesPackaging', 'S3_AWSSDK', 'S3_Soto', 'Streaming', 'Testing', 'Tutorial' ]"
40-
39+
examples: "[ 'APIGateway', 'APIGateway+LambdaAuthorizer', 'BackgroundTasks', 'HelloJSON', 'HelloWorld', 'ResourcePackaging', 'S3_AWSSDK', 'S3_Soto', 'Streaming', 'Testing', 'Tutorial' ]"
40+
archive_plugin_examples: "[ 'HelloWorld', 'ResourcePackaging' ]"
4141
archive_plugin_enabled: true
4242

4343
swift-6-language-mode:

.github/workflows/scripts/check-archive-plugin.sh

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,35 @@
1313
##
1414
##===----------------------------------------------------------------------===##
1515

16-
check_archive_plugin() {
17-
local EXAMPLE=$1
18-
OUTPUT_DIR=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager
19-
OUTPUT_FILE=${OUTPUT_DIR}/MyLambda/bootstrap
20-
ZIP_FILE=${OUTPUT_DIR}/MyLambda/MyLambda.zip
16+
log() { printf -- "** %s\n" "$*" >&2; }
17+
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
18+
fatal() { error "$@"; exit 1; }
2119

22-
pushd "Examples/${EXAMPLE}" || exit 1
20+
test -n "${EXAMPLE:-}" || fatal "EXAMPLE unset"
2321

24-
# package the example (docker and swift toolchain are installed on the GH runner)
25-
LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker || exit 1
22+
OUTPUT_DIR=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager
23+
OUTPUT_FILE=${OUTPUT_DIR}/MyLambda/bootstrap
24+
ZIP_FILE=${OUTPUT_DIR}/MyLambda/MyLambda.zip
2625

27-
# did the plugin generated a Linux binary?
28-
[ -f "${OUTPUT_FILE}" ]
29-
file "${OUTPUT_FILE}" | grep --silent ELF
26+
pushd "Examples/${EXAMPLE}" || exit 1
3027

31-
# did the plugin created a ZIP file?
32-
[ -f "${ZIP_FILE}" ]
28+
# package the example (docker and swift toolchain are installed on the GH runner)
29+
LAMBDA_USE_LOCAL_DEPS=../.. swift package archive --allow-network-connections docker || exit 1
3330

34-
# does the ZIP file contain the bootstrap?
35-
unzip -l "${ZIP_FILE}" | grep --silent bootstrap
31+
# did the plugin generated a Linux binary?
32+
[ -f "${OUTPUT_FILE}" ]
33+
file "${OUTPUT_FILE}" | grep --silent ELF
3634

37-
# if EXAMPLE is ResourcesPackaging, check if the ZIP file contains hello.txt
38-
if [ "$EXAMPLE" == "ResourcesPackaging" ]; then
39-
unzip -l "${ZIP_FILE}" | grep --silent hello.txt
40-
fi
35+
# did the plugin created a ZIP file?
36+
[ -f "${ZIP_FILE}" ]
4137

42-
echo "✅ The archive plugin is OK with example ${EXAMPLE}"
43-
popd || exit 1
44-
}
38+
# does the ZIP file contain the bootstrap?
39+
unzip -l "${ZIP_FILE}" | grep --silent bootstrap
4540

46-
# List of examples
47-
EXAMPLES=("HelloWorld" "ResourcesPackaging")
41+
# if EXAMPLE is ResourcesPackaging, check if the ZIP file contains hello.txt
42+
if [ "$EXAMPLE" == "ResourcesPackaging" ]; then
43+
unzip -l "${ZIP_FILE}" | grep --silent hello.txt
44+
fi
4845

49-
# Iterate over each example and call check_archive_plugin
50-
for EXAMPLE in "${EXAMPLES[@]}"; do
51-
check_archive_plugin "$EXAMPLE"
52-
done
46+
echo "✅ The archive plugin is OK with example ${EXAMPLE}"
47+
popd || exit 1

0 commit comments

Comments
 (0)