onnxruntime/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml
Yi Zhang 3f03c12986
Split Onnxruntime Nuget GPU package (#18819)
### Description
1. Update donwload-artifacts to flex-downloadartifacts to make it eaiser
to debug.
2. Move the native files into Gpu.Windows and Gpu-linux packages.
Onnxruntime-Gpu has dependency on them.
3. update the package validation as well
4. Add 2 stages to run E2E test for GPU.Windows and GPU.Linux
   for example:
   

![image](https://github.com/microsoft/onnxruntime/assets/16190118/35c6730b-8080-4f52-a17c-b9c61f41b6bb)



### Motivation and Context
Single Onnxruntime.Gpu Package size has already excceded the Nuget size
limit.
We split the package into some smaller packages to make them can be
published.

For compatibility, the user can install or upgrade Onnxruntime.Gpu,
which will install Gpu.Windows and Gpu.Linux automatically.
And the user can only install Gpu.Windows and Gpu.Linux directly. 

### Test Link
1. In ORT_NIGHTLY

2. Install the preview version in nuget-int. (nuget source:
https://apiint.nugettest.org/v3/index.json)

---------

Co-authored-by: Scott McKay <skottmckay@gmail.com>
2023-12-22 16:57:16 +08:00

125 lines
4.5 KiB
YAML

parameters:
AgentPool : 'Win-CPU'
NugetPackageName : ''
ArtifactSuffix: ''
StageSuffix: 'CPU'
# More Suffix is used to differentiate testing for GPU and GPU-Windows/GPU-Linux packages
MoreSuffix: ''
# For inference packages, the test data artifact name is drop-extra and no suffix is required.
# For training packages, to differentiate the artifact name we add '-training' suffix. This needs to be passed from
# the parent pipeline.
TestDataArtifactSuffix: ''
Skipx86Tests: 'false'
CudaVersion: ''
SpecificArtifact: false
BuildId: ''
stages:
- stage: NuGet_Test_Win_${{ parameters.StageSuffix }}${{ parameters.MoreSuffix }}
dependsOn:
- NuGet_Packaging_${{ parameters.StageSuffix }}
condition: succeeded()
jobs:
- job:
workspace:
clean: all
pool: ${{ parameters.AgentPool }}
variables:
- name: OnnxRuntimeBuildDirectory
value: '$(Build.BinariesDirectory)'
- name: SKIPNONPACKAGETESTS
value: 'ON'
- name: runCodesignValidationInjection
value: false
- name: CUDA_MODULE_LOADINGL
value: 'LAZY'
- name: GRADLE_OPTS
value: '-Dorg.gradle.daemon=false'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
addToPath: true
architecture: x64
- task: NuGetToolInstaller@0
displayName: Use Nuget 5.7.0
inputs:
versionSpec: 5.7.0
- ${{ if ne( parameters.CudaVersion, '') }}:
- template: ../../templates/jobs/download_win_gpu_library.yml
parameters:
DownloadCUDA: true
DownloadTRT: true
CudaVersion: ${{ parameters.CudaVersion }}
- task: BatchScript@1
displayName: 'Setup Visual Studio env vars'
inputs:
filename: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat'
arguments: 'amd64'
modifyEnvironment: true
- template: ../../templates/flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Pipeline Artifact'
ArtifactName: drop-signed-nuget-${{ parameters.ArtifactSuffix }}
TargetPath: '$(Build.BinariesDirectory)\nuget-artifact'
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
- template: get-nuget-package-version-as-variable.yml
parameters:
packageFolder: '$(Build.BinariesDirectory)\nuget-artifact'
- script: |
mklink /D /J models C:\local\models
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Create models link'
# TODO: Add .Net Core AnyCPU test task
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp5.0 x64 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .Net Core x64'
env:
PACKAGENAME: ${{ parameters.NugetPackageName }}
- ${{ if ne(parameters['Skipx86Tests'], 'true') }}:
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp5.0 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .Net Core x86'
env:
PACKAGENAME: ${{ parameters.NugetPackageName }}
# TODO: Add .Net Framework AnyCPU test task
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x64 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .NetFramework x64'
env:
PACKAGENAME: ${{ parameters.NugetPackageName }}
- ${{ if ne(parameters['Skipx86Tests'], 'true') }}:
- script: |
@echo "Running Runtest.bat"
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x86 $(NuGetPackageVersionNumber)
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Run End to End Test (C#) .NetFramework x86'
enabled: false
env:
PACKAGENAME: ${{ parameters.NugetPackageName }}
- template: ../../templates/component-governance-component-detection-steps.yml
parameters :
condition : 'always'
- template: ../../templates/clean-agent-build-directory-step.yml