onnxruntime/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml
Sheil Kumar a475f2824d
Create the Nuget WindowsAI Pipeline (#3684)
* add windowsai.yml for new Microsoft.AI.MachineLearning nuget

* temporarily add windowsai.yml to gpu.yml

* pass in build arch

* remove install onnx task

* no dml for arm or arm64

* refactor nuget pipeline defs

* update package creation

* pass in build and sources path

* missing hyphens

* copy license file

* fix parameter variable

* disable arm builds for now

* remove commented script block

* download pipeline atifcat name update

* set working dir

* Add bundling nuget script

* path combine

* null path

* combine needs parentheses

* binplace microsoft.* dlls in new nuget package

* update artifact name

* move merged nuget to artifacts directory

* move to merged subfolder in artifacts staging dir

* forward slash to back

* enable arm

* vcvarsall needs x64 vars setup

* Run Tests

* fix tests

* move global variables

* update yml to not have global variable in template

* removed parameters

* fixes

* Add build arch as an env variable

* ne not neq

* %Var% for batch script

* dont pass argument for x64

* disable arm tests

* skip csharp/cxx tests for microsoft nuget package

* remove test-win as it tests only c# cxx and capi

* test build for store apps

* dont build for store

* tools/nuget/generate_nuspec_for_native_nuget.py

* remove args.

* add new props and targets for microsoft.ai

* make windowsai props/targets static

* add dependency

* dont ship dot net props

* Remove c# fom windowsai nuget

* copy license file

* native packages must have win10 as the platform, not win

* cuda header in wrong if branch

* no dml for arm builds

* only build dml for x64/ x86

* User/sheilk/props update (#3616)

* prelim store work

* props

* Fix desktop nuget props/targets

* clean up targets and make store apps work

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>

* update windowsai.yml with latest

* remove extra dloadhelpers

* Add abi headers to abi dir, and reference native includes

* update windowsai.yml

* minor update

* remove parameters

* add doesrp param

* hard code esrp to true

* add directml for x86/x64

* revert gpu yml changes

* add store builds

* add store builds

* add checks again in old way

* dup job names for store and desktop builds

* move all of the runtime binaries to win10 folder

* only set safeseh on x86

* disable the store builds for now... missing msvcprt.lib

* copy paste deletion...

* switch back to win- (#3646)

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>

* use stahlworks

* & not supported in ado

* add cuda to cpu nuget(???) and EnableDelayedExpansion to enable x86 dml package

* revert nocontribops

* add underscore...

* extra win/win10 change

* merged nuget... still not being bundled...

* files in merged directory

* missing parens causing dml to be included in cpu package

* more diagnostic info

* switch dir to get-childitem

* wait for compression to complete

* add winml_adapter to mkml and gpu packages

* enable_wcos

* add mklml binaries

* props and targets missing from mklml

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
2020-04-24 20:20:04 -07:00

236 lines
10 KiB
YAML

jobs:
- job: WindowsAI_DirectML_X64
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-GPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'x64'
- job: WindowsAI_DirectML_X86
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-GPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'x86'
- job: WindowsAI_CPU_ARM64
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-CPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'arm64'
- job: WindowsAI_CPU_ARM
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-CPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'arm'
- ${{ if eq('false', 'true') }}:
- job: WindowsAI_DirectML_X64_Store
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-GPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'x64'
BuildForStore: 'true'
- job: WindowsAI_DirectML_X86_Store
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-GPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'x86'
BuildForStore: 'true'
- job: WindowsAI_CPU_ARM64_Store
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-CPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'arm64'
BuildForStore: 'true'
- job: WindowsAI_CPU_ARM_Store
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: 'Win-CPU-2019'
demands: []
steps:
- template: ../../templates/windowsai-nuget-build.yml
parameters:
BuildArch: 'arm'
BuildForStore: 'true'
- job: NuGet_Packaging
workspace:
clean: all
pool: 'Win-GPU-2019'
dependsOn:
- WindowsAI_DirectML_X64
- WindowsAI_DirectML_X86
- WindowsAI_CPU_ARM64
- WindowsAI_CPU_ARM
condition: succeeded()
steps:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet DirectML x64'
inputs:
artifactName: 'Microsoft.AI.MachineLearning.x64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x64'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet DirectML x86'
inputs:
artifactName: 'Microsoft.AI.MachineLearning.x86'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x86'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet CPU ARM64'
inputs:
artifactName: 'Microsoft.AI.MachineLearning.arm64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm64'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet CPU ARM'
inputs:
artifactName: 'Microsoft.AI.MachineLearning.arm'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm'
- task: PowerShell@2
displayName: 'Bundle NuGet and other binaries'
inputs:
targetType: 'inline'
script: |
Add-Type -AssemblyName "System.IO.Compression.FileSystem"
$packages = (Get-ChildItem -Filter Microsoft.AI.MachineLearning* -Recurse)
$x64_nuget_package_name = $packages[0].Name
$x64_nuget_package = $packages[0].FullName
$x64_unzipped_directory_root = $packages[0].Directory.FullName
$x64_unzipped_directory = [System.IO.Path]::Combine($x64_unzipped_directory_root, [System.IO.Path]::GetFileNameWithoutExtension($x64_nuget_package))
[System.IO.Compression.ZipFile]::ExtractToDirectory($x64_nuget_package, $x64_unzipped_directory)
$packages = (Get-ChildItem ..\nuget-artifact-x86 -Filter Microsoft.AI.MachineLearning* -Recurse)
$x86_nuget_package = $packages[0].FullName
$x86_unzipped_directory_root = $packages[0].Directory.FullName
$x86_unzipped_directory = [System.IO.Path]::Combine($x86_unzipped_directory_root, [System.IO.Path]::GetFileNameWithoutExtension($x86_nuget_package))
[System.IO.Compression.ZipFile]::ExtractToDirectory($x86_nuget_package, $x86_unzipped_directory)
$packages = (Get-ChildItem ..\nuget-artifact-arm64 -Filter Microsoft.AI.MachineLearning* -Recurse)
$arm64_nuget_package = $packages[0].FullName
$arm64_unzipped_directory_root = $packages[0].Directory.FullName
$arm64_unzipped_directory = [System.IO.Path]::Combine($arm64_unzipped_directory_root, [System.IO.Path]::GetFileNameWithoutExtension($arm64_nuget_package))
[System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_nuget_package, $arm64_unzipped_directory)
$packages = (Get-ChildItem ..\nuget-artifact-arm -Filter Microsoft.AI.MachineLearning* -Recurse)
$arm_nuget_package = $packages[0].FullName
$arm_unzipped_directory_root = $packages[0].Directory.FullName
$arm_unzipped_directory = [System.IO.Path]::Combine($arm_unzipped_directory_root, [System.IO.Path]::GetFileNameWithoutExtension($arm_nuget_package))
[System.IO.Compression.ZipFile]::ExtractToDirectory($arm_nuget_package, $arm_unzipped_directory)
$x86_runtime_path_old = [System.IO.Path]::Combine($x86_unzipped_directory, 'runtimes', 'win-x86', 'native')
$x86_runtime_path_new = [System.IO.Path]::Combine($x64_unzipped_directory, 'runtimes', 'win-x86', 'native')
$arm64_runtime_path_old = [System.IO.Path]::Combine($arm64_unzipped_directory, 'runtimes', 'win-arm64', 'native')
$arm64_runtime_path_new = [System.IO.Path]::Combine($x64_unzipped_directory, 'runtimes', 'win-arm64', 'native')
$arm_runtime_path_old = [System.IO.Path]::Combine($arm_unzipped_directory, 'runtimes', 'win-arm', 'native')
$arm_runtime_path_new = [System.IO.Path]::Combine($x64_unzipped_directory, 'runtimes', 'win-arm', 'native')
New-Item -Path $x86_runtime_path_new -ItemType Directory
New-Item -Path $arm64_runtime_path_new -ItemType Directory
New-Item -Path $arm_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, 'onnxruntime.pdb')) $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($x86_runtime_path_old, 'microsoft.ai.machinelearning.pdb')) $x86_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'directml.dll')) $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, 'onnxruntime.pdb')) $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($arm64_runtime_path_old, 'microsoft.ai.machinelearning.pdb')) $arm64_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'onnxruntime.dll')) $arm_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'onnxruntime.lib')) $arm_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'onnxruntime.pdb')) $arm_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'microsoft.ai.machinelearning.dll')) $arm_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'microsoft.ai.machinelearning.lib')) $arm_runtime_path_new
Copy-Item ([System.IO.Path]::Combine($arm_runtime_path_old, 'microsoft.ai.machinelearning.pdb')) $arm_runtime_path_new
$merged_nuget_path = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'merged')
New-Item -Path $merged_nuget_path -ItemType Directory
$merged_nuget = [System.IO.Path]::Combine($merged_nuget_path, $x64_nuget_package_name)
$zip_tool_directory = [System.IO.Path]::Combine($x64_unzipped_directory_root, 'ziptool')
New-Item -Path $zip_tool_directory -ItemType Directory
$zip_tool = [System.IO.Path]::Combine($zip_tool_directory, 'zip.exe')
Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile $zip_tool
Start-Process -FilePath $zip_tool -ArgumentList "-r $merged_nuget ." -WorkingDirectory $x64_unzipped_directory -NoNewWindow -Wait
workingDirectory: $(Build.BinariesDirectory)\nuget-artifact-x64
- template: ../../templates/esrp_nuget.yml
parameters:
DisplayName: 'ESRP - sign NuGet package'
FolderPath: '$(Build.ArtifactStagingDirectory)/merged'
DoEsrp: 'true'
- template: ../../templates/validate-nuget.yml
parameters:
NugetPath: '$(Build.ArtifactStagingDirectory)\merged'
NugetPackage: 'Microsoft.AI.MachineLearning*nupkg'
PlatformsSupported: 'win-x64,win-x86,win-arm64,win-arm'
VerifyNugetSigning: 'true'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline NuGet Artifact'
inputs:
artifactName: 'drop-signed-nuget'
targetPath: '$(Build.ArtifactStagingDirectory)/merged'