From fd350da6eed8578dce9a3b46ae0cfb5a34c47012 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Tue, 7 Apr 2020 14:08:12 -0600 Subject: [PATCH] Add code coverage reports --- azure-pipelines.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44b8e185..03e7fe2a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,12 +37,30 @@ steps: command: 'build' projects: 'Wabbajack\Wabbajack.csproj' arguments: '--runtime win10-x64 --configuration Release /p:Platform=x64' + - task: DotNetCoreCLI@2 displayName: "Test Release" inputs: command: 'test' projects: '**/*.Test.csproj' - arguments: '/p:Platform=x64' + arguments: '/p:Platform=x64 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura' + + # Generate the report using ReportGenerator (https://github.com/danielpalme/ReportGenerator) + # First install the tool on the machine, then run it +- script: | + dotnet tool install -g dotnet-reportgenerator-globaltool + reportgenerator -reports:$(Build.SourcesDirectory)/tests/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura + displayName: Create Code coverage report + + # Publish the code coverage result (summary and web site) + # The summary allows to view the coverage percentage in the summary tab + # The web site allows to view which lines are covered directly in Azure Pipeline +- task: PublishCodeCoverageResults@1 + displayName: 'Publish code coverage' + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml' + reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage' - task: DotNetCoreCLI@2 inputs: