-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
147 lines (128 loc) · 4.49 KB
/
Copy pathazure-pipelines.yml
File metadata and controls
147 lines (128 loc) · 4.49 KB
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: 'Debug'
testProject: 'tests/MGroup.MachineLearning.Tests'
enableSonarCloud: true
steps:
- task: PowerShell@2
displayName: Install gitversion.tool v5
inputs:
targetType: inline
script: dotnet tool install --tool-path .. gitversion.tool --version 5.*
pwsh: true
- task: PowerShell@2
displayName: Set SemVer from git history and update AssemblyInfo
inputs:
targetType: inline
script: ../dotnet-gitversion /updateassemblyinfo AssemblyInfo.cs AssemblyVersionInfo.cs /output buildserver
pwsh: true
- task: DotNetCoreCLI@2
name: dotnetRestore
displayName: "Restore nugets"
inputs:
command: 'restore'
projects: 'MGroup.MachineLearning.sln'
verbosityRestore: 'Normal'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: SonarCloudPrepare@1
condition: and(ne(variables['Build.Reason'], 'PullRequest') , eq(variables['enableSonarCloud'], 'true'))
displayName: "Prepare SonarCloud analysis"
inputs:
SonarCloud: 'SonarCloud'
organization: 'mgroupntua'
scannerMode: 'MSBuild'
projectKey: 'mgroupntua_MSolve.MachineLearning'
extraProperties: 'sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/coverage/coverage.opencover.xml'
- task: DotNetCoreCLI@2
name: dotnetBuild
displayName: "Build projects"
inputs:
command: 'build'
projects: 'MGroup.MachineLearning.sln'
arguments: '--no-restore --nologo --configuration $(buildConfiguration) /p:AssemblyVersion=$(GitVersion.AssemblySemVer) /p:Version=$(GitVersion.SemVer) /p:SourceLinkCreate=true'
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.AssemblySemVer'
- 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: PublishSymbols@2
displayName: "Publish symbols to Azure Devops artifacts"
inputs:
DetailedLog: true
SearchPattern: '**/bin/**/*.pdb'
IndexSources: false
SymbolServerType: 'TeamServices'
- task: SonarCloudAnalyze@1
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['enableSonarCloud'], 'true'))
displayName: "Perform SonarCloud Analysis"
- task: SonarCloudPublish@1
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['enableSonarCloud'], 'true'))
displayName: 'Publish Quality Gate results'
inputs:
pollingTimeoutSec: '300'
- task: PublishCodeCoverageResults@1
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: 'Normal'
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'