1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ name : $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
5
+
6
+ trigger :
7
+ branches :
8
+ include :
9
+ - master
10
+ pr : none
11
+
12
+ pool :
13
+ name : Azure Pipelines
14
+ vmImage : windows-latest
15
+ demands :
16
+ - msbuild
17
+ - vstest
18
+
19
+ variables :
20
+ buildPlatform : ' Any CPU'
21
+ buildConfiguration : ' Release'
22
+ ProductBinPath : ' $(Build.SourcesDirectory)\bin\$(BuildConfiguration)'
23
+
24
+
25
+ stages :
26
+
27
+ - stage : build
28
+ jobs :
29
+ - job : build
30
+ steps :
31
+
32
+ - task : UseDotNet@2
33
+ displayName : ' Use .NET 6'
34
+ inputs :
35
+ version : 6.x
36
+
37
+ - task : PoliCheck@1
38
+ displayName : ' Run PoliCheck "/src"'
39
+ inputs :
40
+ inputType : CmdLine
41
+ cmdLineArgs : ' /F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml'
42
+
43
+ - task : PoliCheck@1
44
+ displayName : ' Run PoliCheck "/test"'
45
+ inputs :
46
+ inputType : CmdLine
47
+ cmdLineArgs : ' /F:$(Build.SourcesDirectory)/test /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml'
48
+
49
+ - task : PoliCheck@1
50
+ displayName : ' PoliCheck for /tool'
51
+ inputs :
52
+ inputType : CmdLine
53
+ cmdLineArgs : ' /F:$(Build.SourcesDirectory)/tool /T:9 /Sev:"1|2" /PE:2 /O:poli_result_tool.xml'
54
+
55
+ # Install the nuget tool.
56
+ - task : NuGetToolInstaller@0
57
+ displayName : ' Use NuGet >=5.2.0'
58
+ inputs :
59
+ versionSpec : ' >=5.2.0'
60
+ checkLatest : true
61
+
62
+ # Build the Product project
63
+ - task : DotNetCoreCLI@2
64
+ displayName : ' build'
65
+ inputs :
66
+ projects : ' $(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln'
67
+ arguments : ' --configuration $(BuildConfiguration) --no-incremental'
68
+
69
+ # Run the Unit test
70
+ - task : DotNetCoreCLI@2
71
+ displayName : ' test'
72
+ inputs :
73
+ command : test
74
+ projects : ' $(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln'
75
+ arguments : ' --configuration $(BuildConfiguration) --no-build'
76
+
77
+ # CredScan
78
+ - task : securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
79
+ displayName : ' Run CredScan - Src'
80
+ inputs :
81
+ toolMajorVersion : ' V2'
82
+ scanFolder : ' $(Build.SourcesDirectory)\src'
83
+ debugMode : false
84
+
85
+ - task : securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
86
+ displayName : ' Run CredScan - Test'
87
+ inputs :
88
+ toolMajorVersion : ' V2'
89
+ scanFolder : ' $(Build.SourcesDirectory)\test'
90
+ debugMode : false
91
+
92
+ - task : AntiMalware@3
93
+ displayName : ' Run MpCmdRun.exe - ProductBinPath'
94
+ inputs :
95
+ FileDirPath : ' $(ProductBinPath)'
96
+ enabled : false
97
+
98
+ - task : BinSkim@3
99
+ displayName : ' Run BinSkim - Product Binaries'
100
+ inputs :
101
+ InputType : Basic
102
+ AnalyzeTarget : ' $(ProductBinPath)\**\Microsoft.OpenApi.OData.Reader.dll'
103
+ AnalyzeSymPath : ' $(ProductBinPath)'
104
+ AnalyzeVerbose : true
105
+ AnalyzeHashes : true
106
+ AnalyzeEnvironment : true
107
+
108
+ - task : PublishSecurityAnalysisLogs@2
109
+ displayName : ' Publish Security Analysis Logs'
110
+ inputs :
111
+ ArtifactName : SecurityLogs
112
+
113
+ - task : PostAnalysis@1
114
+ displayName : ' Post Analysis'
115
+ inputs :
116
+ BinSkim : true
117
+ CredScan : true
118
+ PoliCheck : true
119
+
120
+ - task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
121
+ displayName : ' ESRP CodeSigning'
122
+ inputs :
123
+ ConnectedServiceName : ' microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
124
+ FolderPath : src
125
+ signConfigType : inlineSignParams
126
+ inlineOperation : |
127
+ [
128
+ {
129
+ "keyCode": "CP-230012",
130
+ "operationSetCode": "SigntoolSign",
131
+ "parameters": [
132
+ {
133
+ "parameterName": "OpusName",
134
+ "parameterValue": "Microsoft"
135
+ },
136
+ {
137
+ "parameterName": "OpusInfo",
138
+ "parameterValue": "http://www.microsoft.com"
139
+ },
140
+ {
141
+ "parameterName": "FileDigest",
142
+ "parameterValue": "/fd \"SHA256\""
143
+ },
144
+ {
145
+ "parameterName": "PageHash",
146
+ "parameterValue": "/NPH"
147
+ },
148
+ {
149
+ "parameterName": "TimeStamp",
150
+ "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
151
+ }
152
+ ],
153
+ "toolName": "sign",
154
+ "toolVersion": "1.0"
155
+ },
156
+ {
157
+ "keyCode": "CP-230012",
158
+ "operationSetCode": "SigntoolVerify",
159
+ "parameters": [ ],
160
+ "toolName": "sign",
161
+ "toolVersion": "1.0"
162
+ }
163
+ ]
164
+ SessionTimeout : 20
165
+
166
+ # Pack
167
+ - task : DotNetCoreCLI@2
168
+ displayName : ' pack'
169
+ inputs :
170
+ command : pack
171
+ projects : src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj
172
+ arguments : ' -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg'
173
+
174
+ - task : PowerShell@2
175
+ displayName : ' Validate project version has been incremented'
176
+ condition : and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
177
+ inputs :
178
+ targetType : ' filePath'
179
+ filePath : $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
180
+ arguments : ' -projectVersion "$(VersionFullSemantic)"'
181
+
182
+ - task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
183
+ displayName : ' ESRP CodeSigning Nuget Packages'
184
+ inputs :
185
+ ConnectedServiceName : ' microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
186
+ FolderPath : ' $(Build.ArtifactStagingDirectory)'
187
+ Pattern : ' *.nupkg'
188
+ signConfigType : inlineSignParams
189
+ inlineOperation : |
190
+ [
191
+ {
192
+ "keyCode": "CP-401405",
193
+ "operationSetCode": "NuGetSign",
194
+ "parameters": [ ],
195
+ "toolName": "sign",
196
+ "toolVersion": "1.0"
197
+ },
198
+ {
199
+ "keyCode": "CP-401405",
200
+ "operationSetCode": "NuGetVerify",
201
+ "parameters": [ ],
202
+ "toolName": "sign",
203
+ "toolVersion": "1.0"
204
+ }
205
+ ]
206
+ SessionTimeout : 20
207
+
208
+ - task : PublishPipelineArtifact@1
209
+ displayName : ' Upload Artifact: Nugets'
210
+ inputs :
211
+ artifactName : Nugets
212
+ targetPath : $(Build.ArtifactStagingDirectory)
213
+
214
+ - stage : deploy
215
+ condition : and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
216
+ dependsOn : build
217
+ jobs :
218
+ - deployment : deploy
219
+ environment : nuget-org
220
+ strategy :
221
+ runOnce :
222
+ deploy :
223
+ pool :
224
+ vmImage : ubuntu-latest
225
+ steps :
226
+ - task : DownloadPipelineArtifact@2
227
+ displayName : Download nupkg from artifacts
228
+ inputs :
229
+ artifact : Nugets
230
+ source : current
231
+ - task : NuGetCommand@2
232
+ displayName : ' NuGet push'
233
+ inputs :
234
+ command : push
235
+ packagesToPush : ' $(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.OData.*.nupkg'
236
+ nuGetFeedType : external
237
+ publishFeedCredentials : ' OpenAPI Nuget Connection'
238
+
0 commit comments