Skip to content

Commit f275395

Browse files
committed
add integration test for the archive plugin
1 parent 59dd68a commit f275395

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

.github/workflows/examples_matrix.yml renamed to .github/workflows/examples.yml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ on:
1111
# type: sequence
1212
# description: "The examples to run."
1313
# required: true
14+
examples_enabled:
15+
type: boolean
16+
description: "Boolean to enable the compilation of examples. Defaults to true."
17+
default: true
18+
archive_plugin_enabled:
19+
type: boolean
20+
description: "Boolean to enable the test of the archive plugin. Defaults to true."
21+
default: true
1422
matrix_linux_command:
1523
type: string
1624
description: "The command of the current Swift version linux matrix job to execute."
@@ -26,8 +34,9 @@ concurrency:
2634
cancel-in-progress: true
2735

2836
jobs:
29-
linux:
30-
name: Example/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
37+
test-examples:
38+
name: Test Examples/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
39+
if: ${{ inputs.examples_enabled }}
3140
runs-on: ubuntu-latest
3241
strategy:
3342
fail-fast: false
@@ -78,3 +87,42 @@ jobs:
7887
EXAMPLE: ${{ matrix.examples }}
7988
run: |
8089
./scripts/integration_tests.sh
90+
echo "✅ The examples compile correctly"
91+
92+
test-archive-plugin:
93+
name: Test archive plugin
94+
if: ${{ inputs.archive_plugin_enabled }}
95+
runs-on: ubuntu-latest
96+
strategy:
97+
fail-fast: false
98+
steps:
99+
- name: Checkout repository
100+
uses: actions/checkout@v4
101+
with:
102+
persist-credentials: false
103+
- name: Mark the workspace as safe
104+
# https://github.com/actions/checkout/issues/766
105+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
106+
- name: Test the archive plugin
107+
env:
108+
EXAMPLE=HelloWorld
109+
OUTPUT_FILE=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/bootstrap
110+
ZIP_FILE=.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/MyLambda.zip
111+
run: |
112+
pushd Examples/${EXAMPLE}
113+
114+
# package the example (docker and swift toolchain are installed on the GH runner)
115+
echo yes | swift package archive --allow-network-connection docker
116+
117+
# did the plugin generated a Linux binary?
118+
[ -f ${OUTPUT_FILE} ]
119+
file ${OUTPUT_FILE} | grep --silent ELF
120+
121+
# did the plugin created a ZIP file?
122+
[ -f ${ZIP_FILE} ]
123+
124+
# does the ZIP file contain the bootstrap?
125+
unzip -l ${ZIP_FILE} | grep --silent bootstrap
126+
127+
echo "✅ The archive plugin is OK"
128+
popd

.github/workflows/pull_request.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ jobs:
2727

2828
integration-tests:
2929
name: Integration Tests
30-
uses: ./.github/workflows/examples_matrix.yml
30+
uses: ./.github/workflows/examples.yml
3131
with:
32+
name: "Integration tests"
33+
examples_enabled: true
3234
# We should pass the list of examples here, but we can't pass an array as argument
3335
# examples: [ "HelloWorld", "APIGateway" ]
34-
name: "Integration tests"
3536
matrix_linux_command: "LAMBDA_USE_LOCAL_DEPS=../.. swift build"
37+
archive_plugin_enabled: true
3638

3739
swift-6-language-mode:
3840
name: Swift 6 Language Mode

0 commit comments

Comments
 (0)