microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/nuget.yml
107lines · modecode
| 1 | stages: |
| 2 | - stage: NuGet_Packaging_CPU |
| 3 | dependsOn: |
| 4 | jobs: |
| 5 | - job: |
| 6 | workspace: |
| 7 | clean: all |
| 8 | # we need to use the 2022 pool to create the nuget package with both pre-net6+Xamarin and net6 targets. |
| 9 | # VS2019 has no support for net6 and we need to use msbuild (from the VS install) to do the packing |
| 10 | pool: 'Azure-Pipelines-EO-Windows2022-aiinfra' |
| 11 | variables: |
| 12 | OrtPackageId: 'Microsoft.ML.OnnxRuntime.Extensions' |
| 13 | breakCodesignValidationInjection: true |
| 14 | ort.version: '1.14.1' |
| 15 | |
| 16 | steps: |
| 17 | - checkout: self |
| 18 | submodules: true |
| 19 | - task: DownloadGitHubRelease@0 |
| 20 | inputs: |
| 21 | connection: 'microsoft' |
| 22 | userRepository: 'microsoft/onnxruntime' |
| 23 | defaultVersionType: 'specificTag' |
| 24 | version: 'v$(ort.version)' |
| 25 | itemPattern: '*-win-x64-$(ort.version)*' |
| 26 | downloadPath: '$(Build.SourcesDirectory)' |
| 27 | displayName: Download the ONNXRuntime prebuilt package. |
| 28 | |
| 29 | - task: ExtractFiles@1 |
| 30 | inputs: |
| 31 | archiveFilePatterns: '**/*.zip' |
| 32 | destinationFolder: '$(Build.SourcesDirectory)' |
| 33 | cleanDestinationFolder: false |
| 34 | overwriteExistingFiles: true |
| 35 | displayName: Unpack ONNXRuntime package. |
| 36 | |
| 37 | - script: | |
| 38 | @echo off |
| 39 | set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" |
| 40 | for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do ( |
| 41 | if exist "%%i\Common7\Tools\vsdevcmd.bat" ( |
| 42 | set vsdevcmd="%%i\Common7\Tools\vsdevcmd.bat" |
| 43 | ) |
| 44 | ) |
| 45 | |
| 46 | @echo %vsdevcmd% will be used as the VC compiler |
| 47 | @echo ##vso[task.setvariable variable=vsdevcmd]%vsdevcmd% |
| 48 | displayName: 'locate vsdevcmd via vswhere' |
| 49 | |
| 50 | # Build Extensions for Windows x64 - we will add more builds to the nuget pipeline in the future |
| 51 | - script: | |
| 52 | call $(vsdevcmd) |
| 53 | call .\build.bat -DOCOS_ENABLE_CTEST=ON -DONNXRUNTIME_PKG_DIR=.\onnxruntime-win-x64-$(ort.version) -DOCOS_ENABLE_BLINGFIRE=OFF |
| 54 | displayName: build the customop library with onnxruntime |
| 55 | |
| 56 | - script: | |
| 57 | cd out/Windows |
| 58 | ctest -C RelWithDebInfo --output-on-failure |
| 59 | displayName: Run C++ native tests |
| 60 | |
| 61 | # We need to sign twice: the first one happens before making the package, where we sign the DLLs. |
| 62 | # The second one is after making the package, where we sign the nuget package itself. |
| 63 | - template: templates/win-esrp-dll.yml |
| 64 | parameters: |
| 65 | FolderPath: '$(Build.SourcesDirectory)\out\Windows\bin\RelWithDebInfo' |
| 66 | DisplayName: 'Sign DLL' |
| 67 | DoEsrp: 'true' |
| 68 | |
| 69 | - task: PowerShell@2 |
| 70 | displayName: Replace commit id token in nuspec |
| 71 | inputs: |
| 72 | targetType: 'inline' |
| 73 | script: | |
| 74 | (Get-Content NativeNuget.nuspec) -replace 'COMMIT_ID', '$(Build.SourceVersion)' | Set-Content NativeNuget.nuspec |
| 75 | workingDirectory: '$(Build.SourcesDirectory)/nuget' |
| 76 | |
| 77 | - task: NuGetToolInstaller@0 |
| 78 | displayName: Use Nuget 6.2.1 |
| 79 | inputs: |
| 80 | versionSpec: 6.2.1 |
| 81 | |
| 82 | - task: NuGetCommand@2 |
| 83 | displayName: Pack nuget package with nuspec |
| 84 | inputs: |
| 85 | command: 'pack' |
| 86 | packagesToPack: '$(Build.SourcesDirectory)/nuget/NativeNuget.nuspec' |
| 87 | packDestination: '$(Build.ArtifactStagingDirectory)' |
| 88 | |
| 89 | - template: templates/esrp_nuget.yml |
| 90 | parameters: |
| 91 | DisplayName: 'ESRP - sign NuGet package' |
| 92 | FolderPath: '$(Build.ArtifactStagingDirectory)' |
| 93 | DoEsrp: 'true' |
| 94 | |
| 95 | - task: PublishPipelineArtifact@0 |
| 96 | displayName: 'Publish Pipeline NuGet Artifact' |
| 97 | inputs: |
| 98 | artifactName: 'drop-signed-nuget-CPU' |
| 99 | targetPath: '$(Build.ArtifactStagingDirectory)' |
| 100 | |
| 101 | - template: templates/component-governance-component-detection-steps.yml |
| 102 | parameters : |
| 103 | condition : 'succeeded' |
| 104 | |
| 105 | - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 |
| 106 | displayName: 'Clean Agent Directories' |
| 107 | condition: always() |