diff --git a/.github/workflows/cffconvert.yml b/.github/workflows/cffconvert.yml index 7144363717749..0cbaf24059390 100644 --- a/.github/workflows/cffconvert.yml +++ b/.github/workflows/cffconvert.yml @@ -8,7 +8,7 @@ on: jobs: validate: name: "validate" - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - name: Check out a copy of the repository uses: actions/checkout@v4 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e4d1b91bab736..d3b51c0681a20 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,7 +18,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] permissions: actions: read contents: read @@ -55,6 +55,11 @@ jobs: java-version: '11' distribution: 'microsoft' + - if: ${{ matrix.language == 'javascript' }} + uses: actions/setup-node@v4 + with: + node-version: 20 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - if: ${{ matrix.language != 'cpp' }} diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 32aed81092774..cf3bc598d02bb 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -8,7 +8,7 @@ on: [push, pull_request] jobs: validation: name: "Validation" - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - uses: gradle/actions/wrapper-validation@v4 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index a196226a4b836..00960c848b107 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -8,7 +8,7 @@ permissions: jobs: triage: - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: github/issue-labeler@v3.4 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74fd5d7dfdb28..ec834b07b2c78 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: lint-python-format: # Required workflow name: Python format - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - name: Setup Python @@ -114,9 +114,12 @@ jobs: lint-js: name: Lint JavaScript - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 - uses: reviewdog/action-eslint@v1 with: reporter: github-pr-check diff --git a/.github/workflows/linux_training.yml b/.github/workflows/linux_training.yml index 51af6cd20de7d..d382cdf476283 100644 --- a/.github/workflows/linux_training.yml +++ b/.github/workflows/linux_training.yml @@ -12,7 +12,7 @@ concurrency: jobs: orttraining-linux-ci-pipeline: - runs-on: ubuntu-24.04 + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] permissions: actions: read contents: read @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - python3 -m pip install -r tools/ci_build/github/linux/python/requirements.txt + python3 -m pip install --user -r tools/ci_build/github/linux/python/requirements.txt - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index a711b753c492d..152a2bfc13941 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -19,7 +19,7 @@ concurrency: jobs: auto-apply-fixes: name: Suggest fixes - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] permissions: contents: read pull-requests: write @@ -34,14 +34,13 @@ jobs: with: toolchain: stable components: rustfmt - - name: Install dependencies + - name: Install dependencies and run lintrunner on all files run: | - python -m pip install -r requirements-dev.txt - python -m pip install lintrunner lintrunner-adapters + export PATH=$HOME/.local/bin:$PATH + set -e + python -m pip install --user -r requirements-dev.txt + python -m pip install --user lintrunner lintrunner-adapters lintrunner init - - name: Run lintrunner on all files - run: | - set +e lintrunner f --all-files -v exit 0 - uses: parkerbxyz/suggest-changes@v1 diff --git a/.github/workflows/publish-c-apidocs.yml b/.github/workflows/publish-c-apidocs.yml index 72e69f6117ce9..6d3e593d8694e 100644 --- a/.github/workflows/publish-c-apidocs.yml +++ b/.github/workflows/publish-c-apidocs.yml @@ -22,7 +22,7 @@ permissions: jobs: build: name: Generate C/C++ API docs - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - name: Install doxygen and dependencies diff --git a/.github/workflows/publish-csharp-apidocs.yml b/.github/workflows/publish-csharp-apidocs.yml index 81ba703e8d5c1..c704adb263db4 100644 --- a/.github/workflows/publish-csharp-apidocs.yml +++ b/.github/workflows/publish-csharp-apidocs.yml @@ -20,7 +20,7 @@ permissions: jobs: build: - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] env: DOCFXVERSION: 2.62.2 steps: diff --git a/.github/workflows/publish-gh-pages.yml b/.github/workflows/publish-gh-pages.yml index 1818261b4b766..11745ce24f9e5 100644 --- a/.github/workflows/publish-gh-pages.yml +++ b/.github/workflows/publish-gh-pages.yml @@ -8,7 +8,7 @@ on: jobs: placeholder: - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - name: Placeholder step to have workflow included in the GitHub web UI run: | diff --git a/.github/workflows/publish-java-apidocs.yml b/.github/workflows/publish-java-apidocs.yml index bed96b1be7027..d04669a13aab7 100644 --- a/.github/workflows/publish-java-apidocs.yml +++ b/.github/workflows/publish-java-apidocs.yml @@ -21,7 +21,7 @@ permissions: jobs: build: name: Generate Java docs - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - name: Set up JDK 11 diff --git a/.github/workflows/publish-js-apidocs.yml b/.github/workflows/publish-js-apidocs.yml index 7af635f3eb50a..a6749b42adc35 100644 --- a/.github/workflows/publish-js-apidocs.yml +++ b/.github/workflows/publish-js-apidocs.yml @@ -21,7 +21,7 @@ permissions: jobs: build: name: Generate JS API docs - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - name: Setup Node.js diff --git a/.github/workflows/publish-python-apidocs.yml b/.github/workflows/publish-python-apidocs.yml index 352fd3e948b4b..2be9ad957c5cb 100644 --- a/.github/workflows/publish-python-apidocs.yml +++ b/.github/workflows/publish-python-apidocs.yml @@ -22,7 +22,7 @@ permissions: jobs: build: name: Generate Python API docs - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: actions/checkout@v4 - name: Install tools diff --git a/.github/workflows/skip-doc-change.yml.j2 b/.github/workflows/skip-doc-change.yml.j2 index 58f048122a87e..04f77e5d28713 100644 --- a/.github/workflows/skip-doc-change.yml.j2 +++ b/.github/workflows/skip-doc-change.yml.j2 @@ -14,7 +14,7 @@ jobs: {%- for name in job_names %} job{{ loop.index }}: name: {{ name }} - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - run: 'echo "No build required, only documentation changed"' {% endfor %} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 181f3fb17d332..14cf0825873a0 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ on: jobs: close-stale-issues: - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] permissions: issues: write pull-requests: write diff --git a/.github/workflows/title-only-labeler.yml b/.github/workflows/title-only-labeler.yml index e0af2dd06b1b7..7ee9f3917a901 100644 --- a/.github/workflows/title-only-labeler.yml +++ b/.github/workflows/title-only-labeler.yml @@ -8,7 +8,7 @@ permissions: jobs: triage: - runs-on: ubuntu-latest + runs-on: ["self-hosted", "1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU"] steps: - uses: github/issue-labeler@v3.4 with: diff --git a/js/node/README.md b/js/node/README.md index 3f4da7ddd4135..abb91bf05ddf1 100644 --- a/js/node/README.md +++ b/js/node/README.md @@ -14,7 +14,7 @@ Refer to [ONNX Runtime JavaScript examples](https://github.com/microsoft/onnxrun ## Requirements -ONNXRuntime works on Node.js v16.x+ (recommend v18.x+) or Electron v15.x+ (recommend v28.x+). +ONNXRuntime works on Node.js v16.x+ (recommend v20.x+) or Electron v15.x+ (recommend v28.x+). The following table lists the supported versions of ONNX Runtime Node.js binding provided with pre-built binaries. diff --git a/js/web/lib/wasm/jsep/backend-webgpu.ts b/js/web/lib/wasm/jsep/backend-webgpu.ts index bfb74355b0d70..50d83f5af26e0 100644 --- a/js/web/lib/wasm/jsep/backend-webgpu.ts +++ b/js/web/lib/wasm/jsep/backend-webgpu.ts @@ -902,6 +902,10 @@ export class WebGpuBackend { this.sessionStatus = 'default'; } + onCreateSession(): void { + this.gpuDataManager.onCreateSession(); + } + onReleaseSession(sessionId: number): void { this.unregisterBuffers(sessionId); if (this.capturedCommandList.has(sessionId)) { diff --git a/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts b/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts index 33e8c95c141ee..4e14c8b58e2bc 100644 --- a/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts +++ b/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts @@ -64,6 +64,11 @@ export interface GpuDataManager { */ dispose(): void; + /** + * create session related data. + */ + onCreateSession(): void; + /** * release session related data. * @param sessionId - specify the session ID. @@ -200,6 +205,9 @@ class GpuDataManagerImpl implements GpuDataManager { // a SessionID -> GPUBuffer[] mapping. private capturedPendingBuffers: Map; + // The session count. + private sessionCount: number; + constructor(private backend: WebGpuBackend) { this.storageCache = new Map(); this.freeBuffers = new Map(); @@ -213,6 +221,8 @@ class GpuDataManagerImpl implements GpuDataManager { this.freeBuffers.set(key, []); this.freeUniformBuffers.set(key, []); } + + this.sessionCount = 0; } upload(id: GpuDataId, data: Uint8Array): void { @@ -360,7 +370,12 @@ class GpuDataManagerImpl implements GpuDataManager { release(id: GpuDataId): number { const cachedData = this.storageCache.get(id); if (!cachedData) { - throw new Error('releasing data does not exist'); + if (this.storageCache.size === 0) { + // cache was previously cleared, no need to release anything. + return 0; + } else { + throw new Error('releasing data does not exist'); + } } LOG_DEBUG('verbose', () => `[WebGPU] GpuDataManager.release(id=${id}), gpuDataId=${cachedData.gpuData.id}`); @@ -460,6 +475,10 @@ class GpuDataManagerImpl implements GpuDataManager { this.capturedPendingBuffers = new Map(); } + onCreateSession() { + this.sessionCount += 1; + } + onReleaseSession(sessionId: number) { // release the captured pending buffers. const pendingBuffers = this.capturedPendingBuffers.get(sessionId); @@ -469,6 +488,16 @@ class GpuDataManagerImpl implements GpuDataManager { }); this.capturedPendingBuffers.delete(sessionId); } + + // release the storage cache if no active sessions. + this.sessionCount -= 1; + if (this.sessionCount === 0) { + LOG_DEBUG('warning', () => '[WebGPU] Clearing webgpu buffer cache'); + this.storageCache.forEach((storage) => { + storage.gpuData.buffer.destroy(); + }); + this.storageCache = new Map(); + } } } diff --git a/js/web/lib/wasm/wasm-core-impl.ts b/js/web/lib/wasm/wasm-core-impl.ts index 5f219f63aaf61..19f89feb9d0d7 100644 --- a/js/web/lib/wasm/wasm-core-impl.ts +++ b/js/web/lib/wasm/wasm-core-impl.ts @@ -317,6 +317,8 @@ export const createSession = async ( checkLastError("Can't create a session."); } + wasm.jsepOnCreateSession?.(); + // clear current MLContext after session creation if (wasm.currentContext) { wasm.jsepRegisterMLContext!(sessionHandle, wasm.currentContext); diff --git a/js/web/lib/wasm/wasm-types.ts b/js/web/lib/wasm/wasm-types.ts index 3e08fe97f559d..16674f0f4a79e 100644 --- a/js/web/lib/wasm/wasm-types.ts +++ b/js/web/lib/wasm/wasm-types.ts @@ -141,6 +141,12 @@ export declare namespace JSEP { * @param sessionId - specify the session ID. */ jsepOnRunStart: (sessionId: number) => void; + /** + * [exported from pre-jsep.js] Create a session. This function will be called after _OrtCreateSession() is + * called. + * @returns + */ + jsepOnCreateSession: () => void; /** * [exported from pre-jsep.js] Release a session. This function will be called before _OrtReleaseSession() is * called. diff --git a/onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc b/onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc index c8cea833983b1..5e99551fe6e7d 100644 --- a/onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc +++ b/onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc @@ -95,11 +95,6 @@ bool ExpandOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& initializers return false; } - if (input_shape.empty()) { - LOGS(logger, VERBOSE) << "Expand does not support empty input's shape."; - return false; - } - std::vector output_shape; if (!GetBidirectionalBroadcastShape(input_shape, new_shape, output_shape)) { LOGS(logger, VERBOSE) << "The input cannot expand to shape " << GetShapeString(new_shape); diff --git a/onnxruntime/core/providers/webnn/builders/impl/reshape_op_builder.cc b/onnxruntime/core/providers/webnn/builders/impl/reshape_op_builder.cc index a7911683f0355..0a438e98ad737 100644 --- a/onnxruntime/core/providers/webnn/builders/impl/reshape_op_builder.cc +++ b/onnxruntime/core/providers/webnn/builders/impl/reshape_op_builder.cc @@ -44,21 +44,25 @@ Status ReshapeOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder, const auto& input_defs = node.InputDefs(); const auto& initializers(model_builder.GetInitializerTensors()); const auto& target_shape_tensor = *initializers.at(input_defs[1]->Name()); - const int64_t* raw_target_shape = target_shape_tensor.int64_data().empty() - ? reinterpret_cast(target_shape_tensor.raw_data().data()) - : target_shape_tensor.int64_data().data(); + const auto& target_shape_tensor_dims = target_shape_tensor.dims(); + std::vector new_shape; + // Do nothing if target shape is an empty shape, which means converting to a scalar. + if (!target_shape_tensor_dims.empty()) { + const int64_t* raw_target_shape = target_shape_tensor.int64_data().empty() + ? reinterpret_cast(target_shape_tensor.raw_data().data()) + : target_shape_tensor.int64_data().data(); + + const auto size = target_shape_tensor_dims[0]; + TensorShapeVector target_shape{raw_target_shape, raw_target_shape + size}; + std::vector input_shape; + ORT_RETURN_IF_NOT(GetShape(*input_defs[0], input_shape, logger), "Cannot get shape"); + ReshapeHelper helper(TensorShape(input_shape), target_shape); + std::transform(target_shape.cbegin(), target_shape.cend(), + std::back_inserter(new_shape), + [](int64_t dim) -> uint32_t { return SafeInt(dim); }); + } - const auto size = target_shape_tensor.dims()[0]; - TensorShapeVector target_shape{raw_target_shape, raw_target_shape + size}; - std::vector input_shape; - ORT_RETURN_IF_NOT(GetShape(*input_defs[0], input_shape, logger), "Cannot get shape"); - ReshapeHelper helper(TensorShape(input_shape), target_shape); emscripten::val input = model_builder.GetOperand(input_defs[0]->Name()); - std::vector new_shape; - std::transform(target_shape.cbegin(), target_shape.cend(), - std::back_inserter(new_shape), - [](int64_t dim) -> uint32_t { return SafeInt(dim); }); - emscripten::val options = emscripten::val::object(); options.set("label", node.Name()); emscripten::val output = model_builder.GetBuilder().call("reshape", @@ -76,6 +80,11 @@ bool ReshapeOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& initializer const WebnnDeviceType /* device_type */, const logging::Logger& logger) const { const auto& input_defs = node.InputDefs(); + + std::vector input_shape; + if (!GetShape(*input_defs[0], input_shape, logger)) + return false; + const auto& perm_name = input_defs[1]->Name(); if (!Contains(initializers, perm_name)) { LOGS(logger, VERBOSE) << "New shape of reshape must be a constant initializer"; @@ -92,24 +101,11 @@ bool ReshapeOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& initializer const int64_t* raw_new_shape = reinterpret_cast(unpacked_tensor.data()); const auto& perm_dims = perm_tensor.dims(); - if (perm_dims.empty() || perm_dims[0] == 0) { - LOGS(logger, VERBOSE) << "New shape of reshape cannot be empty"; - return false; - } - - std::vector input_shape; - if (!GetShape(*input_defs[0], input_shape, logger)) - return false; - - if (input_shape.empty()) { - LOGS(logger, VERBOSE) << "Reshape does not support empty input shape"; - return false; - } // WebNN reshape does not support 0 as dimension. NodeAttrHelper helper(node); - const bool allow_zero = helper.Get("allowzero ", 0) == 1; - if (allow_zero) { + const bool allow_zero = helper.Get("allowzero", 0) == 1; + if (allow_zero && !perm_dims.empty()) { for (int64_t i = 0; i < perm_dims[0]; i++) { if (raw_new_shape[i] == 0) { LOGS_DEFAULT(VERBOSE) << "Reshape doesn't support 0 reshape dimension when allowzero is enabled"; diff --git a/onnxruntime/python/tools/transformers/models/stable_diffusion/requirements/requirements.txt b/onnxruntime/python/tools/transformers/models/stable_diffusion/requirements/requirements.txt index 8c9f0ba0f21be..8ff5990b7815a 100644 --- a/onnxruntime/python/tools/transformers/models/stable_diffusion/requirements/requirements.txt +++ b/onnxruntime/python/tools/transformers/models/stable_diffusion/requirements/requirements.txt @@ -3,7 +3,7 @@ diffusers==0.28.0 transformers==4.41.2 numpy>=1.24.1 accelerate -onnx==1.16.0 +onnx==1.17.0 coloredlogs packaging # Use newer version of protobuf might cause crash diff --git a/onnxruntime/wasm/pre-jsep.js b/onnxruntime/wasm/pre-jsep.js index 78d60326dd0a8..0efbcab3a3238 100644 --- a/onnxruntime/wasm/pre-jsep.js +++ b/onnxruntime/wasm/pre-jsep.js @@ -192,6 +192,9 @@ Module['jsepInit'] = (name, params) => { Module['jsepCreateDownloader'] = (gpuBuffer, size, type) => { return backend['createDownloader'](gpuBuffer, size, type); }; + Module['jsepOnCreateSession'] = sessionId => { + backend['onCreateSession'](sessionId); + }; Module['jsepOnReleaseSession'] = sessionId => { backend['onReleaseSession'](sessionId); }; diff --git a/tools/ci_build/github/azure-pipelines/nuget-windows-ai.yml b/tools/ci_build/github/azure-pipelines/nuget-windows-ai.yml new file mode 100644 index 0000000000000..1fdc5098579b2 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nuget-windows-ai.yml @@ -0,0 +1,312 @@ +trigger: none + +variables: + DisableDockerDetector: true + +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + name: onnxruntime-Win-CPU-2022 + os: windows + sdl: + tsa: + enabled: true + policheck: + enabled: true + exclusionsFile: '$(Build.SourcesDirectory)\tools\ci_build\policheck_exclusions.xml' + stages: + - stage: Windows_Build + jobs: + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: x64 + + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: x86 + + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: arm64 + + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: x64 + Runtime: static + + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: x86 + Runtime: static + + - template: tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml@self + parameters: + BuildArch: arm64 + Runtime: static + + - job: NuGet_Packaging + dependsOn: + - Windows_Packaging_x64_dynamic + - Windows_Packaging_x86_dynamic + - Windows_Packaging_arm64_dynamic + - Windows_Packaging_x64_static + - Windows_Packaging_x86_static + - Windows_Packaging_arm64_static + condition: succeeded() + templateContext: + inputs: + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_x64_dynamic + targetPath: $(Build.BinariesDirectory)/nuget-artifact-x64 + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_x86_dynamic + targetPath: $(Build.BinariesDirectory)/nuget-artifact-x86 + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_arm64_dynamic + targetPath: $(Build.BinariesDirectory)/nuget-artifact-arm64 + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_x64_static + targetPath: $(Build.BinariesDirectory)/nuget-artifact-x64-static-runtime + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_x86_static + targetPath: $(Build.BinariesDirectory)/nuget-artifact-x86-static-runtime + - input: pipelineArtifact + artifactName: drop_Windows_Build_Windows_Packaging_arm64_static + targetPath: $(Build.BinariesDirectory)/nuget-artifact-arm64-static-runtime + outputs: + - output: pipelineArtifact + path: '$(Build.ArtifactStagingDirectory)/merged' + artifact: drop_Windows_Build_NuGet_Packaging + + steps: + - task: PowerShell@2 + displayName: 'Bundle NuGet and other binaries' + inputs: + targetType: 'inline' + script: | + Add-Type -AssemblyName "System.IO.Compression.FileSystem" + + $nupkgs = (Get-ChildItem -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $x64_nuget_package_name = $nupkgs[0].Name + $x64_nuget_package = $nupkgs[0].FullName + $x64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x64_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x64_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x64_nuget_package, $x64_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-x64-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $x64_static_runtime_nuget_package = $nupkgs[0].FullName + $x64_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x64_static_runtime_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x64_static_runtime_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x64_static_runtime_nuget_package, $x64_static_runtime_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-x86 -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $x86_nuget_package = $nupkgs[0].FullName + $x86_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x86_nupkg_unzipped_directory = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x86_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x86_nuget_package, $x86_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-x86-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $x86_static_runtime_nuget_package = $nupkgs[0].FullName + $x86_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x86_static_runtime_nupkg_unzipped_directory = [System.IO.Path]::Combine($x86_static_runtime_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x86_static_runtime_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x86_static_runtime_nuget_package, $x86_static_runtime_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-arm64 -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $arm64_nuget_package = $nupkgs[0].FullName + $arm64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $arm64_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm64_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_nuget_package, $arm64_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-arm64-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) + $arm64_static_runtime_nuget_package = $nupkgs[0].FullName + $arm64_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $arm64_static_runtime_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_static_runtime_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm64_static_runtime_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_static_runtime_nuget_package, $arm64_static_runtime_nupkg_unzipped_directory) + + + + $x64_static_runtime_path_old = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x64', '_native') + $x64_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x64', '_native', 'static') + $x86_runtime_path_old = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') + $x86_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') + $x86_static_runtime_path_old = [System.IO.Path]::Combine($x86_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') + $x86_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native', 'static') + $arm64_runtime_path_old = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') + $arm64_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') + $arm64_static_runtime_path_old = [System.IO.Path]::Combine($arm64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') + $arm64_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native', 'static') + + $uap_build_path_old = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory, 'build', 'native') + $uap_build_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'build', 'uap10.0') + + New-Item -Path $x64_static_runtime_path_new -ItemType Directory + New-Item -Path $x86_runtime_path_new -ItemType Directory + New-Item -Path $x86_static_runtime_path_new -ItemType Directory + New-Item -Path $arm64_runtime_path_new -ItemType Directory + New-Item -Path $arm64_static_runtime_path_new -ItemType Directory + + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'onnxruntime.dll')) $x86_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'onnxruntime.lib')) $x86_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'microsoft.ai.machinelearning.dll')) $x86_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'microsoft.ai.machinelearning.lib')) $x86_runtime_path_new + + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.dll')) $arm64_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.lib')) $arm64_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'microsoft.ai.machinelearning.dll')) $arm64_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'microsoft.ai.machinelearning.lib')) $arm64_runtime_path_new + + Copy-Item ([System.IO.Path]::Combine($x64_static_runtime_path_old, 'onnxruntime.dll')) ([System.IO.Path]::Combine($x64_static_runtime_path_new, 'onnxruntime.dll')) + Copy-Item ([System.IO.Path]::Combine($x64_static_runtime_path_old, 'onnxruntime.lib')) ([System.IO.Path]::Combine($x64_static_runtime_path_new, 'onnxruntime.lib')) + Copy-Item ([System.IO.Path]::Combine($x64_static_runtime_path_old, 'microsoft.ai.machinelearning.dll')) ([System.IO.Path]::Combine($x64_static_runtime_path_new, 'microsoft.ai.machinelearning.dll')) + Copy-Item ([System.IO.Path]::Combine($x64_static_runtime_path_old, 'microsoft.ai.machinelearning.lib')) ([System.IO.Path]::Combine($x64_static_runtime_path_new, 'microsoft.ai.machinelearning.lib')) + + Copy-Item ([System.IO.Path]::Combine($x86_static_runtime_path_old, 'onnxruntime.dll')) ([System.IO.Path]::Combine($x86_static_runtime_path_new, 'onnxruntime.dll')) + Copy-Item ([System.IO.Path]::Combine($x86_static_runtime_path_old, 'onnxruntime.lib')) ([System.IO.Path]::Combine($x86_static_runtime_path_new, 'onnxruntime.lib')) + Copy-Item ([System.IO.Path]::Combine($x86_static_runtime_path_old, 'microsoft.ai.machinelearning.dll')) ([System.IO.Path]::Combine($x86_static_runtime_path_new, 'microsoft.ai.machinelearning.dll')) + Copy-Item ([System.IO.Path]::Combine($x86_static_runtime_path_old, 'microsoft.ai.machinelearning.lib')) ([System.IO.Path]::Combine($x86_static_runtime_path_new, 'microsoft.ai.machinelearning.lib')) + + Copy-Item ([System.IO.Path]::Combine($arm64_static_runtime_path_old, 'onnxruntime.dll')) ([System.IO.Path]::Combine($arm64_static_runtime_path_new, 'onnxruntime.dll')) + Copy-Item ([System.IO.Path]::Combine($arm64_static_runtime_path_old, 'onnxruntime.lib')) ([System.IO.Path]::Combine($arm64_static_runtime_path_new, 'onnxruntime.lib')) + Copy-Item ([System.IO.Path]::Combine($arm64_static_runtime_path_old, 'microsoft.ai.machinelearning.dll')) ([System.IO.Path]::Combine($arm64_static_runtime_path_new, 'microsoft.ai.machinelearning.dll')) + Copy-Item ([System.IO.Path]::Combine($arm64_static_runtime_path_old, 'microsoft.ai.machinelearning.lib')) ([System.IO.Path]::Combine($arm64_static_runtime_path_new, 'microsoft.ai.machinelearning.lib')) + + Copy-Item -Recurse $uap_build_path_old $uap_build_path_new + + $merged_nuget_path = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'merged') + if (!(Test-Path $merged_nuget_path)) { + New-Item -Path $merged_nuget_path -ItemType Directory + } + + $merged_nuget = [System.IO.Path]::Combine($merged_nuget_path, $x64_nuget_package_name) + Start-Process -FilePath "7z" -ArgumentList "-tzip a -r $merged_nuget ." -WorkingDirectory $x64_nupkg_unzipped_directory -NoNewWindow -Wait + + workingDirectory: $(Build.BinariesDirectory)\nuget-artifact-x64 + + - task: PowerShell@2 + displayName: 'Bundle Symbols NuGet' + inputs: + targetType: 'inline' + script: | + Add-Type -AssemblyName "System.IO.Compression.FileSystem" + + $nupkgs = (Get-ChildItem -Filter Microsoft.AI.MachineLearning*.snupkg -Recurse) + $x64_nuget_package_name = $nupkgs[0].Name + $x64_nuget_package = $nupkgs[0].FullName + $x64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x64_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory_root, 'symbols', [System.IO.Path]::GetFileNameWithoutExtension($x64_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x64_nuget_package, $x64_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-x86 -Filter Microsoft.AI.MachineLearning*.snupkg -Recurse) + $x86_nuget_package = $nupkgs[0].FullName + $x86_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $x86_nupkg_unzipped_directory = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory_root, 'symbols', [System.IO.Path]::GetFileNameWithoutExtension($x86_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($x86_nuget_package, $x86_nupkg_unzipped_directory) + + $nupkgs = (Get-ChildItem ..\nuget-artifact-arm64 -Filter Microsoft.AI.MachineLearning*.snupkg -Recurse) + $arm64_nuget_package = $nupkgs[0].FullName + $arm64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName + $arm64_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory_root, 'symbols', [System.IO.Path]::GetFileNameWithoutExtension($arm64_nuget_package)) + [System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_nuget_package, $arm64_nupkg_unzipped_directory) + + $x86_runtime_path_old = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') + $x86_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') + $arm64_runtime_path_old = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') + $arm64_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') + + New-Item -Path $x86_runtime_path_new -ItemType Directory + New-Item -Path $arm64_runtime_path_new -ItemType Directory + + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'onnxruntime.pdb')) $x86_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'microsoft.ai.machinelearning.pdb')) $x86_runtime_path_new + + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.pdb')) $arm64_runtime_path_new + Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'microsoft.ai.machinelearning.pdb')) $arm64_runtime_path_new + + $merged_nuget_path = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'merged') + if (!(Test-Path $merged_nuget_path)) { + New-Item -Path $merged_nuget_path -ItemType Directory + } + + $merged_nuget = [System.IO.Path]::Combine($merged_nuget_path, $x64_nuget_package_name) + + Start-Process -FilePath "7z" -ArgumentList "-tzip a -r $merged_nuget ." -WorkingDirectory $x64_nupkg_unzipped_directory -NoNewWindow -Wait + + $merged_nuget_without_pdb = [System.IO.Path]::ChangeExtension($merged_nuget, '.nupkg') + + # Now we combine the DLLs and PDBs together, put them back in a folder under $(Build.SourcesDirectory) + # We won't upload the unzipped folder. We will just feed it to BinSkim. + 7z x -o$(Build.SourcesDirectory)\unzipped $merged_nuget + 7z -y x -o$(Build.SourcesDirectory)\unzipped $merged_nuget_without_pdb + + workingDirectory: $(Build.BinariesDirectory)\nuget-artifact-x64 + + - script: | + dir $(Build.SourcesDirectory)\unzipped\runtimes\win-x64\_native + + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 + displayName: "Sign Nuget package" + inputs: + ConnectedServiceName: 'OnnxrunTimeCodeSign_20240611' + AppRegistrationClientId: '53d54d02-978d-4305-8572-583cf6711c4f' + AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' + AuthAKVName: 'buildkeyvault' + AuthCertName: '53d54d02-SSL-AutoRotate' + AuthSignCertName: '53d54d02-978d-4305-8572-583cf6711c4f' + + FolderPath: $(Build.ArtifactStagingDirectory) + Pattern: '*.nupkg' + SessionTimeout: 90 + ServiceEndpointUrl: 'https://api.esrp.microsoft.com/api/v2' + MaxConcurrency: 25 + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "6.2.9304.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "6.2.9304.0" + } + ] + + - job: NuGet_Publishing + dependsOn: + - NuGet_Packaging + condition: succeeded() + templateContext: + inputs: + - input: pipelineArtifact + artifactName: drop_Windows_Build_NuGet_Packaging + targetPath: $(Build.BinariesDirectory)/merged + outputs: + - output: nuget + # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) # Optional condition + useDotNetTask: false # The default is false to use the NuGetCommand task. Set to true to use the DotNetCoreCLI task to publish packages. + packagesToPush: '$(Build.BinariesDirectory)/packages/*.nupkg;!$(Build.BinariesDirectory)/packages/*.symbols.nupkg' + packageParentPath: '$(Build.BinariesDirectory)/' + publishVstsFeed: PublicPackages/ORT-Nightly # Required when pushing to internal feed. + nuGetFeedType: internal # Change to external when publishing to external feed + allowPackageConflicts: true # Optional. NuGetCommand task only. + publishPackageMetadata: true # Optional + steps: + - powershell: | + Rename-Item -Path merged packages + + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Rename nuget folder' diff --git a/tools/ci_build/github/azure-pipelines/nuget/nuget_config/nuget.config b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/nuget.config new file mode 100644 index 0000000000000..f654900ad04d1 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/nuget.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x64/packages.config b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x64/packages.config new file mode 100644 index 0000000000000..294bd926a34cb --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x64/packages.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x86/packages.config b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x86/packages.config new file mode 100644 index 0000000000000..3528545dfb06e --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nuget/nuget_config/x86/packages.config @@ -0,0 +1,6 @@ + + + + + + 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 4acd97ff66c3b..29b16c47bca5d 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 @@ -75,7 +75,7 @@ stages: - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: onebranch.pipeline.tsaoptions@1 displayName: 'OneBranch TSAOptions' diff --git a/tools/ci_build/github/azure-pipelines/py-cuda-alt-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/py-cuda-alt-packaging-pipeline.yml index cc2977721d03b..844991c475ff7 100644 --- a/tools/ci_build/github/azure-pipelines/py-cuda-alt-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/py-cuda-alt-packaging-pipeline.yml @@ -1,5 +1,10 @@ trigger: none - +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release parameters: - name: enable_linux_cuda type: boolean @@ -17,11 +22,21 @@ parameters: - Release - RelWithDebInfo - MinSizeRel +extends: + # The pipeline extends the 1ES PT which will inject different SDL and compliance tasks. + # For non-production pipelines, use "Unofficial" as defined below. + # For productions pipelines, use "Official". + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + # Update the pool with your team's 1ES hosted pool. + pool: + name: 'onnxruntime-Win-CPU-2022' # Name of your hosted pool + os: windows # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS -stages: - - template: stages/py-gpu-packaging-stage.yml - parameters: - enable_linux_cuda: ${{ parameters.enable_linux_cuda }} - enable_windows_cuda: ${{ parameters.enable_windows_cuda }} - cmake_build_type: ${{ parameters.cmake_build_type }} - cuda_version: '11.8' + stages: + - template: stages/py-gpu-packaging-stage.yml + parameters: + enable_linux_cuda: ${{ parameters.enable_linux_cuda }} + enable_windows_cuda: ${{ parameters.enable_windows_cuda }} + cmake_build_type: ${{ parameters.cmake_build_type }} + cuda_version: '11.8' diff --git a/tools/ci_build/github/azure-pipelines/py-dml-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/py-dml-packaging-pipeline.yml index 0c7c6abeb35da..280b54e4b9c2d 100644 --- a/tools/ci_build/github/azure-pipelines/py-dml-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/py-dml-packaging-pipeline.yml @@ -1,5 +1,10 @@ trigger: none - +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release parameters: - name: cmake_build_type type: string @@ -9,10 +14,19 @@ parameters: - Release - RelWithDebInfo - MinSizeRel +extends: + # The pipeline extends the 1ES PT which will inject different SDL and compliance tasks. + # For non-production pipelines, use "Unofficial" as defined below. + # For productions pipelines, use "Official". + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + # Update the pool with your team's 1ES hosted pool. + pool: + name: 'onnxruntime-Win-CPU-2022' # Name of your hosted pool + os: windows # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS -stages: - - template: stages/py-gpu-packaging-stage.yml - parameters: - enable_windows_dml: true - cmake_build_type: ${{ parameters.cmake_build_type }} - publish_symbols: true + stages: + - template: stages/py-gpu-packaging-stage.yml + parameters: + enable_windows_dml: true + cmake_build_type: ${{ parameters.cmake_build_type }} diff --git a/tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml index ed992be31257a..bb9ada7d6cb4b 100644 --- a/tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml @@ -77,5 +77,3 @@ stages: build_py_parameters: ${{ parameters.build_py_parameters }} cmake_build_type: ${{ parameters.cmake_build_type }} qnn_sdk_version: ${{ parameters.qnn_sdk_version }} - publish_symbols: true - diff --git a/tools/ci_build/github/azure-pipelines/stages/py-gpu-packaging-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-gpu-packaging-stage.yml index 156c828ebc45a..da4cd625b546b 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-gpu-packaging-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-gpu-packaging-stage.yml @@ -48,10 +48,6 @@ parameters: - '3.12' - '3.13' -- name: publish_symbols - type: boolean - default: false - stages: - ${{ if eq(parameters.enable_windows_cuda, true) }}: - ${{ each python_version in parameters.PythonVersions }}: @@ -85,5 +81,4 @@ stages: EP_BUILD_FLAGS: --use_dml --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 --enable_wcos ENV_SETUP_SCRIPT: setup_env.bat EP_NAME: directml - publish_symbols: ${{ parameters.publish_symbols }} cmake_build_type: ${{ parameters.cmake_build_type }} \ No newline at end of file diff --git a/tools/ci_build/github/azure-pipelines/stages/py-linux-gpu-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-linux-gpu-stage.yml index 64faa6c5daeef..3f26d2d5aeca3 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-linux-gpu-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-linux-gpu-stage.yml @@ -99,6 +99,7 @@ stages: mv $(Build.BinariesDirectory)/dist ./dist pushd dist find . -name \*.whl -exec unzip -qq -o {} \; + rm -r onnxruntime popd pushd ${{ parameters.cmake_build_type }} find . -name \*.whl -exec unzip -qq -o {} \; diff --git a/tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml index f2f94d695813b..5918f4f44a65e 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml @@ -37,11 +37,7 @@ parameters: - Release - RelWithDebInfo - MinSizeRel - -- name: publish_symbols - type: boolean - default: false - + - name: use_tensorrt type: boolean default: false @@ -56,8 +52,23 @@ stages: clean: all pool: name: onnxruntime-Win-CPU-2022 + os: windows + templateContext: + codeSignValidation: + enabled: true + break: true + psscriptanalyzer: + enabled: true + sdl: + binskim: + enabled: true + scanOutputDirectoryOnly: true + targetPathPattern: '+:file|*.dll;-:file|DirectML.dll' + outputs: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: win_${{ parameters.EP_NAME }}_wheel_${{ parameters.PYTHON_VERSION }} variables: - # The build machine pool doesn't have dotnet, so it can't run CG. - template: ../templates/common-variables.yml - name: GRADLE_OPTS value: '-Dorg.gradle.daemon=false' @@ -92,12 +103,6 @@ stages: addToPath: true architecture: 'x64' - - task: onebranch.pipeline.tsaoptions@1 - displayName: 'OneBranch TSAOptions' - inputs: - tsaConfigFilePath: '$(Build.SourcesDirectory)\.config\tsaoptions.json' - appendSourceBranchName: false - - template: ../templates/download-deps.yml - ${{ if ne(parameters.ENV_SETUP_SCRIPT, '') }}: @@ -123,13 +128,6 @@ stages: arguments: --new_dir $(Build.BinariesDirectory)/deps workingDirectory: $(Build.BinariesDirectory) - - task: PowerShell@2 - displayName: 'Install ONNX' - inputs: - filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1' - workingDirectory: '$(Build.BinariesDirectory)' - arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\installed -build_config ${{ parameters.cmake_build_type }} - - template: ../templates/set-nightly-build-option-variable-step.yml - task: PythonScript@0 @@ -143,22 +141,10 @@ stages: --cmake_generator "$(VSGenerator)" --enable_pybind --enable_onnx_tests - --parallel --use_binskim_compliant_compile_flags --update + --parallel --use_binskim_compliant_compile_flags --update --build $(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }} ${{ variables.trt_build_flag }} workingDirectory: '$(Build.BinariesDirectory)' - # building with build.py so the parallelization parameters are added to the msbuild command - - task: PythonScript@0 - displayName: 'Build' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: > - --config ${{ parameters.cmake_build_type }} - --build_dir $(Build.BinariesDirectory) - --parallel --build - $(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }} - workingDirectory: '$(Build.BinariesDirectory)' - # Esrp signing - template: ../templates/win-esrp-dll.yml parameters: @@ -181,48 +167,11 @@ stages: Contents: '*.whl' TargetFolder: '$(Build.ArtifactStagingDirectory)' - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: ONNXRuntime python wheel' - inputs: - ArtifactName: onnxruntime_${{ parameters.EP_NAME }} - - - ${{ if eq(parameters.publish_symbols, true) }}: - - task: PublishSymbols@2 - displayName: 'Publish symbols' - condition: and (succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-'))) - inputs: - SymbolsFolder: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}' - SearchPattern: | - onnxruntime_pybind11_state.pdb - onnxruntime_providers_shared.pdb - IndexSources: true - SymbolServerType: TeamServices - SymbolExpirationInDays: 3650 - SymbolsArtifactName: 'win_${{ parameters.EP_NAME }}_${{ parameters.PYTHON_VERSION }}_$(Build.BuildNumber)' - - script: | 7z x *.whl workingDirectory: '$(Build.ArtifactStagingDirectory)' displayName: 'unzip the package' - - task: CredScan@3 - displayName: 'Run CredScan' - inputs: - debugMode: false - continueOnError: true - - - task: BinSkim@4 - displayName: 'Run BinSkim' - inputs: - AnalyzeTargetGlob: '+:file|$(Build.ArtifactStagingDirectory)\**\*.dll;-:file|$(Build.ArtifactStagingDirectory)\**\DirectML.dll' - - - task: TSAUpload@2 - displayName: 'TSA upload' - condition: and (succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - inputs: - GdnPublishTsaOnboard: false - GdnPublishTsaConfigFile: '$(Build.sourcesDirectory)\.gdn\.gdntsa' - - template: ../templates/component-governance-component-detection-steps.yml parameters: condition: 'succeeded' @@ -252,7 +201,7 @@ stages: - template: ../templates/flex-downloadPipelineArtifact.yml parameters: - ArtifactName: onnxruntime_${{ parameters.EP_NAME }} + ArtifactName: win_${{ parameters.EP_NAME }}_wheel_${{ parameters.PYTHON_VERSION }} StepName: 'Download Pipeline Artifact - Windows GPU Build' TargetPath: '$(Build.ArtifactStagingDirectory)' diff --git a/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml b/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml index 3586ac895b1e3..b39d7edb8fb22 100644 --- a/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml +++ b/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml @@ -102,7 +102,7 @@ jobs: - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' force32bit: ${{ parameters.isX86 }} # Our build machine doesn't have java x86 diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml index eb48b44db5a1f..8a278b57e4aee 100644 --- a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml +++ b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml @@ -50,7 +50,7 @@ jobs: versionSpec: 3.11 - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: JavaToolInstaller@0 inputs: diff --git a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml index ea3ec00e68f73..d8ea1c35c89c4 100644 --- a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml @@ -128,7 +128,7 @@ stages: - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - script: brew install coreutils ninja npm yarn diff --git a/tools/ci_build/github/azure-pipelines/templates/web-browserstack-ci.yml b/tools/ci_build/github/azure-pipelines/templates/web-browserstack-ci.yml index b9a184c8d9bcf..8fd532e73c114 100644 --- a/tools/ci_build/github/azure-pipelines/templates/web-browserstack-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/web-browserstack-ci.yml @@ -29,7 +29,7 @@ jobs: - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: DownloadPipelineArtifact@2 inputs: patterns: 'Release_*/**/*' diff --git a/tools/ci_build/github/azure-pipelines/templates/web-ci.yml b/tools/ci_build/github/azure-pipelines/templates/web-ci.yml index b2e1833156657..01a3b75ed958c 100644 --- a/tools/ci_build/github/azure-pipelines/templates/web-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/web-ci.yml @@ -73,7 +73,7 @@ stages: displayName: 'Checkout submodule onnx' - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - template: linux-web-init-and-check.yml - task: Bash@3 displayName: 'Extract commit SHA and save to __commit.txt' diff --git a/tools/ci_build/github/azure-pipelines/templates/win-ci.yml b/tools/ci_build/github/azure-pipelines/templates/win-ci.yml index 27c97bee23c5d..6a0c34daa9bb9 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-ci.yml @@ -136,7 +136,7 @@ stages: - task: NodeTool@0 condition: and(succeeded(), eq('${{ parameters.buildNodejs}}', true)) inputs: - versionSpec: '18.x' + versionSpec: '20.x' - ${{ if ne(parameters.CudaVersion, '') }}: - template: jobs/download_win_gpu_library.yml @@ -367,7 +367,7 @@ stages: - task: NodeTool@0 condition: and(succeeded(), eq('${{ parameters.buildNodejs}}', true)) inputs: - versionSpec: '18.x' + versionSpec: '20.x' - ${{ if ne(parameters.CudaVersion, '') }}: - template: jobs/download_win_gpu_library.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml b/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml index 8a386963a89dd..86acebc9f7a71 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml @@ -67,6 +67,7 @@ steps: - task: PowerShell@2 displayName: 'Signature validation for signed file(s)' + condition: and(succeeded(), eq('${{ parameters.DoEsrp }}', true)) inputs: targetType: 'inline' script: | diff --git a/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml b/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml index 5c18d075fc425..2b9d2b77f1e6b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml @@ -81,7 +81,7 @@ jobs: architecture: $(buildArch) - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - template: download-deps.yml - task: PythonScript@0 diff --git a/tools/ci_build/github/azure-pipelines/templates/win-web-ci.yml b/tools/ci_build/github/azure-pipelines/templates/win-web-ci.yml index 0e8a7eb94379b..8aa73386b8d7d 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-web-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-web-ci.yml @@ -74,7 +74,7 @@ jobs: displayName: 'Testing: force EOL to lf on windows for /js/**' - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: DownloadPipelineArtifact@2 inputs: patterns: '${{ parameters.BuildConfig }}_*/**/*' diff --git a/tools/ci_build/github/azure-pipelines/templates/win-web-multi-browsers.yml b/tools/ci_build/github/azure-pipelines/templates/win-web-multi-browsers.yml index 97cbdcb9aba2f..6b6e4a869a0d2 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-web-multi-browsers.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-web-multi-browsers.yml @@ -37,7 +37,7 @@ jobs: displayName: 'Checkout submodule onnx' - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: DownloadPipelineArtifact@2 inputs: patterns: 'Release_*/**/*' diff --git a/tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml b/tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml new file mode 100644 index 0000000000000..6b492ad95184a --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/windowsai-steps.yml @@ -0,0 +1,179 @@ +parameters: +- name: BuildArch + displayName: BuildArch + type: string + default: 'x64' + +- name: Runtime + displayName: MSVC Runtime, should be 'dynamic' or 'static'. + type: string + default: 'dynamic' + +jobs: +- job: Windows_Packaging_${{ parameters.BuildArch }}_${{ parameters.Runtime }} + templateContext: + outputs: + - output: pipelineArtifact + path: '$(Build.ArtifactStagingDirectory)' + artifact: drop_Windows_Build_Windows_Packaging_${{ parameters.BuildArch }}_${{ parameters.Runtime }} + + steps: + - task: UseDotNet@2 + inputs: + version: '6.x' + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + addToPath: true + ${{ if eq(parameters.BuildArch, 'x86') }}: + architecture: 'x86' + + - template: telemetry-steps.yml + + - task: NuGetCommand@2 + displayName: 'NuGet restore' + inputs: + command: restore + feedsToUse: config + nugetConfigPath: $(Build.SourcesDirectory)\tools\ci_build\github\azure-pipelines\nuget\nuget_config\nuget.config + restoreDirectory: '$(Build.BinariesDirectory)' + ${{ if eq(parameters.BuildArch, 'x64') }}: + restoreSolution: $(Build.SourcesDirectory)\tools\ci_build\github\azure-pipelines\nuget\nuget_config\x64\packages.config + ${{ if eq(parameters.BuildArch, 'x86') }}: + restoreSolution: $(Build.SourcesDirectory)\.tools\ci_build\github\azure-pipelines\nuget\nuget_config\x86\packages.config + ${{ if eq(parameters.BuildArch, 'arm') }}: + restoreSolution: $(Build.SourcesDirectory)\tools\ci_build\github\azure-pipelines\nuget\nuget_config\x64\packages.config + ${{ if eq(parameters.BuildArch, 'arm64') }}: + restoreSolution: $(Build.SourcesDirectory)\tools\ci_build\github\azure-pipelines\nuget\nuget_config\x64\packages.config + + - script: | + @echo off + set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do ( + set vslatest="%%i" + if exist "%%i\Common7\Tools\vsdevcmd.bat" ( + set vsdevcmd="%%i\Common7\Tools\vsdevcmd.bat" + ) + ) + + @echo vslatest %vslatest% + @echo vsdevcmd %vsdevcmd% + + @echo ##vso[task.setvariable variable=vslatest]%vslatest% + @echo ##vso[task.setvariable variable=vsdevcmd]%vsdevcmd% -arch=${{ parameters.BuildArch }} + displayName: 'locate vsdevcmd via vswhere' + + - powershell: | + Write-Host "##vso[task.setvariable variable=BuildFlags]" + Write-Host "##vso[task.setvariable variable=ArtifactName]Microsoft.AI.MachineLearning.${{ parameters.BuildArch }}" + displayName: Initialize build flags + + - powershell: | + Write-Host "##vso[task.setvariable variable=BuildFlags]$(BuildFlags) --${{ parameters.BuildArch }}" + displayName: Add cross compilation flags for ARM + condition: and(ne('${{ parameters.BuildArch }}', 'x64'), ne('${{ parameters.BuildArch }}', 'x86')) + + - powershell: | + Write-Host "##vso[task.setvariable variable=BuildFlags]$(BuildFlags) --enable_msvc_static_runtime" + Write-Host "##vso[task.setvariable variable=ArtifactName]$(ArtifactName).StaticRuntime" + displayName: Add static runtime flags + condition: eq('${{ parameters.Runtime }}', 'static') + + # must call vsdevcmd first to add cmake to PATH + - script: | + curl -O -L https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-windows-x86_64.zip + 7z x cmake-3.28.3-windows-x86_64.zip + python --version + python "$(Build.SourcesDirectory)\tools\ci_build\build.py" --build_dir $(Build.BinariesDirectory) --parallel --use_binskim_compliant_compile_flags --build_shared_lib --enable_onnx_tests --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 17 2022" --update --config RelWithDebInfo --enable_lto --use_telemetry --disable_rtti --enable_wcos --windows_sdk_version "10.0.22621.0" $(BuildFlags) --cmake_extra_defines "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" --cmake_path $(Build.BinariesDirectory)\cmake-3.28.3-windows-x86_64\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake-3.28.3-windows-x86_64\bin\ctest.exe + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Generate cmake config' + + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + ${{ if ne(parameters.BuildArch, 'x86') }}: + platform: ${{ parameters.BuildArch }} + ${{ if eq(parameters.BuildArch, 'x86') }}: + platform: 'Win32' + configuration: RelWithDebInfo + msbuildArchitecture: ${{ parameters.BuildArch }} + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true + + - ${{ if eq(parameters.Runtime, 'dynamic') }}: + - script: | + xcopy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\winml_test_api.exe $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\winml_test_scenario.exe $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\api\models\*.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\scenario\cppwinrt\*.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\scenario\models\*.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\common\testdata\squeezenet\* $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\collateral\models\*.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + xcopy $(Build.SourcesDirectory)\winml\test\collateral\models\ModelSubdirectory $(Build.ArtifactStagingDirectory)\test_artifact\ModelSubdirectory\ /i + copy $(Build.SourcesDirectory)\winml\test\collateral\images\*.png $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\winml\test\collateral\images\*.jpg $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\onnxruntime\test\testdata\sequence_length.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\onnxruntime\test\testdata\sequence_construct.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + displayName: 'Copy WinML test collateral to artifact directory' + + + - ${{ if eq(parameters.BuildArch, 'x64') }}: + - script: | + call $(vsdevcmd) + msbuild Microsoft.AI.MachineLearning.Interop.csproj /p:Configuration=RelWithDebInfo /p:Platform="Any CPU" /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) -restore + workingDirectory: '$(Build.SourcesDirectory)\csharp\src\Microsoft.AI.MachineLearning.Interop' + displayName: 'Build Microsoft.AI.MachineLearning.Interop.dll' + + - template: win-esrp-dll.yml + parameters: + FolderPath: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo' + DisplayName: 'Sign runtime DLLs' + Pattern: '*.exe,*.dll' + + - ${{ if eq(parameters.BuildArch, 'x64') }}: + - script: | + call $(vsdevcmd) + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) + workingDirectory: '$(Build.SourcesDirectory)\csharp' + displayName: 'Create NuGet Package' + + - ${{ if eq(parameters.BuildArch, 'x86') }}: + - script: | + call $(vsdevcmd) + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=x86 + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) + workingDirectory: '$(Build.SourcesDirectory)\csharp' + displayName: 'Create NuGet Package' + + - ${{ if eq(parameters.BuildArch, 'arm64') }}: + - script: | + call $(vsdevcmd) + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm64 /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) + workingDirectory: '$(Build.SourcesDirectory)\csharp' + displayName: 'Create NuGet Package' + + - ${{ if eq(parameters.BuildArch, 'arm') }}: + - script: | + call $(vsdevcmd) + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) + copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) + workingDirectory: '$(Build.SourcesDirectory)\csharp' + displayName: 'Create NuGet Package' + + # Only dynamic copied to test_artifact + - ${{ if eq(parameters.Runtime, 'dynamic') }}: + - template: win-esrp-dll.yml + parameters: + FolderPath: '$(Build.ArtifactStagingDirectory)\test_artifact' + DisplayName: 'Sign test_artifact' + Pattern: '*.exe,*.dll' diff --git a/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml b/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml index b5120f01bff3e..0ab6b08662308 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml @@ -36,7 +36,7 @@ jobs: - task: NodeTool@0 inputs: - versionSpec: '18.x' + versionSpec: '20.x' - task: NuGetToolInstaller@0 displayName: Use Nuget 6.10.x