Skip to content
Permalink
Browse files

Merge pull request #320 from martincostello/coverlet

Switch to coverlet
  • Loading branch information...
martincostello committed Jun 16, 2019
2 parents d31d901 + 3049394 commit f02592f79beb5bdbf5ae71814051144831d8cb35
Showing with 15 additions and 30 deletions.
  1. +4 −27 Build.ps1
  2. +9 −1 Directory.Build.props
  3. +2 −2 appveyor.yml
@@ -80,40 +80,17 @@ function DotNetTest {
$nugetPath = Join-Path $env:USERPROFILE ".nuget\packages"
$propsFile = Join-Path $solutionPath "Directory.Build.props"

$openCoverVersion = (Select-Xml -Path $propsFile -XPath "//PackageReference[@Include='OpenCover']/@Version").Node.'#text'
$openCoverPath = Join-Path $nugetPath "OpenCover\$openCoverVersion\tools\OpenCover.Console.exe"

$reportGeneratorVersion = (Select-Xml -Path $propsFile -XPath "//PackageReference[@Include='ReportGenerator']/@Version").Node.'#text'
$reportGeneratorPath = Join-Path $nugetPath "ReportGenerator\$reportGeneratorVersion\tools\netcoreapp2.0\ReportGenerator.dll"

$coverageOutput = Join-Path $OutputPath "code-coverage.xml"
$coverageOutput = Join-Path $OutputPath "coverage.cobertura.xml"
$reportOutput = Join-Path $OutputPath "coverage"

if ($null -ne $env:TF_BUILD) {
& $openCoverPath `
`"-target:$dotnetPath`" `
`"-targetargs:test $Project --output $OutputPath --logger trx -- RunConfiguration.TestSessionTimeout=1200000`" `
`"-output:$coverageOutput`" `
`"-excludebyattribute:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage*`" `
`"-hideskipped:All`" `
-mergebyhash `
-oldstyle `
`"-register:user`" `
-skipautoprops `
`"-filter:+[Website]* +[Website.Views]* -[Website.Tests]*`"
& $dotnetPath test $Project --output $OutputPath --logger trx -- RunConfiguration.TestSessionTimeout=1200000
}
else {
& $openCoverPath `
`"-target:$dotnetPath`" `
`"-targetargs:test $Project --output $OutputPath -- RunConfiguration.TestSessionTimeout=1200000`" `
`"-output:$coverageOutput`" `
`"-excludebyattribute:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage*`" `
`"-hideskipped:All`" `
-mergebyhash `
-oldstyle `
`"-register:user`" `
-skipautoprops `
`"-filter:+[Website]* +[Website.Views]* -[Website.Tests]*`"
& $dotnetPath test $Project --output $OutputPath -- RunConfiguration.TestSessionTimeout=1200000
}

$dotNetTestExitCode = $LASTEXITCODE
@@ -122,7 +99,7 @@ function DotNetTest {
$reportGeneratorPath `
`"-reports:$coverageOutput`" `
`"-targetdir:$reportOutput`" `
-reporttypes:HTML`;Cobertura `
-reporttypes:HTML `
-verbosity:Warning
}

@@ -7,11 +7,11 @@
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
<Compile Include="$(MSBuildThisFileDirectory)CommonAssemblyInfo.cs" />
<PackageReference Include="coverlet.msbuild" Version="2.6.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="$(AnalyzersVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="$(AnalyzersVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.NetCore.Analyzers" Version="$(AnalyzersVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All" />
<PackageReference Include="OpenCover" Version="4.7.922" PrivateAssets="All" />
<PackageReference Include="ReportGenerator" Version="4.1.10" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
</ItemGroup>
@@ -48,4 +48,12 @@
<PropertyGroup Condition=" '$(CI)' != '' or '$(TF_BUILD)' != '' ">
<InstallWebPackages>true</InstallWebPackages>
</PropertyGroup>
<PropertyGroup>
<CollectCoverage>true</CollectCoverage>
<CoverletOutput>$(OutputPath)/</CoverletOutput>
<CoverletOutputFormat>cobertura,json</CoverletOutputFormat>
<Exclude>[xunit.*]*</Exclude>
<ExcludeByAttribute>System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
<Threshold>65</Threshold>
</PropertyGroup>
</Project>
@@ -25,11 +25,11 @@ build_script:
after_build:
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- pip install codecov
- codecov -f "artifacts\code-coverage.xml"
- codecov -f "artifacts\coverage.cobertura.xml"

artifacts:
- path: artifacts\publish
- path: artifacts\code-coverage.xml
- path: artifacts\coverage*.xml

nuget:
disable_publish_on_pr: true

0 comments on commit f02592f

Please sign in to comment.
You can’t perform that action at this time.