Skip to content

Commit

Permalink
Migration to coverlet for coverage reports due to strange issues with…
Browse files Browse the repository at this point in the history
… standard coverage reporter
  • Loading branch information
sakno committed Jan 25, 2024
1 parent a3b9e5b commit 408de88
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
21 changes: 18 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ stages:
inputs:
command: test
projects: $(TestProject)
arguments: --configuration Debug --collect "Code coverage"
arguments: --configuration Debug --collect "XPlat Code Coverage"
nobuild: false
testRunTitle: 'Debug on Windows'
publishTestResults: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Agent.TempDirectory)/*/coverage.cobertura.xml
- job: Linux
pool:
vmImage: ubuntu-latest
Expand All @@ -48,10 +53,15 @@ stages:
inputs:
command: test
projects: $(TestProject)
arguments: --configuration Debug --collect "Code coverage"
arguments: --configuration Debug --collect "XPlat Code Coverage"
nobuild: false
testRunTitle: 'Debug on Linux'
publishTestResults: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Agent.TempDirectory)/*/coverage.cobertura.xml
- job: MacOS
pool:
vmImage: macOS-latest
Expand All @@ -69,10 +79,15 @@ stages:
inputs:
command: test
projects: $(TestProject)
arguments: --configuration Debug --collect "Code coverage"
arguments: --configuration Debug --collect "XPlat Code Coverage"
nobuild: false
testRunTitle: 'Debug on MacOS'
publishTestResults: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Agent.TempDirectory)/*/coverage.cobertura.xml
- stage: BuildPackages
condition: and(succeeded('Tests'), eq(variables.isMain, true))
jobs:
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
<PackageVersion Include="FastMember.Signed" Version="1.5.0" />
<PackageVersion Include="xunit" Version="2.6.5" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6"/>
<PackageVersion Include="coverlet.collector" Version="6.0.0"/>
</ItemGroup>
</Project>
12 changes: 4 additions & 8 deletions src/DotNext.Tests/.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
</RunConfiguration>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code сoverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
<DataCollector friendlyName="XPlat Code Coverage">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Exclude>
<ModulePath>.*xunit.*</ModulePath>
</Exclude>
</ModulePaths>
</CodeCoverage>
<Format>cobertura</Format>
<ExcludeByAttribute>ObsoleteAttribute,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
<IncludeTestAssembly>false</IncludeTestAssembly>
</Configuration>
</DataCollector>
</DataCollectors>
Expand Down
4 changes: 4 additions & 0 deletions src/DotNext.Tests/DotNext.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Resources.Extensions"/>
</ItemGroup>

Expand Down

0 comments on commit 408de88

Please sign in to comment.