diff options
| author | Adonais Romero González <[email protected]> | 2023-06-15 11:51:39 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-15 11:51:39 -0700 |
| commit | f5fe952f1fc90cfcff535407d56f49953d22e8da (patch) | |
| tree | 9149971aa79642585b6798c60a9e419c63868231 | |
| parent | c5cc3eca707a39d71a3f34281af107795b2af945 (diff) | |
Generate and provide overview reports (#993)
| -rw-r--r-- | .github/scripts/Join-CsvReports.ps1 | 35 | ||||
| -rw-r--r-- | .github/workflows/ci-pr.yml | 29 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 29 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Build-SampleSet.ps1 | 11 |
5 files changed, 99 insertions, 6 deletions
diff --git a/.github/scripts/Join-CsvReports.ps1 b/.github/scripts/Join-CsvReports.ps1 new file mode 100644 index 00000000..32cd9d63 --- /dev/null +++ b/.github/scripts/Join-CsvReports.ps1 @@ -0,0 +1,35 @@ +$logsPath = Join-Path (Get-Location).Path "_logs" +$reportFileName = '_overview.all' +$idProperty = 'Sample' +$results = $null + +Get-ChildItem -Path $logsPath -Filter '*.csv' | ForEach-Object { + $csv = Import-Csv -Path $_ + if ($results -eq $null) { + $results = $csv + } + else { + $results = $csv | ForEach-Object { + $id = $_.$idProperty + $match = $results | Where-Object { $_.$idProperty -eq $id } + if ($match) { + $properties = $_ | Get-Member -MemberType NoteProperty | Where-Object { $_.Name -ne $idProperty } | Select-Object -ExpandProperty Name + $newObject = New-Object PSObject + # Add ID property separately to ensure it appears first + $newObject | Add-Member -MemberType NoteProperty -Name $idProperty -Value $_.$idProperty + foreach ($property in $properties) { + $newObject | Add-Member -MemberType NoteProperty -Name $property -Value $_.$property + } + foreach ($property in ($match | Get-Member -MemberType NoteProperty | Where-Object { $_.Name -ne $idProperty } | Select-Object -ExpandProperty Name)) { + if ($properties -notcontains $property) { + $newObject | Add-Member -MemberType NoteProperty -Name $property -Value $match.$property + } + } + $newObject + } + } + } +} + +$results | ConvertTo-Csv | Out-File (Join-Path $logsPath "$reportFileName.csv") +$results | ConvertTo-Html -Title "Overview" | Out-File (Join-Path $logsPath "$reportFileName.htm") diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index ad170154..695d4186 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -9,6 +9,7 @@ on: - 'LICENSE' jobs: build: + name: Build driver samples strategy: fail-fast: false matrix: @@ -37,10 +38,36 @@ jobs: env: WDS_Configuration: ${{ matrix.configuration }} WDS_Platform: ${{ matrix.platform }} + WDS_ReportFileName: _overview.${{ matrix.configuration }}.${{ matrix.platform }} - - name: Archive logs + - name: Archive build logs and overview build reports uses: actions/upload-artifact@v3 if: always() with: name: logs path: _logs + + report: + name: Generate global report + runs-on: windows-2022 + needs: build + if: always() + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Retrieve overview reports + uses: actions/download-artifact@v3 + with: + name: logs + path: _logs + + - name: Join and generate global reports + run: | + .\.github\scripts\Join-CsvReports.ps1 + + - name: Archive global overview build reports + uses: actions/upload-artifact@v3 + with: + name: logs + path: _logs/_overview.all.* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70610fc7..c4fd1a2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: - 'LICENSE' jobs: build: + name: Build driver samples strategy: fail-fast: false matrix: @@ -30,10 +31,36 @@ jobs: env: WDS_Configuration: ${{ matrix.configuration }} WDS_Platform: ${{ matrix.platform }} + WDS_ReportFileName: _overview.${{ matrix.configuration }}.${{ matrix.platform }} - - name: Archive logs + - name: Archive build logs and overview build reports uses: actions/upload-artifact@v3 if: always() with: name: logs path: _logs + + report: + name: Generate global report + runs-on: windows-2022 + needs: build + if: always() + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Retrieve overview reports + uses: actions/download-artifact@v3 + with: + name: logs + path: _logs + + - name: Join and generate global reports + run: | + .\.github\scripts\Join-CsvReports.ps1 + + - name: Archive global overview build reports + uses: actions/upload-artifact@v3 + with: + name: logs + path: _logs/_overview.all.* @@ -19,6 +19,7 @@ build/ bld/ [Bb]in/ [Oo]bj/ +_logs # Visual Studio 2015 cache/options directory .vs/ diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index cb7c2a5f..a967abb9 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -4,6 +4,7 @@ param( [string[]]$Configurations = @(if ([string]::IsNullOrEmpty($env:WDS_Configuration)) { "Debug" } else { $env:WDS_Configuration }), [string[]]$Platforms = @(if ([string]::IsNullOrEmpty($env:WDS_Platform)) { "x64" } else { $env:WDS_Platform }), $LogFilesDirectory = (Get-Location), + [string]$ReportFileName = $(if ([string]::IsNullOrEmpty($env:WDS_ReportFileName)) { "_overview" } else { $env:WDS_ReportFileName }), [int]$ThrottleLimit = 0 ) @@ -20,7 +21,8 @@ if ($PSBoundParameters.ContainsKey('Verbose')) { } New-Item -ItemType Directory -Force -Path $LogFilesDirectory | Out-Null -$sampleBuilderFilePath = "$LogFilesDirectory\_overview.htm" +$reportFilePath = Join-Path $LogFilesDirectory "$ReportFileName.htm" +$reportCsvFilePath = Join-Path $LogFilesDirectory "$ReportFileName.csv" Remove-Item -Recurse -Path $LogFilesDirectory 2>&1 | Out-Null @@ -205,8 +207,9 @@ Write-Output "Excluded: $SolutionsExcluded" Write-Output "Unsupported: $SolutionsUnsupported" Write-Output "Failed: $SolutionsFailed" Write-Output "Log files directory: $LogFilesDirectory" -Write-Output "Overview report: $sampleBuilderFilePath" +Write-Output "Overview report: $reportFilePath" Write-Output "" -$Results | Sort-Object { $_.Sample } | ConvertTo-Html -Title "Overview" | Out-File $sampleBuilderFilePath -Invoke-Item $sampleBuilderFilePath +$Results | Sort-Object { $_.Sample } | ConvertTo-Csv | Out-File $reportCsvFilePath +$Results | Sort-Object { $_.Sample } | ConvertTo-Html -Title "Overview" | Out-File $reportFilePath +Invoke-Item $reportFilePath |
