-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
147 lines (128 loc) · 4.14 KB
/
azure-pipelines.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- develop
pr:
branches:
include:
- develop
pool:
vmImage: 'windows-2019'
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: PowerShell@2
displayName: Install gitversion.tool
inputs:
targetType: inline
script: dotnet tool install --tool-path .. gitversion.tool
pwsh: true
- task: PowerShell@2
displayName: Set SemVer from git history
inputs:
targetType: inline
script: ../dotnet-gitversion /output buildserver
pwsh: true
- task: SonarCloudPrepare@1
condition: ne(variables['Build.Reason'], 'PullRequest')
enabled: false
displayName: "Prepare SonarCloud analysis"
inputs:
SonarCloud: 'SonarCloud'
organization: 'mgroupntua'
scannerMode: 'MSBuild'
projectKey: 'MGroup.Environments'
extraProperties: 'sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/coverage/coverage.opencover.xml'
- task: DotNetCoreCLI@2
name: dotnetRestore
displayName: "Restore nugets"
inputs:
command: 'restore'
verbosityRestore: 'Normal'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: DotNetCoreCLI@2
name: dotnetBuild
displayName: "Build projects"
inputs:
command: 'build'
arguments: '--no-restore --nologo --configuration $(buildConfiguration) /p:AssemblyVersion=$(GitVersion.AssemblySemVer) /p:Version=$(GitVersion.SemVer) /p:SourceLinkCreate=true'
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.AssemblySemVer'
- task: PublishSymbols@2
displayName: "Publish symbols to Azure Devops artifacts"
inputs:
DetailedLog: true
SearchPattern: '**/bin/**/*.pdb'
IndexSources: false
SymbolServerType: 'TeamServices'
- task: DotNetCoreCLI@2
enabled: false
displayName: Run tests (develop)
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
inputs:
command: 'test'
projects: '**/*[Tt]ests/*.csproj'
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
publishTestResults: true
- task: SonarCloudAnalyze@1
condition: ne(variables['Build.Reason'], 'PullRequest')
enabled: false
displayName: "Perform SonarCloud analysis"
- task: SonarCloudPublish@1
condition: ne(variables['Build.Reason'], 'PullRequest')
enabled: false
displayName: 'Publish Quality Gate results'
inputs:
pollingTimeoutSec: '300'
- task: PublishCodeCoverageResults@1
enabled: false
displayName: 'Publish code coverage results'
inputs:
summaryFileLocation: $(Build.SourcesDirectory)/coverage/Cobertura/Cobertura.xml
reportDirectory: $(Build.SourcesDirectory)/coverage/Cobertura
codecoverageTool: cobertura
- task: DotNetCoreCLI@2
name: dotnetPack
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Package new nugets"
inputs:
command: 'pack'
arguments: '--nologo --no-restore'
nobuild: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.SemVer'
verbosityPack: 'Normal'
- task: CopyFiles@2
enabled: false
displayName: "Copy everything in artifacts staging directory"
inputs:
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
name: publishToFeed
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Publish to pipeline artifacts"
inputs:
ArtifactName: 'drop'
- task: DotNetCoreCLI@2
name: dotnetPushNugetPublic
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: "Push nugets to public feed"
inputs:
command: 'push'
packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'
verbosityPack: 'Minimal'
feedPublish: 'MSolve/MGroup'
- task: DotNetCoreCLI@2
enabled: false
condition: ne(variables['Build.Reason'], 'PullRequest')
name: dotnetPushSymbolPublic
displayName: "Publish symbol nugets"
inputs:
command: 'push'
searchPatternPush: '$(Build.ArtifactStagingDirectory)/*.snupkg'
feedPublish: 'MSolve/MGroup'