mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-24 19:43:35 +00:00
### Description Currently we try to include all prebuilt binaries into the NPM packages. This was working until we added libonnxruntime_providers_cuda.so (>400MB) into the NPM package. The NPM registry refuses to accept new package publishment because the file is too large. To make the new NPM package working, we have to remove the large file from the package, and add a new script on package installation. This script will try to dynamically install onnxruntime CUDA dynamic library for Linux/x64.
845 lines
32 KiB
YAML
845 lines
32 KiB
YAML
parameters:
|
|
- name: RunOnnxRuntimeTests
|
|
displayName: Run Tests?
|
|
type: boolean
|
|
default: true
|
|
|
|
- name: DoCompliance
|
|
displayName: Run Compliance Tasks?
|
|
type: boolean
|
|
default: true
|
|
|
|
- name: DoEsrp
|
|
displayName: Run code sign tasks? Must be true if you are doing an Onnx Runtime release.
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: IsReleaseBuild
|
|
displayName: Is a release build? Set it to true if you are doing an Onnx Runtime release.
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: AdditionalBuildFlags
|
|
displayName: Additional build flags for build.py
|
|
type: string
|
|
default: ''
|
|
|
|
- name: AdditionalWinBuildFlags
|
|
displayName: Additional build flags that just for Windows Builds
|
|
type: string
|
|
default: ''
|
|
|
|
- name: OrtNugetPackageId
|
|
displayName: Package name for nuget
|
|
type: string
|
|
default: 'Microsoft.ML.OnnxRuntime'
|
|
|
|
- name: BuildVariant
|
|
type: string
|
|
default: 'default'
|
|
|
|
- name: SpecificArtifact
|
|
displayName: Use Specific Artifact
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: BuildId
|
|
displayName: Specific Artifact's BuildId
|
|
type: string
|
|
default: '0'
|
|
|
|
stages:
|
|
- template: linux-cpu-packaging-pipeline.yml
|
|
parameters:
|
|
AdditionalBuildFlags: ${{ parameters.AdditionalBuildFlags }}
|
|
|
|
- template: mac-cpu-packaging-pipeline.yml
|
|
parameters:
|
|
AllowReleasedOpsetOnly: 1
|
|
BuildForAllArchs: true
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
|
|
- stage: Android_Java_API_AAR_Packaging_Mobile
|
|
dependsOn: []
|
|
jobs:
|
|
- template: android-java-api-aar.yml
|
|
parameters:
|
|
buildConfig: 'Release'
|
|
buildSettings: '$(Build.SourcesDirectory)/tools/ci_build/github/android/default_mobile_aar_build_settings.json'
|
|
includedOpsConfig: '$(Build.SourcesDirectory)/tools/ci_build/github/android/mobile_package.required_operators.config'
|
|
artifactName: 'onnxruntime-android-mobile-aar'
|
|
job_name_suffix: 'Mobile'
|
|
packageName: 'onnxruntime-mobile'
|
|
- template: android-java-api-aar-test.yml
|
|
parameters:
|
|
artifactName: 'onnxruntime-android-mobile-aar'
|
|
job_name_suffix: 'Mobile'
|
|
packageName: 'onnxruntime-mobile'
|
|
|
|
|
|
- stage: Android_Java_API_AAR_Packaging_Full
|
|
dependsOn: []
|
|
jobs:
|
|
- template: android-java-api-aar.yml
|
|
parameters:
|
|
buildConfig: 'Release'
|
|
buildSettings: '$(Build.SourcesDirectory)/tools/ci_build/github/android/default_full_aar_build_settings.json'
|
|
artifactName: 'onnxruntime-android-full-aar'
|
|
job_name_suffix: 'Full'
|
|
publish_executables: '1'
|
|
- template: android-java-api-aar-test.yml
|
|
parameters:
|
|
artifactName: 'onnxruntime-android-full-aar'
|
|
job_name_suffix: 'Full'
|
|
|
|
- stage: iOS_Full_xcframework
|
|
dependsOn: []
|
|
jobs:
|
|
- job:
|
|
workspace:
|
|
clean: all
|
|
pool:
|
|
vmImage: 'macOS-latest'
|
|
timeoutInMinutes: 300
|
|
steps:
|
|
- template: set-version-number-variables-step.yml
|
|
|
|
- template: use-xcode-version.yml
|
|
parameters:
|
|
xcodeVersion: 14.2
|
|
|
|
- script: |
|
|
/bin/bash $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_host_protoc.sh \
|
|
$(Build.SourcesDirectory) \
|
|
$(Build.BinariesDirectory)/protobuf \
|
|
$(Build.BinariesDirectory)/protobuf_install
|
|
displayName: Build Host Protoc
|
|
|
|
- template: download-deps.yml
|
|
|
|
- task: PythonScript@0
|
|
displayName: 'Update deps.txt'
|
|
inputs:
|
|
scriptPath: $(Build.SourcesDirectory)/tools/ci_build/replace_urls_in_deps.py
|
|
arguments: --new_dir $(Build.BinariesDirectory)/deps
|
|
workingDirectory: $(Build.BinariesDirectory)
|
|
|
|
- script: |
|
|
set -e -x
|
|
python3 tools/ci_build/github/apple/build_apple_framework.py \
|
|
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
|
|
--path_to_protoc_exe $(Build.BinariesDirectory)/protobuf_install/bin/protoc \
|
|
tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
|
|
mkdir $(Build.BinariesDirectory)/artifacts
|
|
mkdir -p $(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
|
cp -R $(Build.BinariesDirectory)/ios_framework/framework_out/onnxruntime.xcframework \
|
|
$(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
|
pushd $(Build.BinariesDirectory)/artifacts_staging
|
|
zip -vr $(Build.BinariesDirectory)/artifacts/onnxruntime_xcframework.zip \
|
|
onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
|
popd
|
|
displayName: "Build Apple xcframework"
|
|
|
|
- script: |
|
|
python3 tools/ci_build/github/apple/test_apple_packages.py \
|
|
--fail_if_cocoapods_missing \
|
|
--framework_info_file "$(Build.BinariesDirectory)/ios_framework/xcframework_info.json" \
|
|
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" \
|
|
--variant Full \
|
|
--skip_macos_test \
|
|
--mac_catalyst_enabled
|
|
displayName: "Test Apple framework"
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
inputs:
|
|
pathtoPublish: '$(Build.BinariesDirectory)/artifacts'
|
|
artifactName: 'onnxruntime-ios-full-xcframework'
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters:
|
|
condition: 'succeeded'
|
|
|
|
- template: win-ci.yml
|
|
parameters:
|
|
DoCompliance: ${{ parameters.DoCompliance }}
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
stage_name_suffix: CPU_x86_${{ parameters.BuildVariant }}
|
|
buildArch: x86
|
|
msbuildPlatform: Win32
|
|
packageName: x86
|
|
buildparameter: ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}}
|
|
runTests: ${{ parameters.RunOnnxRuntimeTests }}
|
|
buildJava: false
|
|
buildNodejs: false
|
|
|
|
- template: win-ci.yml
|
|
parameters:
|
|
DoCompliance: ${{ parameters.DoCompliance }}
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
stage_name_suffix: CPU_arm64_${{ parameters.BuildVariant }}
|
|
buildArch: x64
|
|
msbuildPlatform: arm64
|
|
packageName: arm64
|
|
buildparameter: --build_nodejs --arm64 ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}} --path_to_protoc_exe $(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe
|
|
runTests: false
|
|
buildJava: false
|
|
buildNodejs: true
|
|
|
|
- template: win-ci.yml
|
|
parameters:
|
|
DoCompliance: ${{ parameters.DoCompliance }}
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
stage_name_suffix: CPU_x64_${{ parameters.BuildVariant }}
|
|
buildArch: x64
|
|
msbuildPlatform: x64
|
|
packageName: x64
|
|
buildparameter: --build_java --build_nodejs ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}}
|
|
runTests: ${{ parameters.RunOnnxRuntimeTests }}
|
|
buildJava: true
|
|
buildNodejs: true
|
|
|
|
- stage: Jar_Packaging
|
|
dependsOn:
|
|
- Linux_C_API_Packaging_CPU
|
|
- MacOS_C_API_Package_Publish
|
|
- Windows_Packaging_CPU_x64_${{ parameters.BuildVariant }}
|
|
- Download_Java_Tools
|
|
condition: succeeded()
|
|
jobs:
|
|
- job:
|
|
workspace:
|
|
clean: all
|
|
pool: 'onnxruntime-Win-CPU-2022'
|
|
|
|
steps:
|
|
- checkout: self
|
|
submodules: false
|
|
- template: set-version-number-variables-step.yml
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - Win x64'
|
|
ArtifactName: 'drop-onnxruntime-java-win-x64'
|
|
TargetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - Linux x64'
|
|
ArtifactName: 'drop-onnxruntime-java-linux-x64'
|
|
TargetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - Linux AARCH64'
|
|
ArtifactName: 'drop-onnxruntime-java-linux-aarch64'
|
|
TargetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-aarch64'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - MacOS x64'
|
|
ArtifactName: 'drop-onnxruntime-java-osx-x86_64'
|
|
TargetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-x86_64'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - MacOS ARM64'
|
|
ArtifactName: 'drop-onnxruntime-java-osx-arm64'
|
|
TargetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-arm64'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'PowerShell Script'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: $(Build.SourcesDirectory)\tools\ci_build\github\windows\jar_packaging.ps1
|
|
failOnStderr: true
|
|
showWarnings: true
|
|
workingDirectory: '$(Build.BinariesDirectory)\java-artifact'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Java Files to Artifact Staging Directory'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: 'Publish Pipeline Artifact'
|
|
inputs:
|
|
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
artifact: 'onnxruntime-java'
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|
|
|
|
- stage: NuGet_Packaging_CPU
|
|
dependsOn:
|
|
- Setup
|
|
- Linux_C_API_Packaging_CPU
|
|
- MacOS_C_API_Package_Publish
|
|
- Windows_Packaging_CPU_x86_${{ parameters.BuildVariant }}
|
|
- Windows_Packaging_CPU_x64_${{ parameters.BuildVariant }}
|
|
- Windows_Packaging_CPU_arm64_${{ parameters.BuildVariant }}
|
|
- Android_Java_API_AAR_Packaging_Full
|
|
- iOS_Full_xcframework
|
|
condition: succeeded()
|
|
jobs:
|
|
- job:
|
|
workspace:
|
|
clean: all
|
|
pool: 'onnxruntime-Win-CPU-2022'
|
|
variables:
|
|
OrtPackageId: ${{ parameters.OrtNugetPackageId }}
|
|
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
|
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
|
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Pipeline Artifact - Win x64'
|
|
ArtifactName: 'onnxruntime-win-x64'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download win-x86 Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-win-x86'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download win-arm64 Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-win-arm64'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download osx-x64 Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-osx'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download linux-x64 Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-linux-x64'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download linux-aarch64 Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-linux-aarch64'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download iOS Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-ios-full-xcframework'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download Android-full-aar Pipeline Artifact'
|
|
ArtifactName: 'onnxruntime-android-full-aar'
|
|
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: flex-downloadPipelineArtifact.yml
|
|
parameters:
|
|
StepName: 'Download drop-extra Pipeline Artifact'
|
|
ArtifactName: 'drop-extra'
|
|
TargetPath: '$(Build.BinariesDirectory)/extra-artifact'
|
|
SpecificArtifact: ${{ parameters.specificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- script: |
|
|
dir
|
|
workingDirectory: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
displayName: 'List artifacts'
|
|
|
|
# Reconstruct the build dir
|
|
- task: PowerShell@2
|
|
displayName: 'Extract native libraries for addition to nuget native package'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: $(Build.SourcesDirectory)\tools\ci_build\github\windows\extract_nuget_files.ps1
|
|
|
|
- script: |
|
|
mklink /D /J models C:\local\models
|
|
workingDirectory: '$(Build.BinariesDirectory)'
|
|
displayName: 'Create models link'
|
|
- task: NuGetToolInstaller@0
|
|
displayName: Use Nuget 6.2.1
|
|
inputs:
|
|
versionSpec: 6.2.1
|
|
|
|
- task: PowerShell@2
|
|
displayName: Install mobile workloads
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
dotnet workload install android ios
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Restore NuGet Packages and create project.assets.json'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
|
platform: 'Any CPU'
|
|
configuration: RelWithDebInfo
|
|
msbuildArguments: '-t:restore -p:OrtPackageId=$(OrtPackageId)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Build C# bindings'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
|
platform: 'Any CPU'
|
|
configuration: RelWithDebInfo
|
|
msbuildArguments: '-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- ${{ if eq(parameters.DoEsrp, true) }}:
|
|
- template: win-esrp-dll.yml
|
|
parameters:
|
|
FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
|
DisplayName: 'ESRP - Sign C# dlls'
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Build Nuget Packages'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
|
|
platform: 'Any CPU'
|
|
configuration: RelWithDebInfo
|
|
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy native nuget package to: $(Build.ArtifactStagingDirectory)'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
|
Contents: '*.nupkg'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy native nuget symbols package to: $(Build.ArtifactStagingDirectory)'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
|
Contents: '*.snupkg'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy managed nuget package to: $(Build.ArtifactStagingDirectory)'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
|
|
Contents: '*.nupkg'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- template: esrp_nuget.yml
|
|
parameters:
|
|
DisplayName: 'ESRP - sign NuGet package'
|
|
FolderPath: '$(Build.ArtifactStagingDirectory)'
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
|
|
- template: validate-package.yml
|
|
parameters:
|
|
PackageType: 'nuget'
|
|
PackagePath: '$(Build.ArtifactStagingDirectory)'
|
|
PackageName: 'Microsoft.ML.OnnxRuntime.*nupkg'
|
|
PlatformsSupported: 'win-x64,win-x86,linux-x64,linux-arm64,osx-x64'
|
|
VerifyNugetSigning: false
|
|
|
|
- task: PublishPipelineArtifact@0
|
|
displayName: 'Publish Pipeline NuGet Artifact'
|
|
inputs:
|
|
artifactName: 'drop-signed-nuget-CPU'
|
|
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Clean C#'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
|
platform: 'Any CPU'
|
|
configuration: RelWithDebInfo
|
|
msbuildArguments: '-t:Clean -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: RoslynAnalyzers@2
|
|
displayName: 'Run Roslyn Analyzers'
|
|
inputs:
|
|
userProvideBuildInfo: msBuildInfo
|
|
msBuildCommandline: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe" $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln -p:configuration="RelWithDebInfo" -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId)'
|
|
condition: and(succeeded(), eq('${{ parameters.DoCompliance }}', true))
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|
|
|
|
- stage: Nodejs_Packaging
|
|
dependsOn:
|
|
- Windows_CI_GPU_DML_Dev
|
|
- Windows_CI_GPU_DML_Dev_arm64
|
|
- Linux_C_API_Packaging_CPU
|
|
- Linux_C_API_Packaging_GPU_TensorRT_x64
|
|
- MacOS_C_API_Package_Publish
|
|
condition: succeeded()
|
|
jobs:
|
|
- job:
|
|
workspace:
|
|
clean: all
|
|
pool: 'onnxruntime-Win-CPU-2022'
|
|
variables:
|
|
${{ if eq(parameters.IsReleaseBuild, true) }}:
|
|
NpmPackagingMode: 'release'
|
|
${{ if not(eq(parameters.IsReleaseBuild, true)) }}:
|
|
NpmPackagingMode: 'dev'
|
|
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
|
|
|
steps:
|
|
- checkout: self
|
|
submodules: true
|
|
|
|
- script: |
|
|
echo.>>.gitattributes
|
|
echo /js/** text=auto eol=lf>>.gitattributes
|
|
rd /s /q js
|
|
git checkout -- js/**
|
|
git checkout -- .gitattributes
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'Testing: force EOL to lf on windows for /js/**'
|
|
|
|
##################################################################
|
|
# Node.js binding artifacts preparation
|
|
#
|
|
# This stage prepares Node.js binding artifacts for publishing. The artifacts support the following platforms:
|
|
# - Windows x64 with DML support
|
|
# - Windows arm64 with DML support
|
|
# - Linux x64 with TensorRT support
|
|
# - Linux arm64 (CPU only)
|
|
# - macOS x64 (CPU only)
|
|
# - macOS arm64 (CPU only)
|
|
#
|
|
# ORT Node.js binding artifacts contain 2 parts:
|
|
# 1. ONNX Runtime native shared libraries and their dependencies
|
|
# - Windows (x64, arm64):
|
|
# - onnxruntime.dll
|
|
# - DirectML.dll
|
|
# - Linux (x64, arm64):
|
|
# - libonnxruntime.so{.version}
|
|
# - libonnxruntime_providers_shared.so
|
|
# - libonnxruntime_providers_{provider}.so
|
|
# - macOS (x64, arm64):
|
|
# - libonnxruntime.dylib
|
|
# 2. ONNX Runtime Node.js binding
|
|
# - onnxruntime_binding.node
|
|
#
|
|
# For windows platform, the artifact is named as 'onnxruntime-nodejs-win-x64-dml' for x64, and
|
|
# 'onnxruntime-nodejs-win-arm64-dml' for arm64. Each artifact contains both (1) and (2).
|
|
#
|
|
# For Linux and macOS platforms, (1) and (2) are packed into separate artifacts.
|
|
# The following artifacts contain (1):
|
|
# - onnxruntime-osx
|
|
# - onnxruntime-linux-x64-tensorrt
|
|
# - onnxruntime-linux-aarch64
|
|
# The following artifacts contain (2):
|
|
# - drop-onnxruntime-nodejs-linux-x64-tensorrt
|
|
# - drop-onnxruntime-nodejs-linux-aarch64
|
|
# - drop-onnxruntime-nodejs-osx-x86_64
|
|
# - drop-onnxruntime-nodejs-osx-arm64
|
|
#
|
|
# All binary artifacts will eventually be put into folder before packaging 'onnxruntime-node':
|
|
# $(Build.SourcesDirectory)\js\node\bin\napi-v3\{os}\{cpu_arch}\
|
|
#
|
|
# {os} is one of 'win32', 'darwin', 'linux' and {cpu_arch} is one of 'x64', 'arm64'.
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - NuGet (OSX)'
|
|
inputs:
|
|
artifactName: 'onnxruntime-osx'
|
|
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - NuGet (Linux x64)'
|
|
inputs:
|
|
artifactName: 'onnxruntime-linux-x64-tensorrt'
|
|
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - NuGet (Linux aarch64)'
|
|
inputs:
|
|
artifactName: 'onnxruntime-linux-aarch64'
|
|
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (Win x64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-win-x64-dml'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/win32/x64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (Win ARM64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-win-arm64-dml'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/win32/arm64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (macOS x86_64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-osx-x86_64'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/darwin/x64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (macOS arm64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-osx-arm64'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/darwin/arm64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (Linux x64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-linux-x64-tensorrt'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/linux/x64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - Nodejs (Linux aarch64)'
|
|
inputs:
|
|
artifactName: 'drop-onnxruntime-nodejs-linux-aarch64'
|
|
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/linux/arm64/'
|
|
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact - NuGet'
|
|
inputs:
|
|
artifactName: 'drop-extra'
|
|
targetPath: '$(Build.BinariesDirectory)/extra-artifact'
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'PowerShell Script'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: $(Build.SourcesDirectory)\tools\ci_build\github\windows\extract_nuget_files.ps1
|
|
|
|
- script: |
|
|
dir
|
|
workingDirectory: '$(Build.BinariesDirectory)/nuget-artifact'
|
|
displayName: 'List artifacts'
|
|
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)/js'
|
|
displayName: 'Install NPM packages /js'
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)/js/common'
|
|
displayName: 'Install NPM packages /js/common'
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)/js/node'
|
|
displayName: 'Install NPM packages /js/node'
|
|
|
|
# Node.js binding win32/x64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\win32\x64'
|
|
Contents: |
|
|
*.dll
|
|
*.node
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64'
|
|
|
|
# Node.js binding win32/arm64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\win32\arm64'
|
|
Contents: |
|
|
*.dll
|
|
*.node
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64'
|
|
|
|
# Node.js binding linux/x64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt\lib'
|
|
Contents: |
|
|
libonnxruntime.so.*
|
|
libonnxruntime_providers_shared.so
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64'
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\linux\x64'
|
|
Contents: '*.node'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64'
|
|
|
|
# Node.js binding linux/arm64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\arm64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-aarch64\lib'
|
|
Contents: 'libonnxruntime.so.*'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\arm64'
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\arm64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\linux\arm64'
|
|
Contents: '*.node'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\arm64'
|
|
|
|
# Node.js binding darwin/x64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\x64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-osx-x86_64\lib'
|
|
Contents: 'libonnxruntime.*.dylib'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\x64'
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\x64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\darwin\x64'
|
|
Contents: '*.node'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\x64'
|
|
|
|
# Node.js binding darwin/arm64
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\arm64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-osx-arm64\lib'
|
|
Contents: 'libonnxruntime.*.dylib'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\arm64'
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\arm64\'
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\darwin\arm64'
|
|
Contents: '*.node'
|
|
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\darwin\arm64'
|
|
|
|
- task: PowerShell@2
|
|
inputs:
|
|
filePath: '$(Build.SourcesDirectory)\tools\ci_build\github\js\pack-npm-packages.ps1'
|
|
arguments: '$(NpmPackagingMode) $(Build.SourcesDirectory) node'
|
|
workingDirectory: $(Build.BinariesDirectory)
|
|
errorActionPreference: stop
|
|
displayName: 'Pack NPM packages'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy onnxruntime-common package to staging directory'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)/js/common/'
|
|
Contents: 'onnxruntime-common-*.tgz'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy onnxruntime-node package to staging directory'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)/js/node/'
|
|
Contents: 'onnxruntime-node-*.tgz'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: PublishPipelineArtifact@0
|
|
displayName: 'Publish NPM packages files'
|
|
inputs:
|
|
artifactName: 'NPM_packages'
|
|
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|
|
|
|
- template: ../nuget/templates/test_win.yml
|
|
parameters:
|
|
AgentPool : 'onnxruntime-Win-CPU-2022'
|
|
Skipx86Tests : false
|
|
NugetPackageName : 'Microsoft.ML.OnnxRuntime'
|
|
ArtifactSuffix: 'CPU'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: ../nuget/templates/test_linux.yml
|
|
parameters:
|
|
AgentPool : onnxruntime-Ubuntu2204-AMD-CPU
|
|
NugetPackageName : 'Microsoft.ML.OnnxRuntime'
|
|
ArtifactSuffix: 'CPU'
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
BuildId: ${{ parameters.BuildId }}
|
|
|
|
- template: ../nuget/templates/test_macos.yml
|
|
parameters:
|
|
AgentPool : macOS-latest
|
|
ArtifactSuffix: 'CPU'
|
|
|
|
- template: ../nodejs/templates/test_win.yml
|
|
parameters:
|
|
AgentPool : 'onnxruntime-Win-CPU-2022'
|
|
StageSuffix : 'Win_CPU_x64'
|
|
|
|
- template: ../nodejs/templates/test_linux.yml
|
|
parameters:
|
|
AgentPool : 'Azure-Pipelines-EO-Ubuntu-2004-aiinfra'
|
|
StageSuffix : 'Linux_CPU_x64'
|
|
|
|
- template: ../nodejs/templates/test_macos.yml
|
|
parameters:
|
|
StageSuffix : 'macOS_CPU_x64'
|
|
|
|
- template: final-jar-testing.yml
|
|
parameters:
|
|
OS: Windows
|
|
BuildId: ${{ parameters.BuildId }}
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
PoolName: 'onnxruntime-Win-CPU-2022'
|
|
|
|
- template: final-jar-testing.yml
|
|
parameters:
|
|
OS: Linux
|
|
BuildId: ${{ parameters.BuildId }}
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
PoolName: 'onnxruntime-Ubuntu2204-AMD-CPU'
|
|
|
|
- template: final-jar-testing.yml
|
|
parameters:
|
|
OS: MacOS
|
|
BuildId: ${{ parameters.BuildId }}
|
|
SpecificArtifact: ${{ parameters.SpecificArtifact }}
|
|
PoolName: 'macOS-latest'
|