Skip to content

Instantly share code, notes, and snippets.

@DanielSSilva
Created July 13, 2021 10:06
Show Gist options
  • Save DanielSSilva/f0dafa38f1c1adeaeabf9b3439cb838b to your computer and use it in GitHub Desktop.
Save DanielSSilva/f0dafa38f1c1adeaeabf9b3439cb838b to your computer and use it in GitHub Desktop.
Simple pipeline, with code covarege
trigger:
- none
pool:
vmImage: 'windows-latest'
jobs:
- job: Build
steps:
- task: DotNetCoreCLI@2
displayName: 'Restore Greeter Project'
inputs:
command: restore
projects: GreeterProject/GreeterApp/GreeterApp.csproj
feedsToUse: config
nugetConfigPath: ./nuget.config
- task: DotNetCoreCLI@2
displayName: 'Build Greeter'
inputs:
command: build
arguments: '--no-restore --configuration $(buildConfiguration)'
projects: GreeterProject/GreeterApp/GreeterApp.csproj
- task: DotNetCoreCLI@2
displayName: 'Restore Greeter Tests'
inputs:
command: restore
projects: GreeterProject/GreeterTests/GreeterTests.csproj
feedsToUse: config
nugetConfigPath: ./nuget.config
- task: DotNetCoreCLI@2
displayName: 'Build Greeter tests'
inputs:
projects: GreeterProject/GreeterTests/GreeterTests.csproj
arguments: '--no-restore --configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Install .NET tools from local manifest'
inputs:
command: custom
custom: tool
arguments: 'restore'
- task: DotNetCoreCLI@2
displayName: 'Run unit tests'
inputs:
command: 'test'
arguments: '--no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
publishTestResults: true
projects: GreeterProject/GreeterTests/GreeterTests.csproj
- task: DotNetCoreCLI@2
displayName: 'Create code coverage report'
inputs:
command: custom
custom: tool
arguments: 'run reportgenerator -reports:$(Build.SourcesDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'
- task: DotNetCoreCLI@2
displayName: 'Publish the Project zip'
inputs:
command: publish
publishWebProjects: false
projects: GreeterProject/GreeterApp/GreeterApp.csproj
arguments: '--no-build --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/$(buildConfiguration)'
zipAfterPublish: True
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment