-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines-master.yml
92 lines (78 loc) · 2.59 KB
/
azure-pipelines-master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Build pipeline for Master Branch
# This sets $(Build.BuildNumber)
name: 1.0.$(Rev:r)
# Set project names here
variables:
projectName: ZenMvvm.csproj
testProjectName: ZenMvvm.Tests.csproj
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
# Needed for when install reportgenerator and use it immediately
- task: UseDotNet@2
displayName: 'Use .NET Core SDK 3.x'
inputs:
packageType: 'sdk'
version: '3.x'
## - Build Project -
# Implicit Restore is run before build
- task: DotNetCoreCLI@2
displayName: 'Build Project'
inputs:
command: 'build'
projects: '**/$(projectName)'
arguments: '--configuration Release'
## - Run Unit Tests -
- task: DotNetCoreCLI@2
displayName: 'Build Test Project'
inputs:
command: 'build'
projects: '**/$(testProjectName)'
arguments: '--configuration Release'
- task: DotNetCoreCLI@2
displayName: 'Run unit tests with code coverage'
inputs:
command: 'test'
projects: '**/$(testProjectName)'
arguments: '--no-build --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
publishTestResults: true
- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Build.SourcesDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines -reporttypes:Badges
displayName: 'Create code coverage report'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'
## - Pack -
# Package with -pre version for /beta
- task: DotNetCoreCLI@2
displayName: 'Pack -pre version'
inputs:
command: 'pack'
packagesToPack: '**/$(projectName)'
configuration: 'Release'
packDirectory: '$(Build.ArtifactStagingDirectory)/beta'
nobuild: true
versioningScheme: 'off'
buildProperties: 'PackageVersion=$(Build.BuildNumber)-pre'
# Package public version off same build
- task: DotNetCoreCLI@2
displayName: 'Pack public version'
inputs:
command: 'pack'
packagesToPack: '**/$(projectName)'
configuration: 'Release'
packDirectory: '$(Build.ArtifactStagingDirectory)/public'
nobuild: true
versioningScheme: 'off'
buildProperties: 'PackageVersion=$(Build.BuildNumber)'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'