Skip to content

Commit

Permalink
build: PublishCodeCoverageResults
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Jan 4, 2024
1 parent dfb89c0 commit d9fefd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ steps:
- script: dotnet --info
displayName: 'dotnet info'

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: 'test'
arguments: '--no-build -c Release --collect "XPlat Code Coverage"'

- powershell: ./build.ps1
displayName: 'Powershell Script'
env:
Nuget__ApiKey: $(nugetApiKey)

# Publish code coverage results v2
# Publish any of the code coverage results from a build.
- task: PublishCodeCoverageResults@2
inputs:
summaryFileLocation: "**/coverage.*.xml" # string. Required. Path to summary files.
#pathToSources: # string. Path to Source files.
#failIfCoverageEmpty: false # boolean. Fail if code coverage results are missing. Default: false.
2 changes: 1 addition & 1 deletion build/build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await BuildProcess.CreateBuilder()
{
foreach (var project in testProjects)
{
await ExecuteCommandAsync($"dotnet test {project}");
await ExecuteCommandAsync($"dotnet test {project} --collect 'XPlat Code Coverage;ExcludeByAttribute=ExcludeFromCodeCoverage,Obsolete,GeneratedCode,CompilerGeneratedAttribute'");
}
})
;
Expand Down

0 comments on commit d9fefd1

Please sign in to comment.