mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
1. Upgrade nodejs from 16.x to 18.x for Windows pipelines 2. Avoid using Azure DevOps "NodeTool" on Linux. The tool installs nodejs from internet or local disk cache. But we already moved all Linux tests to docker. So we do not need the installer anymore. 3. Remove some other unused code.
287 lines
12 KiB
YAML
287 lines
12 KiB
YAML
parameters:
|
|
- 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: EnvSetupScript
|
|
type: string
|
|
|
|
- name: buildArch
|
|
type: string
|
|
|
|
- name: msbuildPlatform
|
|
type: string
|
|
|
|
- name: packageName
|
|
displayName: Package name for nuget
|
|
type: string
|
|
|
|
- name: buildparameter
|
|
displayName: Additional build commandline parameter
|
|
type: string
|
|
|
|
- name: runTests
|
|
type: boolean
|
|
default: true
|
|
|
|
- name: buildJava
|
|
type: boolean
|
|
default: true
|
|
|
|
- name: buildNodejs
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: stage_name_suffix
|
|
displayName: job name for nuget
|
|
type: string
|
|
default: ''
|
|
|
|
# for inference packages '', for training packages '-training'
|
|
# used for drop-extra and c api artifacts (onnxruntime-win-* or onnxrutime-training-win-*)
|
|
- name: artifact_name_suffix
|
|
type: string
|
|
default: ''
|
|
|
|
- name: ort_build_pool_name
|
|
type: string
|
|
default: 'onnxruntime-Win-CPU-2022'
|
|
|
|
#'onnxruntime' or 'onnxruntime_gpu'
|
|
- name: java_artifact_id
|
|
type: string
|
|
default: 'onnxruntime'
|
|
|
|
- name: UseIncreasedTimeoutForTests
|
|
displayName: Increase timeout for tests? Set it to false if you are doing an Onnx Runtime release.
|
|
type: boolean
|
|
default: false
|
|
|
|
stages:
|
|
- stage: Windows_Packaging_${{ parameters.stage_name_suffix }}
|
|
dependsOn: []
|
|
variables:
|
|
VSGenerator: 'Visual Studio 17 2022'
|
|
jobs:
|
|
- job:
|
|
workspace:
|
|
clean: all
|
|
pool: ${{ parameters.ort_build_pool_name }}
|
|
${{ if eq(parameters['UseIncreasedTimeoutForTests'], 'true') }}:
|
|
timeoutInMinutes: 1200
|
|
${{ else }}:
|
|
timeoutInMinutes: 300
|
|
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: none
|
|
|
|
- template: telemetry-steps.yml
|
|
|
|
- ${{ if eq(parameters['buildJava'], 'true') }}:
|
|
- task: JavaToolInstaller@0
|
|
inputs:
|
|
versionSpec: "11"
|
|
jdkArchitectureOption: ${{ parameters.buildArch }}
|
|
jdkSourceOption: 'PreInstalled'
|
|
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: '3.8'
|
|
addToPath: true
|
|
architecture: ${{ parameters.buildArch }}
|
|
|
|
- task: NodeTool@0
|
|
condition: and(succeeded(), eq('${{ parameters.buildNodejs}}', true))
|
|
inputs:
|
|
versionSpec: '18.x'
|
|
|
|
- template: jobs/set-winenv.yml
|
|
parameters:
|
|
EnvSetupScript: ${{ parameters.EnvSetupScript }}
|
|
${{ if contains(parameters.buildparameter, 'use_cuda') }}:
|
|
DownloadCUDA: true
|
|
|
|
- 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)
|
|
|
|
- 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 ${{ parameters.buildArch }} -install_prefix $(Build.BinariesDirectory)\RelWithDebInfo\installed -build_config RelWithDebInfo
|
|
|
|
- template: set-version-number-variables-step.yml
|
|
|
|
- task: PythonScript@0
|
|
displayName: 'Generate cmake config'
|
|
inputs:
|
|
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
|
${{ if eq(parameters['UseIncreasedTimeoutForTests'], 'true') }}:
|
|
arguments: '--config RelWithDebInfo --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} --test_all_timeout 72000'
|
|
${{ else }}:
|
|
arguments: '--config RelWithDebInfo --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} '
|
|
workingDirectory: '$(Build.BinariesDirectory)'
|
|
|
|
- task: VSBuild@1
|
|
displayName: 'Build'
|
|
inputs:
|
|
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
|
|
platform: ${{ parameters.msbuildPlatform }}
|
|
configuration: RelWithDebInfo
|
|
msbuildArchitecture: ${{ parameters.buildArch }}
|
|
maximumCpuCount: true
|
|
logProjectEvents: true
|
|
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
|
|
createLogFile: true
|
|
|
|
- task: PythonScript@0
|
|
displayName: 'test'
|
|
condition: and(succeeded(), eq('${{ parameters.runTests}}', true))
|
|
inputs:
|
|
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
|
arguments: '--config RelWithDebInfo --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }}'
|
|
workingDirectory: '$(Build.BinariesDirectory)'
|
|
|
|
- script: |
|
|
dir *.dll
|
|
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
|
workingDirectory: '$(Build.BinariesDirectory)/RelWithDebInfo/RelWithDebInfo'
|
|
displayName: 'List built DLLs'
|
|
|
|
- template: c-api-artifacts-package-and-publish-steps-windows.yml
|
|
parameters:
|
|
buildConfig: RelWithDebInfo
|
|
artifactName: 'onnxruntime${{ parameters.artifact_name_suffix }}-win-${{ parameters.packageName }}-$(OnnxRuntimeVersion)'
|
|
artifactNameNoVersionString: 'onnxruntime${{ parameters.artifact_name_suffix }}-win-${{ parameters.packageName }}'
|
|
commitId: $(OnnxRuntimeGitCommitHash)
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
|
|
- ${{ if eq(parameters.buildNodejs, true) }}:
|
|
- template: nodejs-artifacts-package-and-publish-steps-windows.yml
|
|
parameters:
|
|
arch: ${{ parameters.packageName }}
|
|
artifactName: 'drop-onnxruntime-nodejs-win-${{ parameters.packageName }}'
|
|
DoEsrp: ${{ parameters.DoEsrp }}
|
|
|
|
#Upload protoc.exe, which will be used in nuget build for generating C# files
|
|
- task: PublishPipelineArtifact@1
|
|
condition: and(succeeded(), eq('${{ parameters.packageName}}', 'x64'))
|
|
inputs:
|
|
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe'
|
|
artifactName: 'drop-extra${{ parameters.artifact_name_suffix }}'
|
|
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy custom_op_library to: $(Build.ArtifactStagingDirectory)'
|
|
condition: and(succeeded(), eq('${{ parameters.packageName}}', 'x64'))
|
|
inputs:
|
|
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
|
Contents: 'custom_op_library.dll'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)/testdata'
|
|
|
|
#To be used in test_win.yml
|
|
- task: PublishPipelineArtifact@1
|
|
condition: and(succeeded(), eq('${{ parameters.packageName}}', 'x64'))
|
|
inputs:
|
|
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe'
|
|
artifactName: 'drop-nuget${{ parameters.artifact_name_suffix }}'
|
|
|
|
- task: CmdLine@2
|
|
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
|
|
displayName: 'Add symbols and notices to Java'
|
|
inputs:
|
|
script: |
|
|
@echo on
|
|
cd $(Build.SourcesDirectory)\java
|
|
call $(Build.SourcesDirectory)\java\gradlew.bat cmakeCheck -DcmakeBuildDir=$(Build.BinariesDirectory)\RelWithDebInfo
|
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
|
cd $(Build.BinariesDirectory)\RelWithDebInfo
|
|
set NATIVE_FOLDER=$(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ai\onnxruntime\native\win-x64
|
|
mkdir %NATIVE_FOLDER%
|
|
echo "Directories created"
|
|
copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
|
|
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
|
|
set artifact_id=${{ parameters.java_artifact_id }}
|
|
jar xf onnxruntime-$(OnnxRuntimeVersion).jar META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml
|
|
move META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml onnxruntime-$(OnnxRuntimeVersion).pom
|
|
rd /s /q META-INF
|
|
popd
|
|
copy .\RelWithDebInfo\onnxruntime.pdb %NATIVE_FOLDER%
|
|
copy .\RelWithDebInfo\onnxruntime4j_jni.pdb %NATIVE_FOLDER%
|
|
copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\Privacy.md
|
|
copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ThirdPartyNotices.txt
|
|
@echo $(OnnxRuntimeGitCommitHash) > $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\GIT_COMMIT_ID
|
|
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
|
|
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime.pdb
|
|
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb
|
|
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID
|
|
popd
|
|
pushd $(Build.SourcesDirectory)\java\build\classes\java\test
|
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
|
jar cvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
|
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
|
popd
|
|
pushd $(Build.SourcesDirectory)\java\build\resources\test
|
|
rd /s /q ai\onnxruntime\native
|
|
jar uvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
|
|
popd
|
|
rd /s /q $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
|
|
dir /s /b $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
|
|
displayName: 'Publish Java temp binaries'
|
|
inputs:
|
|
pathtoPublish: '$(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}'
|
|
artifactName: 'drop-onnxruntime-java-win-${{ parameters.packageName }}'
|
|
|
|
- ${{ if eq(parameters['DoCompliance'], 'true') }}:
|
|
- task: CredScan@3
|
|
displayName: 'Run CredScan'
|
|
inputs:
|
|
debugMode: false
|
|
continueOnError: true
|
|
|
|
- task: BinSkim@4
|
|
displayName: 'Run BinSkim'
|
|
inputs:
|
|
AnalyzeTargetGlob: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\**\*.dll'
|
|
continueOnError: true
|
|
|
|
- task: PostAnalysis@2
|
|
inputs:
|
|
GdnBreakAllTools: false
|
|
GdnBreakGdnToolBinSkim: true
|
|
GdnBreakPolicy: M365
|
|
GdnBreakPolicyMinSev: Error
|
|
|
|
- task: TSAUpload@2
|
|
displayName: 'TSA upload'
|
|
condition: and (succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
|
inputs:
|
|
GdnPublishTsaOnboard: false
|
|
GdnPublishTsaConfigFile: '$(Build.sourcesDirectory)\.gdn\.gdntsa'
|
|
continueOnError: true
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|