@@ -234,12 +234,83 @@ jobs:
234234 Post-build run skipped because no plugins were built.
235235 token : ${{ steps.get_token.outputs.token }}
236236
237- upgrade_test :
238- name : Test plugin upgrades
237+ prepare_upgrade_test :
238+ name : Prepare plugin upgrades matrix
239239 runs-on : ubuntu-latest
240240 needs : [ setup, find_artifact ]
241241 if : needs.find_artifact.outputs.any_plugins == 'true'
242+ outputs :
243+ matrix : ${{ steps.matrix.outputs.matrix }}
244+ timeout-minutes : 5 # 2025-03-13: Should be just a few seconds.
245+
246+ steps :
247+ - uses : actions/checkout@v4
248+
249+ - name : Get token
250+ id : get_token
251+ uses : ./.github/actions/gh-app-token
252+ env :
253+ # Work around a weird node 16/openssl 3 issue in the docker env
254+ OPENSSL_CONF : ' /dev/null'
255+ with :
256+ app_id : ${{ secrets.JP_LAUNCH_CONTROL_ID }}
257+ private_key : ${{ secrets.JP_LAUNCH_CONTROL_KEY }}
258+
259+ - name : Notify check in progress
260+ uses : ./.github/actions/check-run
261+ with :
262+ id : ${{ needs.setup.outputs.upgrade_check }}
263+ status : in_progress
264+ title : Test started...
265+ summary : |
266+ ${{ env.SUMMARY }}
267+
268+ See run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
269+ token : ${{ steps.get_token.outputs.token }}
270+
271+ - name : Download build artifact
272+ env :
273+ TOKEN : ${{ github.token }}
274+ ZIPURL : ${{ needs.find_artifact.outputs.zip_url }}
275+ shell : bash
276+ run : |
277+ for (( i=1; i<=2; i++ )); do
278+ [[ $i -gt 1 ]] && sleep 10
279+ echo "::group::Downloading artifact (attempt $i/2)"
280+ curl -v -L --get \
281+ --header "Authorization: token $TOKEN" \
282+ --url "$ZIPURL" \
283+ --output "artifact.zip"
284+ echo "::endgroup::"
285+ if [[ -e "artifact.zip" ]] && zipinfo artifact.zip &>/dev/null; then
286+ break
287+ fi
288+ done
289+ [[ ! -e "artifact.zip" ]] && { echo "::error::Failed to download artifact."; exit 1; }
290+ unzip artifact.zip
291+ tar --xz -xvvf build.tar.xz build/plugins.tsv
292+
293+ - name : Prepare matrix
294+ id : matrix
295+ run : |
296+ RET=$( jq -c -s --raw-input 'split( "\n" )[0:-1] | map( split( "\t" ) | { src: .[0], mirror: .[1], slug: .[2] } )' build/plugins.tsv )
297+ jq '.' <<<"$RET"
298+ echo "matrix=$RET" >> "$GITHUB_OUTPUT"
299+
300+ upgrade_test :
301+ name : Test upgrades for ${{ matrix.slug }}
302+ runs-on : ubuntu-latest
303+ needs : [ setup, find_artifact, prepare_upgrade_test ]
304+ if : needs.find_artifact.outputs.any_plugins == 'true'
242305 timeout-minutes : 15 # 2022-08-26: Successful runs seem to take about 6 minutes, but give some extra time for the downloads.
306+ strategy :
307+ fail-fast : false
308+ matrix :
309+ include : ${{ fromJson( needs.prepare_upgrade_test.outputs.matrix ) }}
310+ env :
311+ PLUGIN_SRC : ${{ matrix.src }}
312+ PLUGIN_MIRROR : ${{ matrix.mirror }}
313+ PLUGIN_SLUG : ${{ matrix.slug }}
243314 services :
244315 db :
245316 image : mariadb:lts
@@ -263,6 +334,7 @@ jobs:
263334 HOST_PORT : 80
264335 ports :
265336 - 80:80
337+
266338 steps :
267339 - uses : actions/checkout@v4
268340 with :
@@ -272,28 +344,6 @@ jobs:
272344 ref : ${{ github.event.workflow_run.head_commit.id }}
273345 path : commit
274346
275- - name : Get token
276- id : get_token
277- uses : ./trunk/.github/actions/gh-app-token
278- env :
279- # Work around a weird node 16/openssl 3 issue in the docker env
280- OPENSSL_CONF : ' /dev/null'
281- with :
282- app_id : ${{ secrets.JP_LAUNCH_CONTROL_ID }}
283- private_key : ${{ secrets.JP_LAUNCH_CONTROL_KEY }}
284-
285- - name : Notify check in progress
286- uses : ./trunk/.github/actions/check-run
287- with :
288- id : ${{ needs.setup.outputs.upgrade_check }}
289- status : in_progress
290- title : Test started...
291- summary : |
292- ${{ env.SUMMARY }}
293-
294- See run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
295- token : ${{ steps.get_token.outputs.token }}
296-
297347 - name : Download build artifact
298348 env :
299349 TOKEN : ${{ github.token }}
@@ -320,25 +370,40 @@ jobs:
320370 run : trunk/.github/files/test-plugin-update/setup.sh
321371
322372 - name : Prepare plugin zips
323- id : zips
324373 run : trunk/.github/files/test-plugin-update/prepare-zips.sh
325374
326375 - name : Test upgrades
327- id : tests
328376 run : trunk/.github/files/test-plugin-update/test.sh
329377
378+ post_upgrade_test :
379+ name : Finalize plugin test
380+ runs-on : ubuntu-latest
381+ needs : [ setup, find_artifact, upgrade_test ]
382+ if : always() && needs.find_artifact.outputs.any_plugins == 'true'
383+ timeout-minutes : 5 # 2025-03-13: Should be just a few seconds.
384+
385+ steps :
386+ - uses : actions/checkout@v4
387+
388+ - name : Get token
389+ id : get_token
390+ uses : ./.github/actions/gh-app-token
391+ env :
392+ # Work around a weird node 16/openssl 3 issue in the docker env
393+ OPENSSL_CONF : ' /dev/null'
394+ with :
395+ app_id : ${{ secrets.JP_LAUNCH_CONTROL_ID }}
396+ private_key : ${{ secrets.JP_LAUNCH_CONTROL_KEY }}
397+
330398 - name : Notify final status
331- if : always()
332- uses : ./trunk/.github/actions/check-run
399+ uses : ./.github/actions/check-run
333400 with :
334401 id : ${{ needs.setup.outputs.upgrade_check }}
335- conclusion : ${{ job.status }}
336- title : ${{ job.status == 'success' && 'Tests passed' || job.status == 'cancelled' && 'Cancelled' || 'Tests failed' }}
402+ conclusion : ${{ needs.upgrade_test.result }}
403+ title : ${{ needs.upgrade_test.result == 'success' && 'Tests passed' || needs.upgrade_test.result == 'cancelled' && 'Cancelled' || 'Tests failed' }}
337404 summary : |
338405 ${{ env.SUMMARY }}
339406
340- ${{ steps.zips.outputs.info }}${{ steps.tests.outputs.info }}
341-
342407 See run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
343408 token : ${{ steps.get_token.outputs.token }}
344409
0 commit comments