From 06e279d83db60ada75392291d0c288ba7239df6d Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 5 Aug 2019 00:40:05 +0800 Subject: Add code coverage. --- CI/build-pipeline.yml | 8 +++++++- Timeline.Tests/Timeline.Tests.csproj | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml index c515f181..64a851f0 100644 --- a/CI/build-pipeline.yml +++ b/CI/build-pipeline.yml @@ -14,7 +14,7 @@ steps: dotnet restore Timeline.Tests/Timeline.Tests.csproj --configfile nuget.config displayName: Dotnet Restore -- script: dotnet test Timeline.Tests/Timeline.Tests.csproj --configuration $(buildConfiguration) --no-restore --logger trx +- script: dotnet test Timeline.Tests/Timeline.Tests.csproj --configuration $(buildConfiguration) --no-restore --logger trx --collect:"XPlat Code Coverage" displayName: Dotnet Test - task: PublishTestResults@2 @@ -22,3 +22,9 @@ steps: inputs: testRunner: VSTest testResultsFiles: '**/*.trx' + +- task: PublishCodeCoverageResults@1 + condition: succeededOrFailed() + inputs: + codeCoverageTool: 'Cobertura' + summaryFileLocation: '**/coverage.cobertura.xml' diff --git a/Timeline.Tests/Timeline.Tests.csproj b/Timeline.Tests/Timeline.Tests.csproj index 1a5f2850..854c63ac 100644 --- a/Timeline.Tests/Timeline.Tests.csproj +++ b/Timeline.Tests/Timeline.Tests.csproj @@ -5,6 +5,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + -- cgit v1.2.3 From d672c104272b22c23a736d745dcc72f0ca31f085 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 5 Aug 2019 01:17:12 +0800 Subject: Use newer dotnet sdk that supports CC in CI. --- CI/build-pipeline.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml index 64a851f0..2b9ce5fb 100644 --- a/CI/build-pipeline.yml +++ b/CI/build-pipeline.yml @@ -9,6 +9,11 @@ pool: vmImage: 'Ubuntu-16.04' steps: +- task: UseDotNet@2 + inputs: + packageType: sdk + version: 2.2.x + - script: | dotnet restore Timeline/Timeline.csproj --configfile nuget.config dotnet restore Timeline.Tests/Timeline.Tests.csproj --configfile nuget.config -- cgit v1.2.3 From d5b37e5e686c4b7e66662ea3b10d1dbdd59712b2 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 5 Aug 2019 01:34:00 +0800 Subject: Hone code coverage result file path to avoid noise. --- CI/build-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml index 2b9ce5fb..2c15e301 100644 --- a/CI/build-pipeline.yml +++ b/CI/build-pipeline.yml @@ -32,4 +32,4 @@ steps: condition: succeededOrFailed() inputs: codeCoverageTool: 'Cobertura' - summaryFileLocation: '**/coverage.cobertura.xml' + summaryFileLocation: '**/TestResults/*/coverage.cobertura.xml' -- cgit v1.2.3