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
2836jobs :
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
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
0 commit comments