@@ -178,21 +178,113 @@ jobs:
178
178
Version : ${{ inputs.Version }}
179
179
WorkingDirectory : ${{ inputs.WorkingDirectory }}
180
180
181
- Status :
182
- name : Status
183
- runs-on : ubuntu-latest
181
+ Get-TestResults :
182
+ name : Get-TestResults
184
183
needs :
185
184
- Test-SourceCode
186
185
- Test-Module
187
186
- Test-ModuleLocal
188
- steps :
189
- - name : Status
190
- shell : pwsh
191
- run : |
192
- [pscustomobject]@{
193
- TestModule = '${{ needs.Test-Module.result }}'
194
- TestModuleLocal = '${{ needs.Test-ModuleLocal.result }}'
195
- }
187
+ uses : ./.github/workflows/Get-TestResults.yml
188
+ secrets : inherit
189
+ with :
190
+ Debug : ${{ inputs.Debug }}
191
+ Prerelease : ${{ inputs.Prerelease }}
192
+ Verbose : ${{ inputs.Verbose }}
193
+ Version : ${{ inputs.Version }}
194
+ WorkingDirectory : ${{ inputs.WorkingDirectory }}
195
+
196
+ # Get-CodeCoverage:
197
+ # name: Get-CodeCoverage
198
+ # runs-on: ubuntu-latest
199
+ # needs:
200
+ # - Test-SourceCode
201
+ # - Test-Module
202
+ # - Test-ModuleLocal
203
+ # steps:
204
+ # - name: Get-CodeCoverage
205
+ # uses: PSModule/GitHub-Script@v1
206
+ # with:
207
+ # Debug: ${{ inputs.Debug }}
208
+ # Prerelease: ${{ inputs.Prerelease }}
209
+ # Verbose: ${{ inputs.Verbose }}
210
+ # Version: ${{ inputs.Version }}
211
+ # Script: |
212
+ # $PSStyle.OutputRendering = 'Ansi'
213
+ # $repo = $env:GITHUB_REPOSITORY
214
+ # $runId = $env:GITHUB_RUN_ID
215
+ # gh run download $runId --repo $repo --pattern *-CodeCoverage
216
+ # $files = Get-ChildItem -Path . -Recurse -File | Select-Object -ExpandProperty FullName | Sort-Object
217
+ # # Load the first XML as the base report
218
+ # [xml]$mergedReport = Get-Content -Path $files[0]
219
+
220
+ # # Function to merge counters
221
+ # function Merge-Counters($baseNode, $newNode) {
222
+ # foreach ($newCounter in $newNode.counter) {
223
+ # $baseCounter = $baseNode.counter | Where-Object { $_.type -eq $newCounter.type }
224
+ # if ($baseCounter) {
225
+ # $baseCounter.missed = [int]$baseCounter.missed + [int]$newCounter.missed
226
+ # $baseCounter.covered = [int]$baseCounter.covered + [int]$newCounter.covered
227
+ # } else {
228
+ # # Import new counter if it doesn't exist
229
+ # $importedCounter = $mergedReport.ImportNode($newCounter, $true)
230
+ # $baseNode.AppendChild($importedCounter) | Out-Null
231
+ # }
232
+ # }
233
+ # }
234
+
235
+ # # Loop through remaining reports to merge coverage data
236
+ # foreach ($reportPath in $files[1..($files.Count - 1)]) {
237
+ # [xml]$currentReport = Get-Content -Path $reportPath
238
+
239
+ # # Merge the top-level counters
240
+ # Merge-Counters -baseNode $mergedReport.report -newNode $currentReport.report
241
+
242
+ # # Merge packages and classes
243
+ # foreach ($package in $currentReport.report.package) {
244
+ # $basePackage = $mergedReport.report.package | Where-Object { $_.name -eq $package.name }
245
+
246
+ # if ($basePackage) {
247
+ # # Merge counters at package level
248
+ # Merge-Counters -baseNode $basePackage -newNode $package
249
+
250
+ # foreach ($class in $package.class) {
251
+ # $baseClass = $basePackage.class | Where-Object { $_.name -eq $class.name }
252
+ # if ($baseClass) {
253
+ # # Merge counters at class level
254
+ # Merge-Counters -baseNode $baseClass -newNode $class
255
+ # } else {
256
+ # # Import new class
257
+ # $importedClass = $mergedReport.ImportNode($class, $true)
258
+ # $basePackage.AppendChild($importedClass) | Out-Null
259
+ # }
260
+ # }
261
+ # } else {
262
+ # # Import entire new package
263
+ # $importedPackage = $mergedReport.ImportNode($package, $true)
264
+ # $mergedReport.report.AppendChild($importedPackage) | Out-Null
265
+ # }
266
+ # }
267
+ # }
268
+
269
+ # # Output the combined report
270
+ # $mergedReport.Save("merged-jacoco-report.xml")
271
+
272
+ # # Assuming $mergedReport is your final [xml] object:
273
+ # $xmlString = $mergedReport.OuterXml
274
+
275
+ # # To format (pretty-print) the XML nicely:
276
+ # $stringWriter = New-Object System.IO.StringWriter
277
+ # $xmlWriter = [System.Xml.XmlTextWriter]::new($stringWriter)
278
+ # $xmlWriter.Formatting = "Indented"
279
+ # $mergedReport.WriteTo($xmlWriter)
280
+ # $xmlWriter.Flush()
281
+ # $prettyXml = $stringWriter.ToString()
282
+
283
+ # $prettyXml | Out-String
284
+
285
+ # # Output or export the XML string
286
+ # # $prettyXml | Out-File -FilePath "merged-jacoco-report.xml" -Encoding UTF8
287
+
196
288
197
289
# TestModuleStatus:
198
290
# name: Test module status
0 commit comments