microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ff84ca4f2e3e0089d8b11d5dbcb9057f28ee4f38

Branches

Tags

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

Clone

HTTPS

Download ZIP

.ado/publish.yml

516lines · modecode

1name: qdk-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.90"
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-GPU"
37 imageName: "1es-pt-dsvm-ubuntu-2204"
38 os: linux
39 arch: x86_64
40 envVars:
41 QDK_GPU_TESTS: "1"
42 - name: linux_aarch64
43 poolName: "Azure-Pipelines-DevTools-ARM64-EO"
44 imageName: "azurelinux-3.0-arm64"
45 os: linux
46 arch: aarch64
47 - name: mac_x86_64
48 poolName: "Azure Pipelines"
49 imageName: "macOS-latest" # MacOS-specific Py (Mac is usually quite limited).
50 os: macOS
51 arch: x86_64
52 - name: mac_aarch64
53 poolName: "AcesShared"
54 os: macOS
55 arch: aarch64
56 envVars:
57 QDK_GPU_TESTS: "1"
58 - name: windows_x86_64
59 poolName: "Azure-Pipelines-DevTools-GPU"
60 imageName: "1es-pt-dsvm-windows-2022" # Win-specific Py + Platform-independent Py.
61 os: windows
62 arch: x86_64
63 envVars:
64 QDK_GPU_TESTS: "1"
65 - name: windows_aarch64
66 poolName: "Azure-Pipelines-DevTools-ARM64-EO"
67 imageName: "Windows-2022-ARM64"
68 os: windows
69 arch: aarch64
70
71# variables set by pipeline
72# - BASE_IMAGE
73# - BUILD_NUMBER
74# - BUILD_TYPE
75# - cratesIoFeedOverride
76# - OwnerPersonalAlias
77# - PAT
78# - toolchainFeed
79
80extends:
81 template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
82 parameters:
83 sdl:
84 sourceAnalysisPool:
85 name: "Azure-Pipelines-DevTools-EO"
86 image: windows-2022
87 os: windows
88 stages:
89 - stage: build
90 displayName: Build
91 jobs:
92 - job: "Node"
93 pool:
94 name: "Azure-Pipelines-DevTools-EO"
95 image: "ubuntu-latest"
96 os: linux
97 timeoutInMinutes: 90
98 templateContext:
99 outputs:
100 - output: pipelineArtifact
101 displayName: "Upload NPM Package Artifact"
102 targetPath: $(System.DefaultWorkingDirectory)/target/npm/qsharp
103 artifactName: NPM
104 condition: succeeded()
105 steps:
106 # common init steps
107 - task: RustInstaller@1
108 inputs:
109 rustVersion: ms-prod-$(RUST_TOOLCHAIN_VERSION)
110 additionalTargets: wasm32-unknown-unknown
111 cratesIoFeedOverride: $(cratesIoFeedOverride)
112 toolchainFeed: $(toolchainFeed)
113 displayName: Install Rust toolchain
114
115 - task: UsePythonVersion@0
116 inputs:
117 versionSpec: "3.11"
118
119 - task: UseNode@1
120 inputs:
121 version: "22.x"
122
123 - script: |
124 python ./prereqs.py --install && python ./version.py
125 displayName: Install Prereqs and set version
126
127 # build steps
128
129 - script: |
130 python build.py --npm --wasm --no-check-prereqs
131 displayName: Build VSCode Extension
132
133 - script: |
134 mkdir -p $(System.DefaultWorkingDirectory)/target/npm/qsharp
135 npm pack --pack-destination $(System.DefaultWorkingDirectory)/target/npm/qsharp
136 displayName: Pack NPM Package
137 workingDirectory: $(System.DefaultWorkingDirectory)/source/npm/qsharp
138
139 - job: "VSCode"
140 pool:
141 name: "Azure-Pipelines-DevTools-EO"
142 image: "ubuntu-latest"
143 os: linux
144 timeoutInMinutes: 90
145 templateContext:
146 outputs:
147 - output: pipelineArtifact
148 displayName: "Upload VSCode Extension Artifact"
149 targetPath: $(System.DefaultWorkingDirectory)/target/vscode
150 artifactName: VSIX
151 condition: succeeded()
152 steps:
153 # common init steps
154 - task: RustInstaller@1
155 inputs:
156 rustVersion: ms-prod-$(RUST_TOOLCHAIN_VERSION)
157 additionalTargets: wasm32-unknown-unknown
158 cratesIoFeedOverride: $(cratesIoFeedOverride)
159 toolchainFeed: $(toolchainFeed)
160 displayName: Install Rust toolchain
161
162 - task: UsePythonVersion@0
163 inputs:
164 versionSpec: "3.11"
165
166 - task: UseNode@1
167 inputs:
168 version: "22.x"
169
170 - script: |
171 python ./prereqs.py --install && python ./version.py
172 displayName: Install Prereqs and set version
173
174 # Below VS Code extension build only needs to run on one platform (Linux x86_64 for now)
175 - script: |
176 npm install -g @vscode/vsce
177 displayName: Install Prereqs for VSCode Extension
178
179 # build steps
180
181 - script: |
182 python build.py --wasm --npm --vscode --integration-tests --no-check-prereqs
183 displayName: Build VSCode Extension
184
185 - script: |
186 vsce package --pre-release
187 mkdir -p $(System.DefaultWorkingDirectory)/target/vscode
188 mv *.vsix $(System.DefaultWorkingDirectory)/target/vscode
189 condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'dev'))
190 displayName: Pack pre-release VSCode Extension
191 workingDirectory: "$(System.DefaultWorkingDirectory)/source/vscode"
192
193 - script: |
194 vsce package
195 mkdir -p $(System.DefaultWorkingDirectory)/target/vscode
196 mv *.vsix $(System.DefaultWorkingDirectory)/target/vscode
197 condition: and(succeeded(), ne(variables['BUILD_TYPE'], 'dev'))
198 displayName: Pack VSCode Extension
199 workingDirectory: "$(System.DefaultWorkingDirectory)/source/vscode"
200
201 - job: "Platform_Agnostic_Python"
202 pool:
203 name: "Azure-Pipelines-DevTools-EO"
204 image: "ubuntu-latest"
205 os: linux
206 timeoutInMinutes: 90
207 templateContext:
208 outputs:
209 - output: pipelineArtifact
210 displayName: "Upload Platform-Agnostic Python Artifacts"
211 targetPath: $(System.DefaultWorkingDirectory)/target/wheels/
212 artifactName: Wheels.PlatformAgnostic
213 condition: succeeded()
214 steps:
215 # common init steps
216 - task: RustInstaller@1
217 inputs:
218 rustVersion: ms-prod-$(RUST_TOOLCHAIN_VERSION)
219 cratesIoFeedOverride: $(cratesIoFeedOverride)
220 toolchainFeed: $(toolchainFeed)
221 displayName: Install Rust toolchain
222
223 - task: UsePythonVersion@0
224 inputs:
225 versionSpec: "3.11"
226
227 - task: UseNode@1
228 inputs:
229 version: "22.x"
230
231 - script: |
232 python ./prereqs.py --skip-wasm && python ./version.py
233 displayName: Install Prereqs and set version
234
235 # The jupyterlab and widgets packages have no tests. The qdk package has minimal tests but
236 # they also depend on the qsharp package which is platform-dependent. So we skip tests here
237 # and rely on the GitHub CI to run the few `qdk` tests on every PR.
238 - script: |
239 python ./build.py --jupyterlab --widgets --qdk --no-check --no-test --no-check-prereqs
240 displayName: Build Platform-Agnostic Packages
241
242 - script: |
243 ls target/wheels/*
244
245 - ${{ each target in parameters.matrix }}:
246 - job: Python_${{ target.name }}_job
247 pool:
248 name: ${{ target.poolName }}
249 image: ${{ target.imageName }}
250 os: ${{ target.os }}
251 ${{ if and(eq(target.arch, 'aarch64'), eq(target.os, 'linux')) }}:
252 hostArchitecture: Arm64
253 ${{ if eq(target.poolName, 'AcesShared') }}:
254 demands:
255 - ImageOverride -equals ACES_VM_SharedPool_Sequoia
256 variables:
257 arch: ${{ target.arch }}
258 additionalRustTargets: ${{ target.additionalRustTargets }}
259 ${{ if target.envVars }}:
260 ${{ each envVar in target.envVars }}:
261 ${{ envVar.key }}: ${{ envVar.value }}
262 timeoutInMinutes: 90
263 templateContext:
264 outputs:
265 - output: pipelineArtifact
266 displayName: "Upload Python Artifacts Mac"
267 condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
268 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
269 artifactName: Wheels.Mac.${{ target.arch }}
270 - output: pipelineArtifact
271 displayName: "Upload Python Artifacts Win"
272 condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
273 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
274 artifactName: Wheels.Win.${{ target.arch }}
275 - output: pipelineArtifact
276 displayName: "Upload Python Artifacts Linux"
277 condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
278 targetPath: $(System.DefaultWorkingDirectory)/target/wheels
279 artifactName: Wheels.Linux.${{ target.arch }}
280 steps:
281 # common init steps
282 # if we have additional rust targets, we need to install them
283 - task: RustInstaller@1
284 inputs:
285 rustVersion: ms-prod-$(RUST_TOOLCHAIN_VERSION)
286 additionalTargets: wasm32-unknown-unknown
287 cratesIoFeedOverride: $(cratesIoFeedOverride)
288 toolchainFeed: $(toolchainFeed)
289 displayName: Install Rust toolchain
290
291 - script: |
292 rustc --version
293 rustc --print target-list
294 displayName: View rust target info
295
296 - task: UsePythonVersion@0
297 inputs:
298 versionSpec: "3.11"
299 ${{ if eq(target.arch, 'aarch64') }}:
300 architecture: "arm64"
301 condition: not(and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64')))
302
303 # UsePythonVersion@0 does not support aarch64, so we install Python manually
304 # using tdnf on Azure Linux 3.0 aarch64
305 # We also need alias python3 as python
306 - script: |
307 sudo tdnf install python3-3.12.9 python3-pip-24.2 -y
308 sudo alternatives --install /usr/bin/python python /usr/bin/python3 1
309 displayName: Install Python on Azure Linux 3.0 aarch64
310 condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64'))
311
312 - task: UseNode@1
313 inputs:
314 version: "22.x"
315
316 - script: |
317 sudo apt update
318 sudo apt install -y patchelf
319 displayName: Install Linux x86_64 prereqs
320 condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'x86_64'))
321
322 # on Azure Linux 3.0 aarch64 we need to install:
323 # ld with binutils
324 # crt1.o and others with glibc-devel
325 # std lib headers with kernel-headers
326 # patchelf for modifying ELF files via auditwheel
327 - script: |
328 sudo tdnf install binutils glibc-devel kernel-headers patchelf gcc -y
329 displayName: Install c++ build tools on Azure Linux 3.0 aarch64
330 condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['arch'], 'aarch64'))
331
332 - script: |
333 python ./prereqs.py --skip-wasm
334 displayName: Install Prereqs
335 condition: and(ne(variables['Agent.OS'], 'Linux'), ne(variables['arch'], 'aarch64'))
336
337 - script: |
338 python ./version.py
339 displayName: Set version
340
341 # Windows arm64
342 - script: |
343 python build.py --pip --no-check-prereqs --no-integration-tests --no-optional-dependencies
344 displayName: Build Platform-Dependent Py Packages
345 condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64'))
346
347 # every other platform
348 - script: |
349 python build.py --pip --no-check-prereqs --integration-tests --manylinux
350 displayName: Build Platform-Dependent Py Packages
351 condition: not(and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['arch'], 'aarch64')))
352
353 - script: |
354 dir target\wheels\*
355 displayName: List Py Packages on Win
356 condition: eq(variables['Agent.OS'], 'Windows_NT')
357
358 - script: |
359 ls target/wheels/*
360 displayName: List Py Packages on non-Win
361 condition: ne(variables['Agent.OS'], 'Windows_NT')
362
363 - stage: approval
364 displayName: Approval
365 dependsOn: build
366 condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
367 jobs:
368 - job: "Approval"
369 pool: server
370 timeoutInMinutes: 1440 # job times out in 1 day
371 steps:
372 - task: ManualValidation@0
373 timeoutInMinutes: 1440 # task times out in 1 day
374 inputs:
375 notifyUsers: ""
376 instructions: "Please verify artifacts and approve the release"
377 onTimeout: "reject"
378
379 - stage: release
380 displayName: Release
381 dependsOn: approval
382 condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
383 jobs:
384 - job: "Publish_VSIX_Package"
385 pool:
386 name: "Azure-Pipelines-DevTools-EO"
387 image: "ubuntu-latest"
388 os: linux
389 templateContext:
390 type: releaseJob
391 isProduction: true
392 inputs: # All input build artifacts must be declared here
393 - input: pipelineArtifact
394 artifactName: VSIX
395 targetPath: $(System.DefaultWorkingDirectory)/target/vscode
396 steps:
397 - script: |
398 npm install -g @vscode/vsce
399 displayName: Install Prereqs for VSCode Ext Publishing
400
401 - script: |
402 VSIX_RPATH="$(System.DefaultWorkingDirectory)/target/vscode"
403 VSIX_FNAME=`ls $VSIX_RPATH/*.vsix`
404 echo "RPATH: $VSIX_RPATH"
405 echo "FNAME: $VSIX_FNAME"
406 vsce publish --pre-release --packagePath $VSIX_FNAME 2>&1 > pub.log
407 condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'dev'))
408 displayName: Publish pre-release VSCode Extension
409 env:
410 VSCE_PAT: $(PAT)
411
412 - script: |
413 VSIX_RPATH="$(System.DefaultWorkingDirectory)/target/vscode"
414 VSIX_FNAME=`ls $VSIX_RPATH/*.vsix`
415 echo "RPATH: $VSIX_RPATH"
416 echo "FNAME: $VSIX_FNAME"
417 vsce publish --packagePath $VSIX_FNAME 2>&1 > pub.log
418 condition: and(succeeded(), ne(variables['BUILD_TYPE'], 'dev'))
419 displayName: Publish VSCode Extension
420 env:
421 VSCE_PAT: $(PAT)
422
423 - script: |
424 dir
425 cat pub.log
426 displayName: If failed, display VSCode Publishing Results
427 condition: failed()
428 workingDirectory: "$(System.DefaultWorkingDirectory)"
429
430 - job: "Publish_Python_Packages"
431 pool:
432 name: "Azure-Pipelines-DevTools-EO"
433 image: "ubuntu-latest"
434 os: linux
435 templateContext:
436 type: releaseJob
437 isProduction: true
438 inputs: # All input build artifacts must be declared here
439 - input: pipelineArtifact
440 artifactName: Wheels.Win.x86_64
441 targetPath: $(System.DefaultWorkingDirectory)/artifacts/win-x86_64
442 - input: pipelineArtifact
443 artifactName: Wheels.Win.aarch64
444 targetPath: $(System.DefaultWorkingDirectory)/artifacts/win-aarch64
445 - input: pipelineArtifact
446 artifactName: Wheels.Mac.x86_64
447 targetPath: $(System.DefaultWorkingDirectory)/artifacts/mac-x86_64
448 - input: pipelineArtifact
449 artifactName: Wheels.Mac.aarch64
450 targetPath: $(System.DefaultWorkingDirectory)/artifacts/mac-aarch64
451 - input: pipelineArtifact
452 artifactName: Wheels.Linux.x86_64
453 targetPath: $(System.DefaultWorkingDirectory)/artifacts/linux-x86_64
454 - input: pipelineArtifact
455 artifactName: Wheels.Linux.aarch64
456 targetPath: $(System.DefaultWorkingDirectory)/artifacts/linux-aarch64
457 - input: pipelineArtifact
458 artifactName: Wheels.PlatformAgnostic
459 targetPath: $(System.DefaultWorkingDirectory)/artifacts/platform-agnostic
460 steps:
461 - script: |
462 mkdir -p $(System.DefaultWorkingDirectory)/target/wheels
463 find $(System.DefaultWorkingDirectory)/artifacts -name "*.whl" -exec cp {} $(System.DefaultWorkingDirectory)/target/wheels/ \;
464 ls $(System.DefaultWorkingDirectory)/target/wheels
465 displayName: Collect and Display Py Artifacts in Publishing Dir
466
467 - task: EsrpRelease@9
468 condition: succeeded()
469 displayName: Publish Py Packages
470 inputs:
471 connectedservicename: "PME ESRP Azure Connection"
472 usemanagedidentity: true
473 keyvaultname: "quantum-esrp-kv"
474 signcertname: ESRPCert
475 clientid: "832c049d-cd07-4c1c-bfa5-c07250d190cb"
476 contenttype: PyPi
477 domaintenantid: "975f013f-7f24-47e8-a7d3-abc4752bf346"
478 folderlocation: "$(System.DefaultWorkingDirectory)/target/wheels"
479 waitforreleasecompletion: true
480 owners: "billti@microsoft.com"
481 approvers: "billti@microsoft.com"
482 mainpublisher: ESRPRELPACMAN
483
484 - job: "Publish_NPM_Package"
485 pool:
486 name: "Azure-Pipelines-DevTools-EO"
487 image: "ubuntu-latest"
488 os: linux
489 templateContext:
490 type: releaseJob
491 isProduction: true
492 inputs: # All input build artifacts must be declared here
493 - input: pipelineArtifact
494 artifactName: NPM
495 targetPath: $(System.DefaultWorkingDirectory)/target/npm/qsharp
496 steps:
497 - script: |
498 ls $(System.DefaultWorkingDirectory)/target/npm/qsharp/*
499 displayName: Display NPM Artifacts in Publishing Dir
500
501 - task: EsrpRelease@9
502 condition: succeeded()
503 displayName: Publish NPM Package
504 inputs:
505 connectedservicename: "PME ESRP Azure Connection"
506 usemanagedidentity: true
507 keyvaultname: "quantum-esrp-kv"
508 signcertname: ESRPCert
509 clientid: "832c049d-cd07-4c1c-bfa5-c07250d190cb"
510 contenttype: "NPM"
511 domaintenantid: "975f013f-7f24-47e8-a7d3-abc4752bf346"
512 folderlocation: "$(System.DefaultWorkingDirectory)/target/npm/qsharp"
513 waitforreleasecompletion: true
514 owners: "billti@microsoft.com"
515 approvers: "billti@microsoft.com"
516 mainpublisher: ESRPRELPACMAN
517