From c6d7e4910cd43f1ac130191554256233aec5f30d Mon Sep 17 00:00:00 2001 From: Kieranties Date: Thu, 11 Apr 2019 22:52:03 +0100 Subject: [PATCH 1/5] #34 Code coverage on CI build --- SimpleVersion.sln | 1 + azure-pipelines.yml | 27 +++++++++++++++++---------- shared/codecoverage.runsettings | 24 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 shared/codecoverage.runsettings diff --git a/SimpleVersion.sln b/SimpleVersion.sln index 87eb16a..de8cb6a 100644 --- a/SimpleVersion.sln +++ b/SimpleVersion.sln @@ -44,6 +44,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleVersion.Cake", "src\S EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{385532A7-26BE-4596-9EEE-E7C3984643ED}" ProjectSection(SolutionItems) = preProject + shared\codecoverage.runsettings = shared\codecoverage.runsettings shared\SimpleVersion.ruleset = shared\SimpleVersion.ruleset shared\stylecop.json = shared\stylecop.json shared\Tests.GlobalSuppressions.cs = shared\Tests.GlobalSuppressions.cs diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 36bf816..ffec189 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,22 +48,29 @@ jobs: Write-Output "##vso[task.setvariable variable=Version;]$fullVersion" displayName: 'Prepare: Set version information' - # Build/Pack the assets + # Build - task: DotNetCoreCLI@2 - displayName: "Build: Pack Source" + displayName: "Build: Source" inputs: - command: pack - packagesToPack: src/**/*.csproj - packDirectory: $(DistDir) - versioningScheme: off + command: build + projects: src/**/*.csproj # Run unit tests - task: DotNetCoreCLI@2 - displayName: "Test: Unit" + displayName: "Test: Unit + Coverage" inputs: command: test - projects: test/**/*.csproj - publishTestResults: true + projects: 'test/**/*.csproj' + arguments: '--collect "Code Coverage" -s shared/codecoverage.runsettings' + + # Pack assets + - task: DotNetCoreCLI@2 + displayName: "Pack: Source Nuget Packages" + inputs: + command: pack + packagesToPack: src/**/*.csproj + packDirectory: $(DistDir) + nobuild: true # TODO - Renable integration tests. Currently fail as environment variables # are always collected, so branch always maps to current repo branch being built @@ -101,4 +108,4 @@ jobs: packagesToPush: $(DistDir)/**/*.nupkg nuGetFeedType: internal publishVstsFeed: SimpleVersion - feedsToUse: nuget.config \ No newline at end of file + feedsToUse: nuget.config diff --git a/shared/codecoverage.runsettings b/shared/codecoverage.runsettings new file mode 100644 index 0000000..c7520ff --- /dev/null +++ b/shared/codecoverage.runsettings @@ -0,0 +1,24 @@ + + + + + + + + + + + + .*SimpleVersion.*\.dll$ + .*SimpleVersion.*\.exe$ + + + .*Tests.* + + + + + + + + From d97c8a3206fc7623b3c5ad053869213ddda7d930 Mon Sep 17 00:00:00 2001 From: Kieranties Date: Thu, 11 Apr 2019 23:00:49 +0100 Subject: [PATCH 2/5] #34 Fix coverage settings path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ffec189..fea2072 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -61,7 +61,7 @@ jobs: inputs: command: test projects: 'test/**/*.csproj' - arguments: '--collect "Code Coverage" -s shared/codecoverage.runsettings' + arguments: '--collect "Code Coverage" -s $(System.DefaultWorkingDirectory)shared/codecoverage.runsettings' # Pack assets - task: DotNetCoreCLI@2 From 849c9644634248a6287e13150b63ee250c34a966 Mon Sep 17 00:00:00 2001 From: Kieranties Date: Thu, 11 Apr 2019 23:06:44 +0100 Subject: [PATCH 3/5] #34 Adjust coverage settings path again --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fea2072..a3fc076 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -61,7 +61,7 @@ jobs: inputs: command: test projects: 'test/**/*.csproj' - arguments: '--collect "Code Coverage" -s $(System.DefaultWorkingDirectory)shared/codecoverage.runsettings' + arguments: '--collect "Code Coverage" -s $(System.DefaultWorkingDirectory)\shared\codecoverage.runsettings' # Pack assets - task: DotNetCoreCLI@2 From 04305c7f4b3dc0ef3207a1192efba6d228fc6425 Mon Sep 17 00:00:00 2001 From: Kieranties Date: Thu, 11 Apr 2019 23:25:53 +0100 Subject: [PATCH 4/5] #34 Enable build quality checks --- azure-pipelines.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a3fc076..e9fec45 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -91,6 +91,15 @@ jobs: # testResultsFiles: $(Build.ArtifactStagingDirectory)\Pester.Tests.xml # testRunTitle: "Integration Tests" + # Quality check the build + - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@5 + displayName: 'Checks: Quality' + inputs: + checkWarnings: true + showStatistics: true + checkCoverage: true + forceCoverageImprovement: true + # Handle artifacts - task: PublishBuildArtifacts@1 displayName: "Artifacts: Publish Distributables" From 33df84b025690268dc9a8b410a1a887d10388bf6 Mon Sep 17 00:00:00 2001 From: Kieranties Date: Thu, 11 Apr 2019 23:28:09 +0100 Subject: [PATCH 5/5] Correct azure build yaml --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e9fec45..d6941ed 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -93,12 +93,12 @@ jobs: # Quality check the build - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@5 - displayName: 'Checks: Quality' - inputs: - checkWarnings: true - showStatistics: true - checkCoverage: true - forceCoverageImprovement: true + displayName: 'Checks: Quality' + inputs: + checkWarnings: true + showStatistics: true + checkCoverage: true + forceCoverageImprovement: true # Handle artifacts - task: PublishBuildArtifacts@1