11
11
# type: sequence
12
12
# description: "The examples to run."
13
13
# 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
14
22
matrix_linux_command :
15
23
type : string
16
24
description : " The command of the current Swift version linux matrix job to execute."
@@ -26,8 +34,9 @@ concurrency:
26
34
cancel-in-progress : true
27
35
28
36
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 }}
31
40
runs-on : ubuntu-latest
32
41
strategy :
33
42
fail-fast : false
78
87
EXAMPLE : ${{ matrix.examples }}
79
88
run : |
80
89
./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
0 commit comments