From 4141021643420a9dbdd001ebaead07f2101caf79 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Mon, 12 Jan 2026 14:07:00 -0800 Subject: [PATCH 1/2] update format --- .ado/publish.yml | 420 +++++++++++++++++++++++------------------------ 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index cc2e6e8a..aaa2b9c9 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -2,226 +2,226 @@ trigger: none pr: none parameters: -- name: Release_Type - displayName: Release Type (major.minor.patch) - type: string - values: - - major - - minor - - patch - default: 'patch' - -- name: Build_Type - displayName: Build Type (major.minor.patch[.rc|.dev]) - type: string - values: - - dev - - rc - - stable - default: 'dev' - -- name: Publish_Python_Package_To_Build_Artifacts - displayName: Publish Python package to Build's Artifacts - type: boolean - default: True - -- name: Create_GitHub_Release - displayName: Create GitHub-Release - type: boolean - default: False - -- name: Publish_Python_Package_To_PyPi - displayName: Publish Python package to PyPi - type: boolean - default: False + - name: Release_Type + displayName: Release Type (major.minor.patch) + type: string + values: + - major + - minor + - patch + default: "patch" + + - name: Build_Type + displayName: Build Type (major.minor.patch[.rc|.dev]) + type: string + values: + - dev + - rc + - stable + default: "dev" + + - name: Publish_Python_Package_To_Build_Artifacts + displayName: Publish Python package to Build's Artifacts + type: boolean + default: True + + - name: Create_GitHub_Release + displayName: Create GitHub-Release + type: boolean + default: False + + - name: Publish_Python_Package_To_PyPi + displayName: Publish Python package to PyPi + type: boolean + default: False variables: -- name: OwnerPersonalAlias - value: 'xiou' -- name: QSHARP_PYTHON_TELEMETRY - value: none # Disable usage telemetry for internal test pipelines -- name: PYTEST_MAX_PARALLEL_TESTS - value: 'auto' + - name: OwnerPersonalAlias + value: "xiou" + - name: QSHARP_PYTHON_TELEMETRY + value: none # Disable usage telemetry for internal test pipelines + - name: PYTEST_MAX_PARALLEL_TESTS + value: "auto" resources: repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: pool: - name: 'Azure-Pipelines-DevTools-EO' + name: "Azure-Pipelines-DevTools-EO" image: windows-latest os: windows stages: - - stage: PublishToPyPi - displayName: "\U0001F6EB Build and Publish to PyPi" - jobs: - - job: "Build_Azure_Quantum_Python" - displayName: Build "azure-quantum" package - templateContext: - outputs: - - output: pipelineArtifact - displayName: 'Upload "azure-quantum" artifacts' - targetPath: $(Build.SourcesDirectory)/azure-quantum/artifacts/ - artifactName: azure-quantum-wheels - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11' - displayName: Set Python version - - - script: | - pip install wheel - displayName: Install wheel - - - script: | - pip freeze - displayName: List installed packages - - - script: | - python set_version.py - env: - BUILD_TYPE: ${{ parameters.Build_Type }} - RELEASE_TYPE: ${{ parameters.Release_Type }} - displayName: Set "azure-quantum" package version - - - script: | - cd $(Build.SourcesDirectory)/azure-quantum - python setup.py sdist --dist-dir=artifacts/wheels - python setup.py bdist_wheel --dist-dir=artifacts/wheels - displayName: Build "azure-quantum" package - - - script: | - copy set_version.py "$(Build.SourcesDirectory)/azure-quantum/artifacts" - displayName: Copy "set_version.py" to artifacts - - - job: "Test_Azure_Quantum_Python" - displayName: Test "azure-quantum" package - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11' - displayName: Set Python version - - - script: | - python -m pip install --upgrade pip - pip install pytest pytest-azurepipelines pytest-cov pytest-xdist tox - displayName: Install test dependencies - - - script: | - pip freeze - displayName: List installed packages - - - script: | - cd $(Build.SourcesDirectory)/azure-quantum - pip install ".[cirq,qsharp,dev]" - pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml --ignore tests/unit/test_qiskit.py --ignore tests/unit/test_session_qiskit.py $(Build.SourcesDirectory)/azure-quantum - displayName: Run Unit-tests - - - script: | - cd $(Build.SourcesDirectory)/azure-quantum - tox -e py311-qiskit1,py311-qiskit2 - displayName: Run Qiskit matrix tests - - - task: PublishTestResults@2 - displayName: 'Publish test results (python)' - condition: succeededOrFailed() - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: '**/test-*.xml' - testRunTitle: 'Azure Quantum Python Tests' - - - job: "Approval" - displayName: Release approval - dependsOn: - - "Build_Azure_Quantum_Python" - - "Test_Azure_Quantum_Python" - pool: server - timeoutInMinutes: 1440 # job times out in 1 day - steps: - - task: ManualValidation@0 - displayName: Manual release approval - timeoutInMinutes: 1440 - inputs: - notifyUsers: '' - instructions: 'Please verify artifacts and approve the release' - onTimeout: 'reject' - - - job: "Publish_Python_Packages" - displayName: Publish "azure-quantum" package - dependsOn: Approval - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - displayName: 'Download azure-quantum artifacts' - targetPath: $(Pipeline.Workspace)/azure-quantum-wheels - artifactName: azure-quantum-wheels - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11' - displayName: Set Python version - - - script: | - python $(Pipeline.Workspace)/azure-quantum-wheels/set_version.py - env: - BUILD_TYPE: ${{ parameters.Build_Type }} - RELEASE_TYPE: ${{ parameters.Release_Type }} - displayName: Set "azure-quantum" package version - - - task: CopyFiles@2 - condition: | - or( - ${{ parameters.Publish_Python_Package_To_Build_Artifacts }}, - ${{ parameters.Publish_Python_Package_To_PyPi }} - ) - displayName: Copy built "azure-quantum" package artifacts - inputs: - SourceFolder: '$(Pipeline.Workspace)/azure-quantum-wheels/wheels' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/wheels' - - - script: | - ls $(Build.ArtifactStagingDirectory)/artifacts/wheels/* - displayName: List Py Artifacts to publish - - - task: GitHubRelease@1 - condition: ${{ parameters.Create_GitHub_Release }} - displayName: Create GitHub Release - inputs: - gitHubConnection: AzureQuantumOauth - repositoryName: Microsoft/azure-quantum-python - action: create - tagSource: 'userSpecifiedTag' - tag: azure-quantum_v$(PYTHON_VERSION) - isDraft: True - isPreRelease: ${{ ne(parameters.Build_Type, 'stable') }} - target: $(Build.SourceVersion) - addChangeLog: False - assets: | - $(Build.ArtifactStagingDirectory)/artifacts/wheels/* - - - task: EsrpRelease@9 - condition: ${{ parameters.Publish_Python_Package_To_PyPi }} - displayName: Sign and publish "azure-quantum" package to PyPi - inputs: - connectedservicename: 'PME ESRP Azure Connection' - usemanagedidentity: true - keyvaultname: 'quantum-esrp-kv' - signcertname: ESRPCert - clientid: '832c049d-cd07-4c1c-bfa5-c07250d190cb' - contenttype: PyPi - domaintenantid: '975f013f-7f24-47e8-a7d3-abc4752bf346' - folderlocation: '$(Build.ArtifactStagingDirectory)/artifacts/wheels' - waitforreleasecompletion: true - owners: '$(OwnerPersonalAlias)@microsoft.com' - approvers: '$(OwnerPersonalAlias)@microsoft.com' - mainpublisher: ESRPRELPACMAN + - stage: PublishToPyPi + displayName: "\U0001F6EB Build and Publish to PyPi" + jobs: + - job: "Build_Azure_Quantum_Python" + displayName: Build "azure-quantum" package + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Upload "azure-quantum" artifacts' + targetPath: $(Build.SourcesDirectory)/azure-quantum/artifacts/ + artifactName: azure-quantum-wheels + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + displayName: Set Python version + + - script: | + pip install wheel + displayName: Install wheel + + - script: | + pip freeze + displayName: List installed packages + + - script: | + python set_version.py + env: + BUILD_TYPE: ${{ parameters.Build_Type }} + RELEASE_TYPE: ${{ parameters.Release_Type }} + displayName: Set "azure-quantum" package version + + - script: | + cd $(Build.SourcesDirectory)/azure-quantum + python setup.py sdist --dist-dir=artifacts/wheels + python setup.py bdist_wheel --dist-dir=artifacts/wheels + displayName: Build "azure-quantum" package + + - script: | + copy set_version.py "$(Build.SourcesDirectory)/azure-quantum/artifacts" + displayName: Copy "set_version.py" to artifacts + + - job: "Test_Azure_Quantum_Python" + displayName: Test "azure-quantum" package + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + displayName: Set Python version + + - script: | + python -m pip install --upgrade pip + pip install pytest pytest-azurepipelines pytest-cov pytest-xdist tox + displayName: Install test dependencies + + - script: | + pip freeze + displayName: List installed packages + + - script: | + cd $(Build.SourcesDirectory)/azure-quantum + pip install ".[cirq,qsharp,dev]" + pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml --ignore tests/unit/test_qiskit.py --ignore tests/unit/test_session_qiskit.py $(Build.SourcesDirectory)/azure-quantum + displayName: Run Unit-tests + + - script: | + cd $(Build.SourcesDirectory)/azure-quantum + tox -e py311-qiskit1,py311-qiskit2 + displayName: Run Qiskit matrix tests + + - task: PublishTestResults@2 + displayName: "Publish test results (python)" + condition: succeededOrFailed() + inputs: + testResultsFormat: "JUnit" + testResultsFiles: "**/test-*.xml" + testRunTitle: "Azure Quantum Python Tests" + + - job: "Approval" + displayName: Release approval + dependsOn: + - "Build_Azure_Quantum_Python" + - "Test_Azure_Quantum_Python" + pool: server + timeoutInMinutes: 1440 # job times out in 1 day + steps: + - task: ManualValidation@0 + displayName: Manual release approval + timeoutInMinutes: 1440 + inputs: + notifyUsers: "" + instructions: "Please verify artifacts and approve the release" + onTimeout: "reject" + + - job: "Publish_Python_Packages" + displayName: Publish "azure-quantum" package + dependsOn: Approval + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + displayName: "Download azure-quantum artifacts" + targetPath: $(Pipeline.Workspace)/azure-quantum-wheels + artifactName: azure-quantum-wheels + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + displayName: Set Python version + + - script: | + python $(Pipeline.Workspace)/azure-quantum-wheels/set_version.py + env: + BUILD_TYPE: ${{ parameters.Build_Type }} + RELEASE_TYPE: ${{ parameters.Release_Type }} + displayName: Set "azure-quantum" package version + + - task: CopyFiles@2 + condition: | + or( + ${{ parameters.Publish_Python_Package_To_Build_Artifacts }}, + ${{ parameters.Publish_Python_Package_To_PyPi }} + ) + displayName: Copy built "azure-quantum" package artifacts + inputs: + SourceFolder: "$(Pipeline.Workspace)/azure-quantum-wheels/wheels" + Contents: "**" + TargetFolder: "$(Build.ArtifactStagingDirectory)/artifacts/wheels" + + - script: | + ls $(Build.ArtifactStagingDirectory)/artifacts/wheels/* + displayName: List Py Artifacts to publish + + - task: GitHubRelease@1 + condition: ${{ parameters.Create_GitHub_Release }} + displayName: Create GitHub Release + inputs: + gitHubConnection: AzureQuantumOauth + repositoryName: Microsoft/azure-quantum-python + action: create + tagSource: "userSpecifiedTag" + tag: azure-quantum_v$(PYTHON_VERSION) + isDraft: True + isPreRelease: ${{ ne(parameters.Build_Type, 'stable') }} + target: $(Build.SourceVersion) + addChangeLog: False + assets: | + $(Build.ArtifactStagingDirectory)/artifacts/wheels/* + + - task: EsrpRelease@9 + condition: ${{ parameters.Publish_Python_Package_To_PyPi }} + displayName: Sign and publish "azure-quantum" package to PyPi + inputs: + connectedservicename: "PME ESRP Azure Connection" + usemanagedidentity: true + keyvaultname: "quantum-esrp-kv" + signcertname: ESRPCert + clientid: "832c049d-cd07-4c1c-bfa5-c07250d190cb" + contenttype: PyPi + domaintenantid: "975f013f-7f24-47e8-a7d3-abc4752bf346" + folderlocation: "$(Build.ArtifactStagingDirectory)/artifacts/wheels" + waitforreleasecompletion: true + owners: "$(OwnerPersonalAlias)@microsoft.com" + approvers: "$(OwnerPersonalAlias)@microsoft.com" + mainpublisher: ESRPRELPACMAN From 39bada627233fb1c17fe7dd044487825131ba99d Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Mon, 12 Jan 2026 14:07:21 -0800 Subject: [PATCH 2/2] make separate step for local tests --- .ado/publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index aaa2b9c9..5faff6e4 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -121,8 +121,14 @@ extends: - script: | cd $(Build.SourcesDirectory)/azure-quantum pip install ".[cirq,qsharp,dev]" - pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml --ignore tests/unit/test_qiskit.py --ignore tests/unit/test_session_qiskit.py $(Build.SourcesDirectory)/azure-quantum - displayName: Run Unit-tests + pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov-report term --cov=azure.quantum --junitxml test-output-azure-quantum.xml --ignore tests/unit/test_qiskit.py --ignore tests/unit/test_session_qiskit.py $(Build.SourcesDirectory)/azure-quantum --ignore tests/unit/local + displayName: Run azure-quantum unit tests + + - script: | + cd $(Build.SourcesDirectory)/azure-quantum + # Run local-only tests explicitly to include nested path under unit/local + pytest --numprocesses $(PYTEST_MAX_PARALLEL_TESTS) --cov=azure.quantum --cov-append --junitxml test-output-azure-quantum-local.xml tests/unit/local + displayName: Run azure-quantum local unit tests - script: | cd $(Build.SourcesDirectory)/azure-quantum