microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.19.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.ado/publish.yml

509lines · modecode

1name: qsharp-publish-$(BuildId)
2
3# Run on merges to main to ensure that the latest code
4# is always able to be published.
5trigger:
6 branches:
7 include:
8 - main
9
10# Run the pipeline every day at 6:00 AM to ensure
11# codeql and other governance checks are up-to-date.
12schedules:
13- cron: "0 6 * * *"
14 displayName: 'Build for Component Governance'
15 branches:
16 include:
17 - main
18 always: true
19
20variables:
21 CARGO_TERM_COLOR: always
22 RUST_TOOLCHAIN_VERSION: "1.88"
23
24resources:
25 repositories:
26 - repository: 1ESPipelineTemplates
27 type: git
28 name: 1ESPipelineTemplates/1ESPipelineTemplates
29 ref: refs/tags/release
30
31parameters:
32- name: matrix
33 type: object
34 default:
35 - name: linux_x86_64
36 poolName: 'Azure-Pipelines-DevTools-EO'
37 imageName: 'ubuntu-22.04'
38 os: linux
39 arch: x86_64
40 additionalTargets: wasm32-unknown-unknown
41 - name: linux_aarch64
42 poolName: 'Azure-Pipelines-DevTools-EO'
43 imageName: 'ubuntu-22.04'
44 os: linux
45 arch: aarch64
46 additionalRustTargets: aarch64-unknown-linux-gnu wasm32-unknown-unknown
47 - name: mac_universal
48 poolName: 'Azure Pipelines'
49 imageName: 'macOS-latest' # MacOS-specific Py (Mac is usually quite limited).
50 os: macOS
51 arch: x86_64
52 additionalRustTargets: aarch64-apple-darwin wasm32-unknown-unknown
53 - name: windows_x86_64
54 poolName: 'Azure-Pipelines-DevTools-EO'
55 imageName: 'windows-latest' # Win-specific Py + Platform-independent Py.
56 os: windows
57 arch: x86_64
58 additionalTargets: wasm32-unknown-unknown
59 - name: windows_aarch64
60 poolName: 'Azure-Pipelines-DevTools-EO'
61 imageName: 'windows-latest' # Win-specific Py + Platform-independent Py.
62 os: windows
63 arch: aarch64
64 additionalRustTargets: aarch64-pc-windows-msvc wasm32-unknown-unknown
65
66
67# variables set by pipeline
68# - BASE_IMAGE
69# - BUILD_NUMBER
70# - BUILD_TYPE
71# - cratesIoFeedOverride
72# - OwnerPersonalAlias
73# - PAT
74# - toolchainFeed
75
76extends:
77 template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
78 parameters:
79 sdl:
80 sourceAnalysisPool:
81 name: 'Azure-Pipelines-DevTools-EO'
82 image: windows-2022
83 os: windows
84 stages:
85 - stage: build
86 displayName: Build
87 jobs:
88 - job: "Node"
89 pool:
90 name: 'Azure-Pipelines-DevTools-EO'
91 image: 'ubuntu-latest'
92 os: linux
93 timeoutInMinutes: 90
94 templateContext:
95 outputs:
96 - output: pipelineArtifact
97 displayName: 'Upload NPM Package Artifact'
98 targetPath: $(System.DefaultWorkingDirectory)/target/npm/qsharp
99 artifactName: NPM
100 condition: succeeded()
101 steps:
102 # common init steps
103 - task: RustInstaller@1
104 inputs:
105 rustVersion: ms-$(RUST_TOOLCHAIN_VERSION)
106 additionalTargets: wasm32-unknown-unknown
107 cratesIoFeedOverride: $(cratesIoFeedOverride)
108 toolchainFeed: $(toolchainFeed)
109 displayName: Install Rust toolchain
110
111 - task: UsePythonVersion@0
112 inputs:
113 versionSpec: '3.11'
114
115 - task: UseNode@1
116 inputs:
117 version: "20.x"
118
119 - script: |
120 python ./prereqs.py --install && python ./version.py
121 displayName: Install Prereqs and set version
122
123 # build steps
124
125 - script: |
126 python build.py --npm --wasm --no-check-prereqs
127 displayName: Build VSCode Extension
128
129 - script: |
130 mkdir -p $(System.DefaultWorkingDirectory)/target/npm/qsharp
131 npm pack --pack-destination $(System.DefaultWorkingDirectory)/target/npm/qsharp
132 displayName: Pack NPM Package
133 workingDirectory: $(System.DefaultWorkingDirectory)/source/npm/qsharp
134
135 - job: "VSCode"
136 pool:
137 name: 'Azure-Pipelines-DevTools-EO'
138 image: 'ubuntu-latest'
139 os: linux
140 timeoutInMinutes: 90
141 templateContext:
142 outputs:
143 - output: pipelineArtifact
144 displayName: 'Upload VSCode Extension Artifact'
145 targetPath: $(System.DefaultWorkingDirectory)/target/vscode
146 artifactName: VSIX
147 condition: succeeded()
148 steps:
149 # common init steps
150 - task: RustInstaller@1
151 inputs:
152 rustVersion: ms-$(RUST_TOOLCHAIN_VERSION)
153 additionalTargets: wasm32-unknown-unknown
154 cratesIoFeedOverride: $(cratesIoFeedOverride)
155 toolchainFeed: $(toolchainFeed)
156 displayName: Install Rust toolchain
157
158 - task: UsePythonVersion@0
159 inputs:
160 versionSpec: '3.11'
161
162 - task: UseNode@1
163 inputs:
164 version: "20.x"
165
166 - script: |
167 python ./prereqs.py --install && python ./version.py
168 displayName: Install Prereqs and set version
169
170 # Below VS Code extension build only needs to run on one platform (Linux x86_64 for now)
171 - script: |
172 npm install -g @vscode/vsce
173 displayName: Install Prereqs for VSCode Extension
174
175 # build steps
176
177 - script: |
178 python build.py --wasm --npm --vscode --integration-tests --no-check-prereqs
179 displayName: Build VSCode Extension
180
181 - script: |
182 vsce package --pre-release
183 mkdir -p $(System.DefaultWorkingDirectory)/target/vscode
184 mv *.vsix $(System.DefaultWorkingDirectory)/target/vscode
185 condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'dev'))
186 displayName: Pack pre-release VSCode Extension
187 workingDirectory: '$(System.DefaultWorkingDirectory)/source/vscode'
188
189 - script: |
190 vsce package
191 mkdir -p $(System.DefaultWorkingDirectory)/target/vscode
192 mv *.vsix $(System.DefaultWorkingDirectory)/target/vscode
193 condition: and(succeeded(), ne(variables['BUILD_TYPE'], 'dev'))
194 displayName: Pack VSCode Extension
195 workingDirectory: '$(System.DefaultWorkingDirectory)/source/vscode'
196
197 - job: "JupyterLab"
198 pool:
199 name: 'Azure-Pipelines-DevTools-EO'
200 image: 'ubuntu-latest'
201 os: linux
202 timeoutInMinutes: 90
203 templateContext:
204 outputs:
205 - output: pipelineArtifact
206 displayName: 'Upload JupyterLab Python Artifacts'
207 targetPath: $(System.DefaultWorkingDirectory)/target/wheels/
208 artifactName: Wheels.JupyterLab
209 condition: succeeded()
210 steps:
211 # common init steps
212 - task: RustInstaller@1
213 inputs:
214 rustVersion: ms-$(RUST_TOOLCHAIN_VERSION)
215 cratesIoFeedOverride: $(cratesIoFeedOverride)
216 toolchainFeed: $(toolchainFeed)
217 displayName: Install Rust toolchain
218
219 - task: UsePythonVersion@0
220 inputs:
221 versionSpec: '3.11'
222
223 - task: UseNode@1
224 inputs:
225 version: "20.x"
226
227 - script: |
228 python ./prereqs.py --skip-wasm && python ./version.py
229 displayName: Install Prereqs and set version
230
231 - script: |
232 python ./build.py --jupyterlab --widgets --no-check --no-check-prereqs
233 displayName: Build JupyterLab Package
234
235 - script: |
236 ls target/wheels/*
237
238 - ${{ each target in parameters.matrix }}:
239 - job: Python_${{ target.name }}_job
240 pool:
241 name: ${{ target.poolName }}
242 image: ${{ target.imageName }}
243 os: ${{ target.os }}
244 variables:
245 arch: ${{ target.arch }}
246 additionalRustTargets: ${{ target.additionalRustTargets }}
247 timeoutInMinutes: 90
248 templateContext:
249 outputs:
250 - output: pipelineArtifact
251 displayName: 'Upload Python Artifacts Mac'
252 condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
253 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
254 artifactName: Wheels.Mac
255 - output: pipelineArtifact
256 displayName: 'Upload Python Artifacts Win'
257 condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
258 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
259 artifactName: Wheels.Win.${{ target.arch }}
260 - output: pipelineArtifact
261 displayName: 'Upload Python Artifacts Linux'
262 condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
263 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
264 artifactName: Wheels.Linux.${{ target.arch }}
265 steps:
266 # common init steps
267 # if we have additional rust targets, we need to install them
268 - task: RustInstaller@1
269 inputs:
270 rustVersion: ms-$(RUST_TOOLCHAIN_VERSION)
271 additionalTargets: $(additionalRustTargets)
272 cratesIoFeedOverride: $(cratesIoFeedOverride)
273 toolchainFeed: $(toolchainFeed)
274 displayName: Install Rust toolchain
275 condition: ne(variables['additionalRustTargets'], '')
276
277 # otherwise just install the default toolchain
278 - task: RustInstaller@1
279 inputs:
280 rustVersion: ms-$(RUST_TOOLCHAIN_VERSION)
281 cratesIoFeedOverride: $(cratesIoFeedOverride)
282 toolchainFeed: $(toolchainFeed)
283 displayName: Install Rust toolchain
284 condition: eq(variables['additionalRustTargets'], '')
285
286 - script: |
287 rustc --version
288 rustc --print target-list
289 displayName: View rust target info
290
291 - task: UsePythonVersion@0
292 inputs:
293 versionSpec: '3.11'
294
295 - task: UseNode@1
296 inputs:
297 version: "20.x"
298
299 - script: |
300 python ./prereqs.py --skip-wasm && python ./version.py
301 displayName: Install Prereqs and set version
302
303 - script: |
304 chmod +x ./.ado/docker/linux-aarch64/install_prereqs.sh
305 sudo ./.ado/docker/linux-aarch64/install_prereqs.sh
306 displayName: Install Linux aarch64 cross prereqs
307 condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64'))
308
309 - script: |
310 python build.py --pip --no-check-prereqs --integration-tests
311 displayName: Build Platform-Dependent Py Packages
312 condition: ne(variables['arch'], 'aarch64')
313
314 - script: |
315 python -m pip install auditwheel patchelf
316 ls target/wheels
317 ls target/wheels/*.whl | xargs auditwheel show
318 ls target/wheels/*.whl | xargs auditwheel repair --wheel-dir ./target/wheels/ --plat manylinux_2_35_x86_64
319 rm target/wheels/*-linux_x86_64.whl
320 ls target/wheels
321 displayName: Run auditwheel for Linux Wheels
322 condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'x86_64'))
323
324 # for linux aarch64 cross build we want to skip tests as we can't run the code.
325 # and we can't run the samples as qsc is currently cross compiled.
326 - script: |
327 env CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu python build.py --pip --no-check-prereqs --no-check --no-test
328 displayName: Cross Build Linux aarch64 Py Packages
329 condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64'))
330
331 - script: |
332 chmod +x ./.ado/docker/linux-aarch64/run.sh
333
334 ./.ado/docker/linux-aarch64/run.sh
335 displayName: Run auditwheel and python tests for Linux aarch64 Wheels
336 condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64'))
337
338 - script: |
339 echo ##vso[task.setvariable variable=CARGO_BUILD_TARGET]aarch64-pc-windows-msvc
340 displayName: Set cargo build target for Windows aarch64
341 condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64'))
342
343 - script: |
344 python build.py --pip --no-check-prereqs --no-check --no-test
345 displayName: Cross Build Windows aarch64 Py Packages
346 condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64'))
347
348 - script: |
349 dir target\wheels\*
350 displayName: List Py Packages on Win
351 condition: eq(variables['Agent.OS'], 'Windows_NT')
352
353 - script: |
354 ls target/wheels/*
355 displayName: List Py Packages on non-Win
356 condition: ne(variables['Agent.OS'], 'Windows_NT')
357
358 - stage: approval
359 displayName: Approval
360 dependsOn: build
361 condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
362 jobs:
363 - job: "Approval"
364 pool: server
365 timeoutInMinutes: 1440 # job times out in 1 day
366 steps:
367 - task: ManualValidation@0
368 timeoutInMinutes: 1440 # task times out in 1 day
369 inputs:
370 notifyUsers: ''
371 instructions: 'Please verify artifacts and approve the release'
372 onTimeout: 'reject'
373
374 - stage: release
375 displayName: Release
376 dependsOn: approval
377 condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
378 jobs:
379 - job: "Publish_VSIX_Package"
380 pool:
381 name: 'Azure-Pipelines-DevTools-EO'
382 image: 'ubuntu-latest'
383 os: linux
384 templateContext:
385 type: releaseJob
386 isProduction: true
387 inputs: # All input build artifacts must be declared here
388 - input: pipelineArtifact
389 artifactName: VSIX
390 targetPath: $(System.DefaultWorkingDirectory)/target/vscode
391 steps:
392 - script: |
393 npm install -g @vscode/vsce
394 displayName: Install Prereqs for VSCode Ext Publishing
395
396 - script: |
397 VSIX_RPATH="$(System.DefaultWorkingDirectory)/target/vscode"
398 VSIX_FNAME=`ls $VSIX_RPATH/*.vsix`
399 echo "RPATH: $VSIX_RPATH"
400 echo "FNAME: $VSIX_FNAME"
401 vsce publish --pre-release --packagePath $VSIX_FNAME 2>&1 > pub.log
402 condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'dev'))
403 displayName: Publish pre-release VSCode Extension
404 env:
405 VSCE_PAT: $(PAT)
406
407 - script: |
408 VSIX_RPATH="$(System.DefaultWorkingDirectory)/target/vscode"
409 VSIX_FNAME=`ls $VSIX_RPATH/*.vsix`
410 echo "RPATH: $VSIX_RPATH"
411 echo "FNAME: $VSIX_FNAME"
412 vsce publish --packagePath $VSIX_FNAME 2>&1 > pub.log
413 condition: and(succeeded(), ne(variables['BUILD_TYPE'], 'dev'))
414 displayName: Publish VSCode Extension
415 env:
416 VSCE_PAT: $(PAT)
417
418 - script: |
419 dir
420 cat pub.log
421 displayName: If failed, display VSCode Publishing Results
422 condition: failed()
423 workingDirectory: '$(System.DefaultWorkingDirectory)'
424
425
426 - job: "Publish_Python_Packages"
427 pool:
428 name: 'Azure-Pipelines-DevTools-EO'
429 image: 'ubuntu-latest'
430 os: linux
431 templateContext:
432 type: releaseJob
433 isProduction: true
434 inputs: # All input build artifacts must be declared here
435 - input: pipelineArtifact
436 artifactName: Wheels.Win.x86_64
437 targetPath: $(System.DefaultWorkingDirectory)/artifacts/win-x86_64
438 - input: pipelineArtifact
439 artifactName: Wheels.Win.aarch64
440 targetPath: $(System.DefaultWorkingDirectory)/artifacts/win-aarch64
441 - input: pipelineArtifact
442 artifactName: Wheels.Mac
443 targetPath: $(System.DefaultWorkingDirectory)/artifacts/mac
444 - input: pipelineArtifact
445 artifactName: Wheels.Linux.x86_64
446 targetPath: $(System.DefaultWorkingDirectory)/artifacts/linux-x86_64
447 - input: pipelineArtifact
448 artifactName: Wheels.Linux.aarch64
449 targetPath: $(System.DefaultWorkingDirectory)/artifacts/linux-aarch64
450 - input: pipelineArtifact
451 artifactName: Wheels.JupyterLab
452 targetPath: $(System.DefaultWorkingDirectory)/artifacts/jupyterlab
453 steps:
454 - script: |
455 mkdir -p $(System.DefaultWorkingDirectory)/target/wheels
456 find $(System.DefaultWorkingDirectory)/artifacts -name "*.whl" -exec cp {} $(System.DefaultWorkingDirectory)/target/wheels/ \;
457 ls $(System.DefaultWorkingDirectory)/target/wheels
458 displayName: Collect and Display Py Artifacts in Publishing Dir
459
460 - task: EsrpRelease@9
461 condition: succeeded()
462 displayName: Publish Py Packages
463 inputs:
464 connectedservicename: 'PME ESRP Azure Connection'
465 usemanagedidentity: true
466 keyvaultname: 'quantum-esrp-kv'
467 signcertname: ESRPCert
468 clientid: '832c049d-cd07-4c1c-bfa5-c07250d190cb'
469 contenttype: PyPi
470 domaintenantid: '975f013f-7f24-47e8-a7d3-abc4752bf346'
471 folderlocation: '$(System.DefaultWorkingDirectory)/target/wheels'
472 waitforreleasecompletion: true
473 owners: 'billti@microsoft.com'
474 approvers: 'billti@microsoft.com'
475 mainpublisher: ESRPRELPACMAN
476
477 - job: "Publish_NPM_Package"
478 pool:
479 name: 'Azure-Pipelines-DevTools-EO'
480 image: 'ubuntu-latest'
481 os: linux
482 templateContext:
483 type: releaseJob
484 isProduction: true
485 inputs: # All input build artifacts must be declared here
486 - input: pipelineArtifact
487 artifactName: NPM
488 targetPath: $(System.DefaultWorkingDirectory)/target/npm/qsharp
489 steps:
490 - script: |
491 ls $(System.DefaultWorkingDirectory)/target/npm/qsharp/*
492 displayName: Display NPM Artifacts in Publishing Dir
493
494 - task: EsrpRelease@9
495 condition: succeeded()
496 displayName: Publish NPM Package
497 inputs:
498 connectedservicename: 'PME ESRP Azure Connection'
499 usemanagedidentity: true
500 keyvaultname: 'quantum-esrp-kv'
501 signcertname: ESRPCert
502 clientid: '832c049d-cd07-4c1c-bfa5-c07250d190cb'
503 contenttype: 'NPM'
504 domaintenantid: '975f013f-7f24-47e8-a7d3-abc4752bf346'
505 folderlocation: '$(System.DefaultWorkingDirectory)/target/npm/qsharp'
506 waitforreleasecompletion: true
507 owners: 'billti@microsoft.com'
508 approvers: 'billti@microsoft.com'
509 mainpublisher: ESRPRELPACMAN
510