From 7299cad9e43eea9b771ff6fe234379a075ea447f Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 4 Feb 2026 18:22:55 -0500 Subject: [PATCH 01/17] Try fix double nuget package --- .../github/azure-pipelines/nuget/templates/dml-vs-2022.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml index 02613871d61ff..98a43ad735e4c 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml @@ -49,8 +49,8 @@ stages: clean: true submodules: none - - - template: ../../templates/setup-build-tools.yml + + - template: ../../templates/setup-build-tools.yml parameters: host_cpu_arch: 'x64' @@ -70,7 +70,7 @@ stages: - ${{ if notIn(parameters['sln_platform'], 'Win32', 'x64') }}: - powershell: | - python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --build_csharp --build --update --config $(BuildConfig) --build_nuget --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }} + python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --build_csharp --build --update --config $(BuildConfig) --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }} - ${{ else }}: - powershell: | From a965c0bf283b91141f7df6f21c1a0ded8f5baed0 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:29:31 -0500 Subject: [PATCH 02/17] Try add ARM packages --- .../stages/py-cpu-packaging-stage.yml | 132 ++---------------- 1 file changed, 8 insertions(+), 124 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml index 6eb7c52712671..e0ec30fea52e1 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml @@ -66,131 +66,15 @@ stages: - stage: Python_Packaging_Windows_CPU dependsOn: [] jobs: - - job: Windows_py_Wheels - pool: - name: 'onnxruntime-Win-CPU-VS2022-Latest' - os: windows - templateContext: - sdl: - codeSignValidation: - enabled: true - # TODO: check why pyd file was not signed - break: false - additionalTargetsGlobPattern: f|**\*.pyd - psscriptanalyzer: - enabled: true - binskim: - enabled: true - scanOutputDirectoryOnly: true - outputs: - - output: pipelineArtifact - targetPath: $(Build.ArtifactStagingDirectory) - artifactName: onnxruntime-win-$(PythonVersion) - strategy: - matrix: - Python311_x64: - PythonVersion: '3.11' - Python312_x64: - PythonVersion: '3.12' - Python313_x64: - PythonVersion: '3.13' - Python314_x64: - PythonVersion: '3.14' - variables: - OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' - ExtraParam: ${{ parameters.build_py_parameters }} - timeoutInMinutes: 180 - workspace: - clean: all - - steps: - - checkout: self - clean: true - submodules: recursive - - - template: ../templates/setup-build-tools.yml - parameters: - host_cpu_arch: 'x64' - python_version: $(PythonVersion) - - - template: ../templates/set-nightly-build-option-variable-step.yml - - - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt - env: - TMPDIR: "$(Agent.TempDirectory)" - - - task: PythonScript@0 - displayName: 'Build' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: > - --config ${{ parameters.cmake_build_type }} - --enable_lto - --build_dir $(Build.SourcesDirectory)\build - --skip_submodule_sync - --cmake_generator "Visual Studio 17 2022" - --enable_pybind - --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache - ${{ parameters.build_py_parameters }} - --parallel --use_binskim_compliant_compile_flags --update --build - $(TelemetryOption) - - - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - - template: ../templates/publish-symbolrequestprod-api.yml - parameters: - ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: - symbolExpiryTime: 60 - includePublicSymbolServer: true - symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) - symbolsVersion: $(Build.BuildId) - symbolProject: 'ONNX Runtime' - subscription: 'OnnxrunTimeCodeSign_20240611' - searchPattern: | - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb - - # Esrp signing - - template: ../templates/win-esrp-dll.yml - parameters: - FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' - DisplayName: 'ESRP - Sign Native dlls' - DoEsrp: true - Pattern: '*.pyd,*.dll' - - - task: PythonScript@0 - displayName: 'Build wheel' - inputs: - scriptPath: '$(Build.SourcesDirectory)\setup.py' - arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' - workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - - - task: CopyFiles@2 - displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' - inputs: - SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' - Contents: '*.whl' - TargetFolder: '$(Build.ArtifactStagingDirectory)' - - - script: | - 7z x *.whl - workingDirectory: '$(Build.ArtifactStagingDirectory)' - displayName: 'unzip the package' - + - template: ../templates/py-win-cpu.yml + parameters: + ARCHITECTURE: 'x64' + build_py_parameters: ${{ parameters.build_py_parameters }} - - powershell: | - if ("$(PythonVersion)" -notcontains "3.14") { - python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq - Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} - Remove-Item -Recurse -Force onnxruntime - if ("$(ExtraParam)" -contains "--use_azure") { - $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" - python onnxruntime_test_python_azure.py - } - python onnx_backend_test_series.py - } - workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - displayName: 'Run Python Tests' + - template: ../templates/py-win-cpu.yml + parameters: + ARCHITECTURE: 'arm64' + build_py_parameters: ${{ parameters.build_py_parameters }} - ${{ if eq(parameters.enable_mac_cpu, true) }}: - stage: Python_Packaging_MacOS From af43c784d3da4efcd8f2262768d182d4122127d1 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:29:45 -0500 Subject: [PATCH 03/17] . --- .../azure-pipelines/templates/py-win-cpu.yml | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml new file mode 100644 index 0000000000000..8723f15ca9eef --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -0,0 +1,168 @@ +parameters: +- name: MACHINE_POOL + type: string + default: 'onnxruntime-qnn-windows-vs-2022-arm64' + +- name: ARCHITECTURE + type: string + default: 'x64' + values: + - x64 + - arm64 + +- name: build_py_parameters + displayName: 'Specify extra build parameters' + type: string + default: '--use_azure' + +jobs: +- job: Windows_py_Wheels_${{parameters.ARCHITECTURE}} + ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + pool: + name: 'onnxruntime-qnn-windows-vs-2022-arm64' + os: windows + hostArchitecture: Arm64 + demands: + - Agent.Version -equals 4.264.2 + ${{ else }}: + pool: + name: 'onnxruntime-Win-CPU-VS2022-Latest' + os: windows + templateContext: + sdl: + codeSignValidation: + enabled: true + # TODO: check why pyd file was not signed + break: false + additionalTargetsGlobPattern: f|**\*.pyd + psscriptanalyzer: + enabled: true + binskim: + enabled: true + scanOutputDirectoryOnly: true + outputs: + ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: onnxruntime-win-$(PythonVersion)-arm64 + ${{ else }}: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: onnxruntime-win-$(PythonVersion) + strategy: + matrix: + Python311_${{parameters.ARCHITECTURE}}: + PythonVersion: '3.11' + Python312_${{parameters.ARCHITECTURE}}: + PythonVersion: '3.12' + Python313_${{parameters.ARCHITECTURE}}: + PythonVersion: '3.13' + Python314_${{parameters.ARCHITECTURE}}: + PythonVersion: '3.14' + variables: + OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' + ExtraParam: ${{ parameters.build_py_parameters }} + timeoutInMinutes: 180 + workspace: + clean: all + + steps: + - checkout: self + clean: true + submodules: recursive + + - template: ../templates/setup-build-tools.yml + parameters: + host_cpu_arch: ${{parameters.ARCHITECTURE}} + python_version: $(PythonVersion) + + - template: ../templates/set-nightly-build-option-variable-step.yml + + - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt + env: + TMPDIR: "$(Agent.TempDirectory)" + + - task: PythonScript@0 + displayName: 'Build' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: > + --config ${{ parameters.cmake_build_type }} + --enable_lto + --build_dir $(Build.SourcesDirectory)\build + --skip_submodule_sync + --cmake_generator "Visual Studio 17 2022" + --enable_pybind + --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache + ${{ parameters.build_py_parameters }} + --parallel --use_binskim_compliant_compile_flags --update + $(TelemetryOption) + + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + platform: '${{parameters.ARCHITECTURE}}' + configuration: RelWithDebInfo + msbuildArchitecture: '${{parameters.ARCHITECTURE}}' + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true + + - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: + - template: ../templates/publish-symbolrequestprod-api.yml + parameters: + ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: + symbolExpiryTime: 60 + includePublicSymbolServer: true + symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) + symbolsVersion: $(Build.BuildId) + symbolProject: 'ONNX Runtime' + subscription: 'OnnxrunTimeCodeSign_20240611' + searchPattern: | + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb + + # Esrp signing + - template: ../templates/win-esrp-dll.yml + parameters: + FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' + DisplayName: 'ESRP - Sign Native dlls' + DoEsrp: true + Pattern: '*.pyd,*.dll' + + - task: PythonScript@0 + displayName: 'Build wheel' + inputs: + scriptPath: '$(Build.SourcesDirectory)\setup.py' + arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' + workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + + - task: CopyFiles@2 + displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' + inputs: + SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' + Contents: '*.whl' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + - script: | + 7z x *.whl + workingDirectory: '$(Build.ArtifactStagingDirectory)' + displayName: 'unzip the package' + + + - powershell: | + if ("$(PythonVersion)" -notcontains "3.14") { + python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq + Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} + Remove-Item -Recurse -Force onnxruntime + if ("$(ExtraParam)" -contains "--use_azure") { + $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" + python onnxruntime_test_python_azure.py + } + python onnx_backend_test_series.py + } + workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + displayName: 'Run Python Tests' From b44533614de50e11a0719fdde3b7f7189887e50e Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:34:25 -0500 Subject: [PATCH 04/17] . --- .../github/azure-pipelines/templates/py-win-cpu.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 8723f15ca9eef..3a46ed38bbb5a 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -71,12 +71,12 @@ jobs: clean: true submodules: recursive - - template: ../templates/setup-build-tools.yml + - template: setup-build-tools.yml parameters: host_cpu_arch: ${{parameters.ARCHITECTURE}} python_version: $(PythonVersion) - - template: ../templates/set-nightly-build-option-variable-step.yml + - template: set-nightly-build-option-variable-step.yml - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt env: @@ -111,7 +111,7 @@ jobs: createLogFile: true - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - - template: ../templates/publish-symbolrequestprod-api.yml + - template: publish-symbolrequestprod-api.yml parameters: ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: symbolExpiryTime: 60 @@ -126,7 +126,7 @@ jobs: $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb # Esrp signing - - template: ../templates/win-esrp-dll.yml + - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' DisplayName: 'ESRP - Sign Native dlls' From f63cf577584b985d599dc1be40ec94f75a0c7151 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:34:55 -0500 Subject: [PATCH 05/17] . --- .../azure-pipelines/templates/py-win-cpu.yml | 190 +++++++++--------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 3a46ed38bbb5a..6d6d5c184afe0 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -71,98 +71,98 @@ jobs: clean: true submodules: recursive - - template: setup-build-tools.yml - parameters: - host_cpu_arch: ${{parameters.ARCHITECTURE}} - python_version: $(PythonVersion) - - - template: set-nightly-build-option-variable-step.yml - - - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt - env: - TMPDIR: "$(Agent.TempDirectory)" - - - task: PythonScript@0 - displayName: 'Build' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: > - --config ${{ parameters.cmake_build_type }} - --enable_lto - --build_dir $(Build.SourcesDirectory)\build - --skip_submodule_sync - --cmake_generator "Visual Studio 17 2022" - --enable_pybind - --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache - ${{ parameters.build_py_parameters }} - --parallel --use_binskim_compliant_compile_flags --update - $(TelemetryOption) - - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' - platform: '${{parameters.ARCHITECTURE}}' - configuration: RelWithDebInfo - msbuildArchitecture: '${{parameters.ARCHITECTURE}}' - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - createLogFile: true - - - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - - template: publish-symbolrequestprod-api.yml - parameters: - ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: - symbolExpiryTime: 60 - includePublicSymbolServer: true - symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) - symbolsVersion: $(Build.BuildId) - symbolProject: 'ONNX Runtime' - subscription: 'OnnxrunTimeCodeSign_20240611' - searchPattern: | - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb - $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb - - # Esrp signing - - template: win-esrp-dll.yml - parameters: - FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' - DisplayName: 'ESRP - Sign Native dlls' - DoEsrp: true - Pattern: '*.pyd,*.dll' - - - task: PythonScript@0 - displayName: 'Build wheel' - inputs: - scriptPath: '$(Build.SourcesDirectory)\setup.py' - arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' - workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - - - task: CopyFiles@2 - displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' - inputs: - SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' - Contents: '*.whl' - TargetFolder: '$(Build.ArtifactStagingDirectory)' - - - script: | - 7z x *.whl - workingDirectory: '$(Build.ArtifactStagingDirectory)' - displayName: 'unzip the package' - - - - powershell: | - if ("$(PythonVersion)" -notcontains "3.14") { - python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq - Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} - Remove-Item -Recurse -Force onnxruntime - if ("$(ExtraParam)" -contains "--use_azure") { - $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" - python onnxruntime_test_python_azure.py - } - python onnx_backend_test_series.py - } - workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - displayName: 'Run Python Tests' + # - template: setup-build-tools.yml + # parameters: + # host_cpu_arch: ${{parameters.ARCHITECTURE}} + # python_version: $(PythonVersion) + + # - template: set-nightly-build-option-variable-step.yml + + # - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt + # env: + # TMPDIR: "$(Agent.TempDirectory)" + + # - task: PythonScript@0 + # displayName: 'Build' + # inputs: + # scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + # arguments: > + # --config ${{ parameters.cmake_build_type }} + # --enable_lto + # --build_dir $(Build.SourcesDirectory)\build + # --skip_submodule_sync + # --cmake_generator "Visual Studio 17 2022" + # --enable_pybind + # --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache + # ${{ parameters.build_py_parameters }} + # --parallel --use_binskim_compliant_compile_flags --update + # $(TelemetryOption) + + # - task: VSBuild@1 + # displayName: 'Build' + # inputs: + # solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + # platform: '${{parameters.ARCHITECTURE}}' + # configuration: RelWithDebInfo + # msbuildArchitecture: '${{parameters.ARCHITECTURE}}' + # maximumCpuCount: true + # logProjectEvents: true + # workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + # createLogFile: true + + # - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: + # - template: publish-symbolrequestprod-api.yml + # parameters: + # ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: + # symbolExpiryTime: 60 + # includePublicSymbolServer: true + # symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) + # symbolsVersion: $(Build.BuildId) + # symbolProject: 'ONNX Runtime' + # subscription: 'OnnxrunTimeCodeSign_20240611' + # searchPattern: | + # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb + # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb + # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb + + # # Esrp signing + # - template: win-esrp-dll.yml + # parameters: + # FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' + # DisplayName: 'ESRP - Sign Native dlls' + # DoEsrp: true + # Pattern: '*.pyd,*.dll' + + # - task: PythonScript@0 + # displayName: 'Build wheel' + # inputs: + # scriptPath: '$(Build.SourcesDirectory)\setup.py' + # arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' + # workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + + # - task: CopyFiles@2 + # displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' + # inputs: + # SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' + # Contents: '*.whl' + # TargetFolder: '$(Build.ArtifactStagingDirectory)' + + # - script: | + # 7z x *.whl + # workingDirectory: '$(Build.ArtifactStagingDirectory)' + # displayName: 'unzip the package' + + + # - powershell: | + # if ("$(PythonVersion)" -notcontains "3.14") { + # python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq + # Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} + # Remove-Item -Recurse -Force onnxruntime + # if ("$(ExtraParam)" -contains "--use_azure") { + # $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" + # python onnxruntime_test_python_azure.py + # } + # python onnx_backend_test_series.py + # } + # workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + # displayName: 'Run Python Tests' From 472a73e817b69874c2acb864deecf45ebb7b6b17 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:36:47 -0500 Subject: [PATCH 06/17] . --- .../azure-pipelines/templates/py-win-cpu.yml | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 6d6d5c184afe0..e8b4a79e6284a 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -1,8 +1,4 @@ parameters: -- name: MACHINE_POOL - type: string - default: 'onnxruntime-qnn-windows-vs-2022-arm64' - - name: ARCHITECTURE type: string default: 'x64' @@ -17,17 +13,17 @@ parameters: jobs: - job: Windows_py_Wheels_${{parameters.ARCHITECTURE}} - ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: - pool: - name: 'onnxruntime-qnn-windows-vs-2022-arm64' - os: windows - hostArchitecture: Arm64 - demands: - - Agent.Version -equals 4.264.2 - ${{ else }}: - pool: - name: 'onnxruntime-Win-CPU-VS2022-Latest' - os: windows + # ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + # pool: + # name: 'onnxruntime-qnn-windows-vs-2022-arm64' + # os: windows + # hostArchitecture: Arm64 + # demands: + # - Agent.Version -equals 4.264.2 + # ${{ else }}: + pool: + name: 'onnxruntime-Win-CPU-VS2022-Latest' + os: windows templateContext: sdl: codeSignValidation: @@ -41,14 +37,14 @@ jobs: enabled: true scanOutputDirectoryOnly: true outputs: - ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + # ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: - output: pipelineArtifact targetPath: $(Build.ArtifactStagingDirectory) artifactName: onnxruntime-win-$(PythonVersion)-arm64 - ${{ else }}: - - output: pipelineArtifact - targetPath: $(Build.ArtifactStagingDirectory) - artifactName: onnxruntime-win-$(PythonVersion) + # ${{ else }}: + # - output: pipelineArtifact + # targetPath: $(Build.ArtifactStagingDirectory) + # artifactName: onnxruntime-win-$(PythonVersion) strategy: matrix: Python311_${{parameters.ARCHITECTURE}}: From fe366a12f7946ea6ae75eebbcca9dda96b5e7fdb Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 16:37:18 -0500 Subject: [PATCH 07/17] . --- .../azure-pipelines/templates/py-win-cpu.yml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index e8b4a79e6284a..23733389b4660 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -13,17 +13,17 @@ parameters: jobs: - job: Windows_py_Wheels_${{parameters.ARCHITECTURE}} - # ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: - # pool: - # name: 'onnxruntime-qnn-windows-vs-2022-arm64' - # os: windows - # hostArchitecture: Arm64 - # demands: - # - Agent.Version -equals 4.264.2 - # ${{ else }}: - pool: - name: 'onnxruntime-Win-CPU-VS2022-Latest' - os: windows + ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + pool: + name: 'onnxruntime-qnn-windows-vs-2022-arm64' + os: windows + hostArchitecture: Arm64 + demands: + - Agent.Version -equals 4.264.2 + ${{ else }}: + pool: + name: 'onnxruntime-Win-CPU-VS2022-Latest' + os: windows templateContext: sdl: codeSignValidation: From a7789a904eef49be2a468c71e00ff337dce645cd Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 17:51:08 -0500 Subject: [PATCH 08/17] Forgotten file --- .../azure-pipelines/templates/py-win-cpu.yml | 187 +++++++++--------- 1 file changed, 94 insertions(+), 93 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 23733389b4660..850bd358ca400 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -36,15 +36,16 @@ jobs: binskim: enabled: true scanOutputDirectoryOnly: true - outputs: - # ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: - - output: pipelineArtifact - targetPath: $(Build.ArtifactStagingDirectory) - artifactName: onnxruntime-win-$(PythonVersion)-arm64 - # ${{ else }}: - # - output: pipelineArtifact - # targetPath: $(Build.ArtifactStagingDirectory) - # artifactName: onnxruntime-win-$(PythonVersion) + ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + outputs: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: onnxruntime-win-$(PythonVersion)-arm64 + ${{ else }}: + outputs: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: onnxruntime-win-$(PythonVersion) strategy: matrix: Python311_${{parameters.ARCHITECTURE}}: @@ -67,98 +68,98 @@ jobs: clean: true submodules: recursive - # - template: setup-build-tools.yml - # parameters: - # host_cpu_arch: ${{parameters.ARCHITECTURE}} - # python_version: $(PythonVersion) + - template: setup-build-tools.yml + parameters: + host_cpu_arch: ${{parameters.ARCHITECTURE}} + python_version: $(PythonVersion) - # - template: set-nightly-build-option-variable-step.yml + - template: set-nightly-build-option-variable-step.yml - # - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt - # env: - # TMPDIR: "$(Agent.TempDirectory)" + - script: python -m pip install -r $(Build.SourcesDirectory)\tools\ci_build\github\windows\python\requirements.txt + env: + TMPDIR: "$(Agent.TempDirectory)" - # - task: PythonScript@0 - # displayName: 'Build' - # inputs: - # scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - # arguments: > - # --config ${{ parameters.cmake_build_type }} - # --enable_lto - # --build_dir $(Build.SourcesDirectory)\build - # --skip_submodule_sync - # --cmake_generator "Visual Studio 17 2022" - # --enable_pybind - # --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache - # ${{ parameters.build_py_parameters }} - # --parallel --use_binskim_compliant_compile_flags --update - # $(TelemetryOption) + - task: PythonScript@0 + displayName: 'Build' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: > + --config ${{ parameters.cmake_build_type }} + --enable_lto + --build_dir $(Build.SourcesDirectory)\build + --skip_submodule_sync + --cmake_generator "Visual Studio 17 2022" + --enable_pybind + --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache + ${{ parameters.build_py_parameters }} + --parallel --use_binskim_compliant_compile_flags --update + $(TelemetryOption) - # - task: VSBuild@1 - # displayName: 'Build' - # inputs: - # solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' - # platform: '${{parameters.ARCHITECTURE}}' - # configuration: RelWithDebInfo - # msbuildArchitecture: '${{parameters.ARCHITECTURE}}' - # maximumCpuCount: true - # logProjectEvents: true - # workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - # createLogFile: true + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + platform: '${{parameters.ARCHITECTURE}}' + configuration: RelWithDebInfo + msbuildArchitecture: '${{parameters.ARCHITECTURE}}' + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true - # - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - # - template: publish-symbolrequestprod-api.yml - # parameters: - # ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: - # symbolExpiryTime: 60 - # includePublicSymbolServer: true - # symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) - # symbolsVersion: $(Build.BuildId) - # symbolProject: 'ONNX Runtime' - # subscription: 'OnnxrunTimeCodeSign_20240611' - # searchPattern: | - # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb - # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb - # $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb + - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: + - template: publish-symbolrequestprod-api.yml + parameters: + ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: + symbolExpiryTime: 60 + includePublicSymbolServer: true + symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) + symbolsVersion: $(Build.BuildId) + symbolProject: 'ONNX Runtime' + subscription: 'OnnxrunTimeCodeSign_20240611' + searchPattern: | + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime.pdb + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_providers_shared.pdb + $(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime_pybind11_state.pdb - # # Esrp signing - # - template: win-esrp-dll.yml - # parameters: - # FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' - # DisplayName: 'ESRP - Sign Native dlls' - # DoEsrp: true - # Pattern: '*.pyd,*.dll' + # Esrp signing + - template: win-esrp-dll.yml + parameters: + FolderPath: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\onnxruntime\capi' + DisplayName: 'ESRP - Sign Native dlls' + DoEsrp: true + Pattern: '*.pyd,*.dll' - # - task: PythonScript@0 - # displayName: 'Build wheel' - # inputs: - # scriptPath: '$(Build.SourcesDirectory)\setup.py' - # arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' - # workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + - task: PythonScript@0 + displayName: 'Build wheel' + inputs: + scriptPath: '$(Build.SourcesDirectory)\setup.py' + arguments: 'bdist_wheel ${{ parameters.build_py_parameters }} $(NightlyBuildOption)' + workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - # - task: CopyFiles@2 - # displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' - # inputs: - # SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' - # Contents: '*.whl' - # TargetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)' + inputs: + SourceFolder: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}\dist' + Contents: '*.whl' + TargetFolder: '$(Build.ArtifactStagingDirectory)' - # - script: | - # 7z x *.whl - # workingDirectory: '$(Build.ArtifactStagingDirectory)' - # displayName: 'unzip the package' + - script: | + 7z x *.whl + workingDirectory: '$(Build.ArtifactStagingDirectory)' + displayName: 'unzip the package' - # - powershell: | - # if ("$(PythonVersion)" -notcontains "3.14") { - # python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq - # Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} - # Remove-Item -Recurse -Force onnxruntime - # if ("$(ExtraParam)" -contains "--use_azure") { - # $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" - # python onnxruntime_test_python_azure.py - # } - # python onnx_backend_test_series.py - # } - # workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - # displayName: 'Run Python Tests' + - powershell: | + if ("$(PythonVersion)" -notcontains "3.14") { + python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq + Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} + Remove-Item -Recurse -Force onnxruntime + if ("$(ExtraParam)" -contains "--use_azure") { + $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" + python onnxruntime_test_python_azure.py + } + python onnx_backend_test_series.py + } + workingDirectory: '$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' + displayName: 'Run Python Tests' From ef3e31d6ee9ae2153b7e58b0663e53a65ffa58e3 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 17:51:53 -0500 Subject: [PATCH 09/17] Fix --- .../github/azure-pipelines/stages/py-cpu-packaging-stage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml index e0ec30fea52e1..d27626994dbba 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml @@ -70,11 +70,13 @@ stages: parameters: ARCHITECTURE: 'x64' build_py_parameters: ${{ parameters.build_py_parameters }} + cmake_build_type: ${{ parameters.cmake_build_type }} - template: ../templates/py-win-cpu.yml parameters: ARCHITECTURE: 'arm64' build_py_parameters: ${{ parameters.build_py_parameters }} + cmake_build_type: ${{ parameters.cmake_build_type }} - ${{ if eq(parameters.enable_mac_cpu, true) }}: - stage: Python_Packaging_MacOS From 08d87dd5b448aa42e6410291bc8ec86954bff8e8 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 6 Feb 2026 17:52:24 -0500 Subject: [PATCH 10/17] Update --- .../github/azure-pipelines/templates/py-win-cpu.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 850bd358ca400..2fb8d39c336c8 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -11,6 +11,16 @@ parameters: type: string default: '--use_azure' +- name: cmake_build_type + type: string + displayName: 'CMake build type for Windows. Only for Windows CPU packages.' + default: 'RelWithDebInfo' + values: + - Debug + - Release + - RelWithDebInfo + - MinSizeRel + jobs: - job: Windows_py_Wheels_${{parameters.ARCHITECTURE}} ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: From 36cd99f662e6515fdde0f914bcf096b86ba747e0 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 9 Feb 2026 08:49:09 -0500 Subject: [PATCH 11/17] Build dir --- .../github/azure-pipelines/templates/py-win-cpu.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 2fb8d39c336c8..ac3724f42038b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -108,13 +108,13 @@ jobs: - task: VSBuild@1 displayName: 'Build' inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + solution: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' platform: '${{parameters.ARCHITECTURE}}' - configuration: RelWithDebInfo + configuration: ${{ parameters.cmake_build_type }} msbuildArchitecture: '${{parameters.ARCHITECTURE}}' maximumCpuCount: true logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + workingFolder: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}' createLogFile: true - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: From 017e3c26c67c2f01319e1ab4b995e0fffd619584 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 9 Feb 2026 12:30:09 -0500 Subject: [PATCH 12/17] Working directory --- .../ci_build/github/azure-pipelines/templates/py-win-cpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index ac3724f42038b..73421b506dbd9 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -108,13 +108,13 @@ jobs: - task: VSBuild@1 displayName: 'Build' inputs: - solution: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' + solution: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' platform: '${{parameters.ARCHITECTURE}}' configuration: ${{ parameters.cmake_build_type }} msbuildArchitecture: '${{parameters.ARCHITECTURE}}' maximumCpuCount: true logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}' + workingFolder: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}' createLogFile: true - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: From bc0d885a5ad3d8f1808af999a328055206c473f8 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 9 Feb 2026 13:18:50 -0500 Subject: [PATCH 13/17] . --- .../azure-pipelines/templates/py-win-cpu.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 73421b506dbd9..0f50071f747b4 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -100,22 +100,22 @@ jobs: --skip_submodule_sync --cmake_generator "Visual Studio 17 2022" --enable_pybind - --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache + --enable_onnx_tests --use_vcpkg --use_vcpkg_ms_internal_asset_cache --build ${{ parameters.build_py_parameters }} --parallel --use_binskim_compliant_compile_flags --update $(TelemetryOption) - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' - platform: '${{parameters.ARCHITECTURE}}' - configuration: ${{ parameters.cmake_build_type }} - msbuildArchitecture: '${{parameters.ARCHITECTURE}}' - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}' - createLogFile: true + # - task: VSBuild@1 + # displayName: 'Build' + # inputs: + # solution: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' + # platform: '${{parameters.ARCHITECTURE}}' + # configuration: ${{ parameters.cmake_build_type }} + # msbuildArchitecture: '${{parameters.ARCHITECTURE}}' + # maximumCpuCount: true + # logProjectEvents: true + # workingFolder: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}' + # createLogFile: true - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - template: publish-symbolrequestprod-api.yml From da4ca7e1eb021245d6c8d356465ea3e3e7dc1a4d Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 10 Feb 2026 08:30:32 -0500 Subject: [PATCH 14/17] . --- .../github/azure-pipelines/nuget/templates/dml-vs-2022.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml index 98a43ad735e4c..2548eebeb9d42 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml @@ -70,7 +70,7 @@ stages: - ${{ if notIn(parameters['sln_platform'], 'Win32', 'x64') }}: - powershell: | - python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --build_csharp --build --update --config $(BuildConfig) --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }} + python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --build_csharp --build --update --config $(BuildConfig) --build_nuget --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }} - ${{ else }}: - powershell: | From 21f122ac6f8b12864cebf20fdd3a16e58e45341c Mon Sep 17 00:00:00 2001 From: eserscor Date: Tue, 10 Feb 2026 11:03:12 -0500 Subject: [PATCH 15/17] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../github/azure-pipelines/templates/py-win-cpu.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 0f50071f747b4..64bc6aa102d4d 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -123,7 +123,7 @@ jobs: ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: symbolExpiryTime: 60 includePublicSymbolServer: true - symbolsArtifactName: onnxruntime_cpu_win_x64_$(PythonVersion) + symbolsArtifactName: onnxruntime_cpu_win_${{ parameters.ARCHITECTURE }}_$(PythonVersion) symbolsVersion: $(Build.BuildId) symbolProject: 'ONNX Runtime' subscription: 'OnnxrunTimeCodeSign_20240611' @@ -165,8 +165,12 @@ jobs: python -m pip uninstall -y onnxruntime onnxruntime-gpu -qq Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} Remove-Item -Recurse -Force onnxruntime - if ("$(ExtraParam)" -contains "--use_azure") { - $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" + if ("$(ExtraParam)".Split() -contains "--use_azure") { + ${{ if eq(parameters.ARCHITECTURE, 'arm64') }} { + $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\arm64-windows\bin;$env:path" + } ${{ else }} { + $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" + } python onnxruntime_test_python_azure.py } python onnx_backend_test_series.py From d5df1b60cc97881597780e20ef97f601ee0207a0 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 10 Feb 2026 11:06:35 -0500 Subject: [PATCH 16/17] Syntax fixes --- .../ci_build/github/azure-pipelines/templates/py-win-cpu.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index 64bc6aa102d4d..a29e4c3bf2181 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -166,9 +166,10 @@ jobs: Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname tabulate} Remove-Item -Recurse -Force onnxruntime if ("$(ExtraParam)".Split() -contains "--use_azure") { - ${{ if eq(parameters.ARCHITECTURE, 'arm64') }} { + + if( "${{parameters.ARCHITECTURE}}" -eq 'arm64') { $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\arm64-windows\bin;$env:path" - } ${{ else }} { + } else { $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path" } python onnxruntime_test_python_azure.py From bd99d44abbac2903db57a54e7553ca5b9ae15a4d Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 10 Feb 2026 13:45:22 -0500 Subject: [PATCH 17/17] Code review comments --- .../stages/py-cpu-packaging-stage.yml | 4 +-- .../azure-pipelines/templates/py-win-cpu.yml | 34 ++++++------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml index d27626994dbba..f767ef110561a 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml @@ -68,13 +68,13 @@ stages: jobs: - template: ../templates/py-win-cpu.yml parameters: - ARCHITECTURE: 'x64' + architecture: 'x64' build_py_parameters: ${{ parameters.build_py_parameters }} cmake_build_type: ${{ parameters.cmake_build_type }} - template: ../templates/py-win-cpu.yml parameters: - ARCHITECTURE: 'arm64' + architecture: 'arm64' build_py_parameters: ${{ parameters.build_py_parameters }} cmake_build_type: ${{ parameters.cmake_build_type }} diff --git a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml index a29e4c3bf2181..09603f2350657 100644 --- a/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml @@ -1,5 +1,5 @@ parameters: -- name: ARCHITECTURE +- name: architecture type: string default: 'x64' values: @@ -22,8 +22,8 @@ parameters: - MinSizeRel jobs: -- job: Windows_py_Wheels_${{parameters.ARCHITECTURE}} - ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: +- job: Windows_py_Wheels_${{parameters.architecture}} + ${{ if eq(parameters.architecture, 'arm64') }}: pool: name: 'onnxruntime-qnn-windows-vs-2022-arm64' os: windows @@ -46,7 +46,7 @@ jobs: binskim: enabled: true scanOutputDirectoryOnly: true - ${{ if eq(parameters.ARCHITECTURE, 'arm64') }}: + ${{ if eq(parameters.architecture, 'arm64') }}: outputs: - output: pipelineArtifact targetPath: $(Build.ArtifactStagingDirectory) @@ -58,13 +58,13 @@ jobs: artifactName: onnxruntime-win-$(PythonVersion) strategy: matrix: - Python311_${{parameters.ARCHITECTURE}}: + Python311_${{parameters.architecture}}: PythonVersion: '3.11' - Python312_${{parameters.ARCHITECTURE}}: + Python312_${{parameters.architecture}}: PythonVersion: '3.12' - Python313_${{parameters.ARCHITECTURE}}: + Python313_${{parameters.architecture}}: PythonVersion: '3.13' - Python314_${{parameters.ARCHITECTURE}}: + Python314_${{parameters.architecture}}: PythonVersion: '3.14' variables: OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' @@ -80,7 +80,7 @@ jobs: - template: setup-build-tools.yml parameters: - host_cpu_arch: ${{parameters.ARCHITECTURE}} + host_cpu_arch: ${{parameters.architecture}} python_version: $(PythonVersion) - template: set-nightly-build-option-variable-step.yml @@ -105,25 +105,13 @@ jobs: --parallel --use_binskim_compliant_compile_flags --update $(TelemetryOption) - # - task: VSBuild@1 - # displayName: 'Build' - # inputs: - # solution: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}\onnxruntime.sln' - # platform: '${{parameters.ARCHITECTURE}}' - # configuration: ${{ parameters.cmake_build_type }} - # msbuildArchitecture: '${{parameters.ARCHITECTURE}}' - # maximumCpuCount: true - # logProjectEvents: true - # workingFolder: '$(Build.SourcesDirectory)\${{ parameters.cmake_build_type }}' - # createLogFile: true - - ${{if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))}}: - template: publish-symbolrequestprod-api.yml parameters: ${{if eq(variables['Build.SourceBranch'], 'refs/heads/main')}}: symbolExpiryTime: 60 includePublicSymbolServer: true - symbolsArtifactName: onnxruntime_cpu_win_${{ parameters.ARCHITECTURE }}_$(PythonVersion) + symbolsArtifactName: onnxruntime_cpu_win_${{ parameters.architecture }}_$(PythonVersion) symbolsVersion: $(Build.BuildId) symbolProject: 'ONNX Runtime' subscription: 'OnnxrunTimeCodeSign_20240611' @@ -167,7 +155,7 @@ jobs: Remove-Item -Recurse -Force onnxruntime if ("$(ExtraParam)".Split() -contains "--use_azure") { - if( "${{parameters.ARCHITECTURE}}" -eq 'arm64') { + if( "${{parameters.architecture}}" -eq 'arm64') { $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\arm64-windows\bin;$env:path" } else { $env:path="$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x64-windows\bin;$(Build.SourcesDirectory)\build\${{ parameters.cmake_build_type }}\_deps\vcpkg-src\installed\x86-windows\bin;$env:path"