Generate full p/invoke coverage report in build

We no longer have to check in the coverage report.
This commit is contained in:
Andrew Arnott 2017-03-18 08:25:15 -07:00
Родитель 5d47c79599
Коммит c42367331b
6 изменённых файлов: 70 добавлений и 55 удалений

Просмотреть файл

@ -53,7 +53,7 @@ or elsewhere as applicable.
## Distribution
This library should be available on NuGet for easy consumption by your projects.
You may also copy and paste the P/Invoke signatures you need directly into your projects if desired.
You may also copy and paste the P/Invoke signatures you need directly into your projects if desired.
Packages:
@ -81,7 +81,7 @@ userenv.dll |`PInvoke.Userenv` | [![NuGet](https://buildstats.info/nuget/PInvok
uxtheme.dll |`PInvoke.UxTheme` | [![NuGet](https://buildstats.info/nuget/PInvoke.UxTheme)](https://www.nuget.org/packages/PInvoke.UxTheme)|[Windows Visual Styles][UxTheme]
WtsApi32.dll |`PInvoke.WtsApi32`| [![NuGet](https://buildstats.info/nuget/PInvoke.WtsApi32)](https://www.nuget.org/packages/PInvoke.WtsApi32)|[Windows Remote Desktop Services][Wtsapi32]
Check out the [P/Invoke coverage](coverage.md) we have for each library.
Check out the [P/Invoke coverage][PInvokeCoverageReport] we have for each library.
## Contribution
@ -107,3 +107,5 @@ public release of the library.
[issues-closed-img]: http://www.issuestats.com/github/aarnott/pinvoke/badge/issue
[issues-closed-url]: http://www.issuestats.com/github/aarnott/pinvoke
[PInvokeCoverageReport]: https://ci.appveyor.com/api/projects/aarnott/pinvoke/artifacts/coverage.html?branch=master

Просмотреть файл

@ -6,6 +6,8 @@ environment:
VisualStudioVersion: 15.0
GeneratePInvokesTxt: true
TreatWarningsAsErrors: true
install:
- choco install pandoc
before_build:
- ps: >-
.\build.ps1 -Restore
@ -19,6 +21,16 @@ after_build:
- ps: Get-ChildItem bin\*.pinvokes.txt -rec |? { $_.directory -notmatch 'tests' } |% { Push-AppveyorArtifact $_ -DeploymentName "PInvoke method coverage" }
- ps: Get-ChildItem bin\*.exports.txt -rec |? { $_.directory -notmatch 'tests' } |% { Push-AppveyorArtifact $_ -DeploymentName "Exported methods" }
- ps: Get-ChildItem bin\*.nupkg -rec |% { Push-AppveyorArtifact $_ -DeploymentName "NuGet Package" }
- ps: >-
$reportdir = "bin\$env:configuration"
tools\Get-CoverageReport.ps1 -NoBuild -Configuration $env:configuration -OutFile "$reportdir\coverage.md"
pandoc -f markdown -t html "$reportdir\coverage.md" -o "$reportdir\coverage.html"
Push-AppveyorArtifact "$reportdir\coverage.html" -DeploymentName "PInvoke coverage report"
Push-AppveyorArtifact "$reportdir\coverage.md" -DeploymentName "PInvoke coverage report"
notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/c4d61fc5002e9a62a22f

Просмотреть файл

@ -13,6 +13,8 @@
The configuration to build. Either "debug" or "release". The default is debug, or the Configuration environment variable if set.
.Parameter WarnAsError
Converts all build warnings to errors. Useful in preparation to sending a pull request.
.Parameter GeneratePInvokesTxt
Produces the LIBNAME.pinvokes.txt files along with the assemblies during the build.
.Parameter NoParallelTests
Do not execute tests in parallel.
#>
@ -24,6 +26,7 @@ Param(
[Parameter()][ValidateSet('debug', 'release')]
[string]$Configuration = $env:configuration,
[switch]$WarnAsError = $true,
[switch]$GeneratePInvokesTxt,
[switch]$NoParallelTests
)
@ -77,8 +80,15 @@ if ($Restore -and $PSCmdlet.ShouldProcess($SolutionFile, "Restore packages")) {
}
if ($Build -and $PSCmdlet.ShouldProcess($SolutionFile, "Build")) {
$buildArgs = @()
$buildArgs += $SolutionFile,'/nologo','/nr:false','/m','/v:minimal','/t:build,pack'
$buildArgs += '/fl','/flp:verbosity=normal;logfile=msbuild.log','/flp1:warningsonly;logfile=msbuild.wrn;NoSummary;verbosity=minimal','/flp2:errorsonly;logfile=msbuild.err;NoSummary;verbosity=minimal'
if ($GeneratePInvokesTxt) {
$buildArgs += '/p:GeneratePInvokesTxt=true'
}
Write-Output "Building..."
& $MSBuildCommand.Path $SolutionFile /nologo /nr:false /m /v:minimal /fl /t:build,pack "/flp:verbosity=normal;logfile=msbuild.log" "/flp1:warningsonly;logfile=msbuild.wrn;NoSummary;verbosity=minimal" "/flp2:errorsonly;logfile=msbuild.err;NoSummary;verbosity=minimal"
& $MSBuildCommand.Path $buildArgs
$fail = $false
$warnings = Get-Content msbuild.wrn

Просмотреть файл

@ -1,25 +0,0 @@
# P/Invoke coverage report
Coverage | Package
----------|--------
![P/Invokes](https://img.shields.io/badge/AdvApi32-33/660-red.svg) | [AdvApi32](https://www.nuget.org/packages/PInvoke.AdvApi32)
![P/Invokes](https://img.shields.io/badge/BCrypt-27/58-orange.svg) | [BCrypt](https://www.nuget.org/packages/PInvoke.BCrypt)
![P/Invokes](https://img.shields.io/badge/Crypt32-4/284-red.svg) | [Crypt32](https://www.nuget.org/packages/PInvoke.Crypt32)
![P/Invokes](https://img.shields.io/badge/DwmApi-6/43-red.svg) | [DwmApi](https://www.nuget.org/packages/PInvoke.DwmApi)
![P/Invokes](https://img.shields.io/badge/Fusion-1/17-red.svg) | [Fusion](https://www.nuget.org/packages/PInvoke.Fusion)
![P/Invokes](https://img.shields.io/badge/Gdi32-9/810-red.svg) | [Gdi32](https://www.nuget.org/packages/PInvoke.Gdi32)
![P/Invokes](https://img.shields.io/badge/Hid-9/44-red.svg) | [Hid](https://www.nuget.org/packages/PInvoke.Hid)
![P/Invokes](https://img.shields.io/badge/ImageHlp-2/131-red.svg) | [ImageHlp](https://www.nuget.org/packages/PInvoke.ImageHlp)
![P/Invokes](https://img.shields.io/badge/Kernel32-150/1324-red.svg) | [Kernel32](https://www.nuget.org/packages/PInvoke.Kernel32)
![P/Invokes](https://img.shields.io/badge/MSCorEE-7/121-red.svg) | [MSCorEE](https://www.nuget.org/packages/PInvoke.MSCorEE)
![P/Invokes](https://img.shields.io/badge/Msi-3/168-red.svg) | [Msi](https://www.nuget.org/packages/PInvoke.Msi)
![P/Invokes](https://img.shields.io/badge/NCrypt-24/82-red.svg) | [NCrypt](https://www.nuget.org/packages/PInvoke.NCrypt)
![P/Invokes](https://img.shields.io/badge/NTDll-3/2215-red.svg) | [NTDll](https://www.nuget.org/packages/PInvoke.NTDll)
![P/Invokes](https://img.shields.io/badge/Psapi-1/20-red.svg) | [Psapi](https://www.nuget.org/packages/PInvoke.Psapi)
![P/Invokes](https://img.shields.io/badge/SetupApi-5/492-red.svg) | [SetupApi](https://www.nuget.org/packages/PInvoke.SetupApi)
![P/Invokes](https://img.shields.io/badge/SHCore-4/66-red.svg) | [SHCore](https://www.nuget.org/packages/PInvoke.SHCore)
![P/Invokes](https://img.shields.io/badge/Shell32-6/408-red.svg) | [Shell32](https://www.nuget.org/packages/PInvoke.Shell32)
![P/Invokes](https://img.shields.io/badge/User32-143/784-red.svg) | [User32](https://www.nuget.org/packages/PInvoke.User32)
![P/Invokes](https://img.shields.io/badge/Userenv-2/49-red.svg) | [Userenv](https://www.nuget.org/packages/PInvoke.Userenv)
![P/Invokes](https://img.shields.io/badge/UxTheme-3/84-red.svg) | [UxTheme](https://www.nuget.org/packages/PInvoke.UxTheme)
![P/Invokes](https://img.shields.io/badge/WtsApi32-6/49-red.svg) | [WtsApi32](https://www.nuget.org/packages/PInvoke.WtsApi32)

Просмотреть файл

@ -0,0 +1,43 @@
<#
.SYNOPSIS
Updates the coverage.md file in the source tree.
.PARAMETER Configuration
The build configuration to search for the exports and pinvokes files (e.g. "release").
.PARAMETER NoBuild
Skips the build and just harvests the files from a previously completed build.
.PARAMETER OutFile
The file to write the report to. If omitted, the report is returned as a string object to the caller.
#>
Param(
[Parameter()]
[string]$Configuration='release',
[Parameter()]
[switch]$NoBuild,
[Parameter()]
[string]$OutFile
)
if (!$NoBuild) {
& "$PSScriptRoot\..\Build.ps1" -Restore -Build -GeneratePInvokesTxt -Configuration $Configuration
}
$Shields = & "$PSScriptRoot\Get-Shields.ps1" -Directory "$PSScriptRoot\..\bin\$Configuration"
$report = "# P/Invoke coverage report
Coverage | Package
----------|--------
"
$Shields |% {
$NuPkgId = "PInvoke.$($_.Subject)"
$report += "$($_.MarkDown) | [$($_.Subject)](https://www.nuget.org/packages/$NuPkgId)
"
}
if ($OutFile) {
Set-Content -Path $OutFile -Value $report
} else {
$report
}

Просмотреть файл

@ -1,27 +0,0 @@
<#
.SYNOPSIS
Updates the coverage.md file in the source tree.
.PARAMETER Configuration
The build configuration to search for the exports and pinvokes files (e.g. "release").
#>
Param(
[Parameter()]
[string]$Configuration='release'
)
& "$PSScriptRoot\..\Build.ps1" -Restore
msbuild /nologo /m /v:minimal /fl "$PSScriptRoot\..\src\PInvoke.sln" /p:configuration=$Configuration /p:GeneratePInvokesTxt=true
$Shields = & "$PSScriptRoot\Get-Shields.ps1" -Directory "$PSScriptRoot\..\bin\$Configuration"
$CoveragePath = Resolve-Path "$PSScriptRoot\..\coverage.md"
Set-Content -Path $CoveragePath -Value "# P/Invoke coverage report
Coverage | Package
----------|--------"
$Shields |% {
$NuPkgId = "PInvoke.$($_.Subject)"
Add-Content -Path $CoveragePath -Value "$($_.MarkDown) | [$($_.Subject)](https://www.nuget.org/packages/$NuPkgId)"
}