@@ -2,6 +2,8 @@ name: Swift Matrix
22
33permissions :
44 contents : read
5+ # checks: write
6+ # pull-requests: write
57
68on :
79 workflow_call :
123125 type : string
124126 description : " macOS command to build and test the package"
125127 default : " xcrun swift test"
128+ macos_publish_test_results :
129+ type : boolean
130+ description : " Boolean to enable publishing test results"
131+ default : false
132+ macos_publish_test_results_files :
133+ type : string
134+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
135+ default : " *.xml"
126136 macos_build_timeout :
127137 type : number
128138 description : " The default step timeout in minutes"
@@ -135,22 +145,62 @@ on:
135145 type : string
136146 description : " macOS command to build the package for iOS"
137147 default : " \" $(xcrun -f swift)\" build --build-tests --sdk \" $(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
148+ ios_publish_test_results :
149+ type : boolean
150+ description : " Boolean to enable publishing test results"
151+ default : false
152+ ios_publish_test_results_files :
153+ type : string
154+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
155+ default : " *.xml"
138156 ios_build_timeout :
139157 type : number
140158 description : " The default step timeout in minutes"
141159 default : 60
160+ linux_publish_test_results :
161+ type : boolean
162+ description : " Boolean to enable publishing test results"
163+ default : false
164+ linux_publish_test_results_files :
165+ type : string
166+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
167+ default : " *.xml"
142168 linux_build_command :
143169 type : string
144170 description : " Linux command to build and test the package"
145171 default : " swift test"
172+ linux_static_sdk_publish_test_results :
173+ type : boolean
174+ description : " Boolean to enable publishing test results"
175+ default : false
176+ linux_static_sdk_publish_test_results_files :
177+ type : string
178+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
179+ default : " *.xml"
146180 linux_static_sdk_build_command :
147181 type : string
148182 description : " Command to use when building the package with the Static Linux Swift SDK"
149183 default : " swift build"
184+ wasm_sdk_publish_test_results :
185+ type : boolean
186+ description : " Boolean to enable publishing test results"
187+ default : false
188+ wasm_sdk_publish_test_results_files :
189+ type : string
190+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
191+ default : " *.xml"
150192 wasm_sdk_build_command :
151193 type : string
152194 description : " Command to use when building the package with the Swift SDK for Wasm"
153195 default : " swift build"
196+ android_sdk_publish_test_results :
197+ type : boolean
198+ description : " Boolean to enable publishing test results"
199+ default : false
200+ android_sdk_publish_test_results_files :
201+ type : string
202+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
203+ default : " *.xml"
154204 android_sdk_build_command :
155205 type : string
156206 description : " Command to use when building the package with the Swift SDK for Android"
167217 type : string
168218 description : " Windows Command Prompt command to execute before building the Swift package"
169219 default : " "
220+ windows_publish_test_results :
221+ type : boolean
222+ description : " Boolean to enable publishing test results"
223+ default : false
224+ windows_publish_test_results_files :
225+ type : string
226+ description : " A string representation, where each line is a relative path pattern of test results files to publish"
227+ default : " *.xml"
170228 windows_build_command :
171229 type : string
172230 description : |
@@ -274,9 +332,26 @@ jobs:
274332 run : xcrun clang --version
275333 - name : Pre-build
276334 run : ${{ inputs.macos_pre_build_command }}
277- - name : Build / Test
335+ - name : " Build / Test"
278336 run : ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
279337 timeout-minutes : ${{ inputs.macos_build_timeout }}
338+ - name : " Publish Test results - EnricoMI"
339+ uses : EnricoMi/publish-unit-test-result-action/macos@v2.23.0
340+ if : ${{ inputs.macos_publish_test_results && always() }}
341+ with :
342+ comment_mode : off
343+ files : ${{ inputs.macos_publish_test_results_files }}
344+ report_individual_runs : true
345+ action_fail : true
346+ action_fail_on_inconclusive : true
347+ - name : " Publish test results - test-reporter"
348+ uses : dorny/test-reporter@v2.5.0
349+ if : ${{ inputs.macos_publish_test_results && always() }}
350+ with :
351+ name : " Test Reporter: ${{ github.action }}"
352+ report-title : " Test Reporter: ${{ github.action }}"
353+ path : ${{ inputs.macos_publish_test_results_files }}
354+ reporter : swift-xunit
280355
281356 ios-build :
282357 name : iOS (Build Only, Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }})
@@ -311,9 +386,26 @@ jobs:
311386 "$(xcrun -f swift)" --version
312387 - name : Pre-build
313388 run : ${{ inputs.ios_pre_build_command }}
314- - name : Build
389+ - name : " Build"
315390 run : ${{ inputs.ios_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
316391 timeout-minutes : ${{ inputs.ios_build_timeout }}
392+ - name : " Publish Test results - EnricoMI"
393+ uses : EnricoMi/publish-unit-test-result-action/macos@v2.23.0
394+ if : ${{ inputs.ios_publish_test_results && always() }}
395+ with :
396+ comment_mode : off
397+ files : ${{ inputs.ios_publish_test_results_files }}
398+ report_individual_runs : true
399+ action_fail : true
400+ action_fail_on_inconclusive : true
401+ - name : " Publish test results - test-reporter"
402+ uses : dorny/test-reporter@v2.5.0
403+ if : ${{ inputs.ios_publish_test_results && always() }}
404+ with :
405+ name : " Test Reporter: ${{ github.action }}"
406+ report-title : " Test Reporter: ${{ github.action }}"
407+ path : ${{ inputs.ios_publish_test_results_files }}
408+ reporter : swift-xunit
317409
318410 linux-build :
319411 name : Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }})
@@ -392,8 +484,25 @@ jobs:
392484 done
393485 - name : Pre-build
394486 run : ${{ inputs.linux_pre_build_command }}
395- - name : Build / Test
487+ - name : " Build / Test"
396488 run : ${{ inputs.linux_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
489+ - name : " Publish Test results - EnricoMI"
490+ uses : EnricoMi/publish-unit-test-result-action/linux@v2.23.0
491+ if : ${{ inputs.linux_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
492+ with :
493+ comment_mode : off
494+ files : ${{ inputs.linux_publish_test_results_files }}
495+ report_individual_runs : true
496+ action_fail : true
497+ action_fail_on_inconclusive : true
498+ - name : " Publish test results - test-reporter"
499+ uses : dorny/test-reporter@v2.5.0
500+ if : ${{ inputs.linux_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
501+ with :
502+ name : " Test Reporter: ${{ github.action }}"
503+ report-title : " Test Reporter: ${{ github.action }}"
504+ path : ${{ inputs.linux_publish_test_results_files }}
505+ reporter : swift-xunit
397506
398507 linux-static-sdk-build :
399508 name : Static Linux Swift SDK Build (${{ matrix.swift_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }})
@@ -473,6 +582,23 @@ jobs:
473582 run : |
474583 ${{ inputs.linux_static_sdk_pre_build_command }}
475584 ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh --static --flags="$BUILD_FLAGS" --build-command="${{ inputs.linux_static_sdk_build_command }}" ${{ matrix.swift_version }}
585+ - name : " Publish Test results - EnricoMI"
586+ uses : EnricoMi/publish-unit-test-result-action@v2.23.0
587+ if : ${{ inputs.linux_static_sdk_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
588+ with :
589+ comment_mode : off
590+ files : ${{ inputs.linux_static_sdk_publish_test_results_files }}
591+ report_individual_runs : true
592+ action_fail : true
593+ action_fail_on_inconclusive : true
594+ - name : " Publish test results - test-reporter"
595+ uses : dorny/test-reporter@v2.5.0
596+ if : ${{ inputs.linux_static_sdk_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
597+ with :
598+ name : " Test Reporter: ${{ github.action }}"
599+ report-title : " Test Reporter: ${{ github.action }}"
600+ path : ${{ inputs.linux_static_sdk_publish_test_results_files }}
601+ reporter : swift-xunit
476602
477603 wasm-sdk-build :
478604 name : Swift SDK for Wasm Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
@@ -538,6 +664,23 @@ jobs:
538664 run : |
539665 ${{ inputs.wasm_sdk_pre_build_command }}
540666 ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh --wasm --flags="$BUILD_FLAGS" --build-command="${{ inputs.wasm_sdk_build_command }}" ${{ matrix.swift_version }}
667+ - name : " Publish Test results - EnricoMI"
668+ uses : EnricoMi/publish-unit-test-result-action@v2.23.0
669+ if : ${{ inputs.wasm_sdk_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
670+ with :
671+ comment_mode : off
672+ files : ${{ inputs.wasm_sdk_publish_test_results_files }}
673+ report_individual_runs : true
674+ action_fail : true
675+ action_fail_on_inconclusive : true
676+ - name : " Publish test results - test-reporter"
677+ uses : dorny/test-reporter@v2.5.0
678+ if : ${{ inputs.wasm_sdk_publish_test_results && matrix.os_version != 'amazonlinux2' && always() }}
679+ with :
680+ name : " Test Reporter: ${{ github.action }}"
681+ report-title : " Test Reporter: ${{ github.action }}"
682+ path : ${{ inputs.wasm_sdk_publish_test_results_files }}
683+ reporter : swift-xunit
541684
542685 embedded-wasm-sdk-build :
543686 name : Embedded Swift SDK for Wasm Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
@@ -603,6 +746,23 @@ jobs:
603746 run : |
604747 ${{ inputs.wasm_sdk_pre_build_command }}
605748 ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh --embedded-wasm --flags="$BUILD_FLAGS" ${{ matrix.swift_version }}
749+ - name : " Publish Test results - EnricoMI"
750+ uses : EnricoMi/publish-unit-test-result-action@v2.23.0
751+ if : ${{ inputs.wasm_sdk_publish_test_results && matrix.os_version != 'amazonlinux2 && always() }}
752+ with :
753+ comment_mode : off
754+ files : ${{ inputs.wasm_sdk_publish_test_results_files }}
755+ report_individual_runs : true
756+ action_fail : true
757+ action_fail_on_inconclusive : true
758+ - name : " Publish test results - test-reporter"
759+ uses : dorny/test-reporter@v2.5.0
760+ if : ${{ inputs.wasm_sdk_publish_test_results && matrix.os_version != 'amazonlinux2' && always() }}
761+ with :
762+ name : " Test Reporter: ${{ github.action }}"
763+ report-title : " Test Reporter: ${{ github.action }}"
764+ path : ${{ inputs.wasm_sdk_publish_test_results_files }}
765+ reporter : swift-xunit
606766
607767 android-sdk-build :
608768 name : Swift SDK for Android Build (${{ matrix.swift_version }} - NDK ${{ matrix.ndk_version }})
@@ -655,6 +815,23 @@ jobs:
655815 run : |
656816 ${{ inputs.android_sdk_pre_build_command }}
657817 ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh --android --flags="$BUILD_FLAGS" --build-command="${{ inputs.android_sdk_build_command }}" --android-sdk-triple=${{ join(fromJson(inputs.android_sdk_triples), ' --android-sdk-triple=') }} --android-ndk-version="${{ matrix.ndk_version }}" ${{ matrix.swift_version }}
818+ - name : " Publish Test results - EnricoMI"
819+ uses : EnricoMi/publish-unit-test-result-action@v2.23.0
820+ if : ${{ inputs.android_sdk_publish_test_results && always() }}
821+ with :
822+ comment_mode : off
823+ files : ${{ inputs.android_sdk_publish_test_results_files }}
824+ report_individual_runs : true
825+ action_fail : true
826+ action_fail_on_inconclusive : true
827+ - name : " Publish test results - test-reporter"
828+ uses : dorny/test-reporter@v2.5.0
829+ if : ${{ inputs.android_sdk_publish_test_results && always() }}
830+ with :
831+ name : " Test Reporter: ${{ github.action }}"
832+ report-title : " Test Reporter: ${{ github.action }}"
833+ path : ${{ inputs.android_sdk_publish_test_results_files }}
834+ reporter : swift-xunit
658835 - name : Enable KVM and free disk space
659836 if : ${{ inputs.enable_android_sdk_checks }}
660837 run : |
@@ -796,3 +973,20 @@ jobs:
796973 timeout-minutes : ${{ inputs.windows_build_timeout }}
797974 if : ${{ !inputs.enable_windows_docker }}
798975 run : powershell.exe -NoLogo -File $env:TEMP\test-script\run.ps1; exit $LastExitCode
976+ - name : " Publish Test results - EnricoMI"
977+ uses : EnricoMi/publish-unit-test-result-action/windows@v2.23.0
978+ if : ${{ inputs.windows_publish_test_results && always() }}
979+ with :
980+ comment_mode : off
981+ files : ${{ inputs.windows_publish_test_results_files }}
982+ report_individual_runs : true
983+ action_fail : true
984+ action_fail_on_inconclusive : true
985+ - name : " Publish test results - test-reporter"
986+ uses : dorny/test-reporter@v2.5.0
987+ if : ${{ inputs.windows_publish_test_results && always() }}
988+ with :
989+ name : " Test Reporter: ${{ github.action }}"
990+ report-title : " Test Reporter: ${{ github.action }}"
991+ path : ${{ inputs.windows_publish_test_results_files }}
992+ reporter : swift-xunit
0 commit comments