-
Notifications
You must be signed in to change notification settings - Fork 387
/
azure-pipelines-official.yml
360 lines (330 loc) · 14.4 KB
/
azure-pipelines-official.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# CI trigger
trigger:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- '*'
exclude:
- '**/*.md'
- .config/*
- .devcontainer/*
- .github/*
- .vscode/*
- assets/*
- docs/*
- images/*
- .editorconfig
- .gitignore
- '*.txt'
- '*.github-issues'
# Scheduled trigger that will run at 8:00 AM every Monday and Wednesday
schedules:
- cron: "0 8 * * Mon"
displayName: Weekly build for Localization Updates (Monday)
branches:
include:
- main
- cron: "0 8 * * Wed"
displayName: Weekly build for Localization Updates (Wednesday)
branches:
include:
- main
variables:
- name: _TeamName
value: DotNetInteractive
- name: _BuildConfig
value: Release
- name: _PublishUsingPipelines
value: true
- name: _DotNetArtifactsCategory
value: .NETCore
- name: DisableDockerDetector
value: true
- name: PocketLoggerLogPath
value: $(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)
- name: TryDotNetPackagesPath
value: $(Build.SourcesDirectory)/artifacts/.trydotnet/packages
- name: NodeJSVersion
value: '16.13.0'
- name: LocPRCreationEnabled
value: ${{ eq(variables['Build.Reason'], 'Schedule') }}
- name: Codeql.Enabled
value: true
- name: _DotNetValidationArtifactsCategory
value: .NETCoreValidation
- group: DotNet-Interactive-SDLValidation-Params
- template: /eng/common/templates-official/variables/pool-providers.yml@self
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
sdl:
sourceAnalysisPool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
binskim:
enabled: true
scanOutputDirectoryOnly: true
policheck:
enabled: true
apiScan:
break: false
severity: error
sbom:
enabled: true
stages:
- stage: build
displayName: Build and Test
jobs:
- template: /eng/common/templates-official/job/onelocbuild.yml@self
parameters:
MirrorRepo: interactive
MirrorBranch: main
SkipLocProjectJsonGeneration: true
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-INTERACTIVE'
CreatePr: $(LocPRCreationEnabled)
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
jobs:
- job: Windows_NT
pool:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-windows-2022
os: windows
timeoutInMinutes: 180
variables:
- group: DotNet-Symbol-Server-Pats
- name: _SignType
value: Real
- name: _BuildArgs
value: /p:SignType=$(_SignType)
/p:DotNetSignType=$(_SignType)
/p:MicroBuild_SigningEnabled=true
/p:TeamName=$(_TeamName)
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
/p:PublishToSymbolServer=true
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: 'Publish Test results and Blame dumps'
condition: failed()
targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/TestResults/$(_BuildConfig)'
artifactName: 'Windows_test_results_and_dumps'
publishLocation: Container
- output: pipelineArtifact
displayName: 'Publish VSCode extension artifacts'
targetPath: '$(Build.ArtifactStagingDirectory)\vscode'
artifactName: 'vscode'
publishLocation: Container
- output: buildArtifacts
displayName: 'Publish NPM package artifacts'
PathtoPublish: '$(Build.ArtifactStagingDirectory)/npm'
ArtifactName: 'npm'
publishLocation: Container
- output: pipelineArtifact
displayName: 'Publish packages to artifacts container'
targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/packages/$(_BuildConfig)'
artifactName: 'packages'
publishLocation: Container
steps:
- checkout: self
clean: true
# Azure DevOps doesn't support git symlinks on Windows so we have to fake it
- pwsh: . "$(Build.SourcesDirectory)\src\ensure-symlinks.ps1"
displayName: ensure symlinks
- task: NodeTool@0
displayName: Add NodeJS/npm
inputs:
versionSpec: $(NodeJSVersion)
- script: |
robocopy "eng\resources" "$(Build.SourcesDirectory)\artifacts"
:: robocopy return codes are terrible; 1 means files were copied
if "%errorlevel%" == "1" exit /b 0
exit /b 1
displayName: Prevent test directory crawling
- pwsh: |
$testArg = if ($env:SKIPTESTS -ne "true") { "-test" } else { "" }
Write-Host "##vso[task.setvariable variable=_TestArgs]$testArg"
displayName: Promote variables
- script: eng\CIBuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
-sign
$(_BuildArgs)
$(_TestArgs)
displayName: Build
env:
POCKETLOGGER_LOG_PATH: $(PocketLoggerLogPath)
TRYDOTNET_PACKAGES_PATH: $(TryDotNetPackagesPath)
DOTNET_INTERACTIVE_FRONTEND_NAME: CI
- pwsh: ./test-retry-runner.ps1 -buildConfig $env:BUILDCONFIG
displayName: Test / Blame
workingDirectory: $(Build.SourcesDirectory)
env:
BUILDCONFIG: $(_BuildConfig)
condition: ne(variables['SkipTests'], 'true')
- pwsh: Get-ChildItem *.dmp -Recurse | Remove-Item
displayName: Delete dump files
workingDirectory: $(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)
condition: and(ne(variables['KeepDumps'], 'true'), ne(variables['SkipTests'], 'true'))
# publish VS Code and npm test results
- task: PublishTestResults@2
displayName: Publish VS Code extension and npm test results
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults'
condition: always()
- task: PowerShell@2
displayName: Pack VS Code Extensions
inputs:
filePath: $(Build.SourcesDirectory)/eng/package/PackVSCodeExtension.ps1
arguments: -stableToolVersionNumber $(StableToolVersionNumber) -outDir "$(Build.ArtifactStagingDirectory)\vscode"
workingDirectory: "$(Build.SourcesDirectory)/src"
pwsh: true
- task: PowerShell@2
displayName: Pack NPM package
inputs:
filePath: $(Build.SourcesDirectory)/eng/package/PackNpmPackage.ps1
arguments: -packageVersionNumber $(StableToolVersionNumber) -outDir "$(Build.ArtifactStagingDirectory)\npm"
workingDirectory: "$(Build.SourcesDirectory)/src/polyglot-notebooks"
pwsh: true
- task: CopyFiles@2
displayName: Copy artifacts to $(Build.ArtifactStagingDirectory)\artifacts
inputs:
SourceFolder: 'artifacts'
Contents: |
TestResults\**
packages\**
TargetFolder: '$(Build.ArtifactStagingDirectory)\artifacts'
condition: succeededOrFailed()
# Prevent symbols packages from being saved in the following `packages` artifact because they're incomplete.
# See `eng/AfterSolutionBuild.targets:StripFilesFromSymbolPackages` for details.
- script: del /S $(Build.SourcesDirectory)\artifacts\packages\$(_BuildConfig)\*.symbols.nupkg
displayName: Clean symbol packages
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: false
enablePublishUsingPipelines: false
jobs:
- job: Linux
pool:
name: $(DncEngInternalBuildPool)
os: linux
demands: ImageOverride -equals 1es-ubuntu-2204
timeoutInMinutes: 120
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish Test results and Blame dumps'
condition: failed()
targetPath: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
artifactName: 'Linux_test_results_and_dumps'
publishLocation: Container
steps:
- script: git config --global core.longpaths true
displayName: Enable `git clean` to handle long paths
- checkout: self
clean: true
- task: NodeTool@0
displayName: Add NodeJS/npm
inputs:
versionSpec: $(NodeJSVersion)
- script: |
mkdir -p "$(Build.SourcesDirectory)/artifacts"
rm -rf "$(Build.SourcesDirectory)/artifacts/*"
cp eng/resources/* "$(Build.SourcesDirectory)/artifacts"
displayName: Prevent test directory crawling
- pwsh: |
$testArg = if ($env:SKIPTESTS -ne "true") { "--test" } else { "" }
Write-Host "##vso[task.setvariable variable=_TestArgs]$testArg"
displayName: Promote variables
- script: ./eng/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
$(_TestArgs)
displayName: Run tests
env:
POCKETLOGGER_LOG_PATH: $(PocketLoggerLogPath)
TRYDOTNET_PACKAGES_PATH: $(TryDotNetPackagesPath)
DOTNET_INTERACTIVE_FRONTEND_NAME: CI
- pwsh: ./test-retry-runner.ps1 -buildConfig $env:BUILDCONFIG
displayName: Test / Blame
workingDirectory: $(Build.SourcesDirectory)
env:
BUILDCONFIG: $(_BuildConfig)
condition: ne(variables['SkipTests'], 'true')
- pwsh: Get-ChildItem *.dmp -Recurse | Remove-Item
displayName: Delete dump files
workingDirectory: $(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)
condition: and(ne(variables['KeepDumps'], 'true'), ne(variables['SkipTests'], 'true'))
# publish VS Code and npm test results
- task: PublishTestResults@2
displayName: Publish VS Code extension and npm test results
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults'
condition: always()
#---------------------------------------------------------------------------------------------------------------------#
# Post Build #
#---------------------------------------------------------------------------------------------------------------------#
- template: /eng/common/templates-official/post-build/post-build.yml@self
parameters:
publishingInfraVersion: 3
# signing validation currently has issues with dotnet 7; disabling as per internal guidance
enableSigningValidation: false
# Symbol validation is not entirely reliable as of yet, so should be turned off until https://github.com/dotnet/arcade/issues/2871 is resolved.
enableSymbolValidation: false
# SourceLink improperly looks for generated files. See https://github.com/dotnet/arcade/issues/3069
enableSourceLinkValidation: false
# Enable SDL validation, passing through values from the 'DotNet-FSharp-SDLValidation-Params' group.
SDLValidationParameters:
enable: true
params: >-
-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName "Interactive"
-TsaCodebaseName "Interactive-GitHub"
-TsaPublish $True
-PoliCheckAdditionalRunConfigParams @("UserExclusionPath < $(Build.SourcesDirectory)/eng/policheck_exclusions.xml")
#---------------------------------------------------------------------------------------------------------------------#
# NPM Publish #
#---------------------------------------------------------------------------------------------------------------------#
- template: /eng/publish/publish-npm.yml@self
parameters:
packageName: microsoft-polyglot-notebooks-*.tgz
registryUrl: pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/npm/registry/
registryUser: dnceng
registryEmail: [email protected]
publishingBranch: main