Skip to content

Commit

Permalink
Merge pull request #67 from Kieranties/feature/housekeeping
Browse files Browse the repository at this point in the history
Enable code quality and validation during a build - Fixes #34
  • Loading branch information
Kieranties authored Apr 11, 2019
2 parents b0aed53 + 33df84b commit 9c548f4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
1 change: 1 addition & 0 deletions SimpleVersion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 26 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 $(System.DefaultWorkingDirectory)\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
Expand All @@ -84,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"
Expand All @@ -101,4 +117,4 @@ jobs:
packagesToPush: $(DistDir)/**/*.nupkg
nuGetFeedType: internal
publishVstsFeed: SimpleVersion
feedsToUse: nuget.config
feedsToUse: nuget.config
24 changes: 24 additions & 0 deletions shared/codecoverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File name extension must be .runsettings -->
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*SimpleVersion.*\.dll$</ModulePath>
<ModulePath>.*SimpleVersion.*\.exe$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*Tests.*</ModulePath>
</Exclude>
</ModulePaths>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>

0 comments on commit 9c548f4

Please sign in to comment.