microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/templates/build-package-for-windows.yml
109lines · modecode
| 1 | parameters: |
| 2 | - name: DoCompliance |
| 3 | displayName: Run Compliance Tasks? |
| 4 | type: boolean |
| 5 | default: true |
| 6 | |
| 7 | - name: DoEsrp |
| 8 | displayName: Run code sign tasks? Must be true if you are doing an OnnxRuntime extensions release. |
| 9 | type: boolean |
| 10 | default: false |
| 11 | |
| 12 | - name: BuildPlatform |
| 13 | type: string |
| 14 | values: |
| 15 | - 'x86' |
| 16 | - 'x64' |
| 17 | - 'arm64' |
| 18 | - 'arm' |
| 19 | |
| 20 | - name: StageNameSuffix |
| 21 | displayName: job name for nuget |
| 22 | type: string |
| 23 | default: '' |
| 24 | |
| 25 | - name: BuildPool |
| 26 | type: string |
| 27 | default: 'Win-CPU-2021' |
| 28 | |
| 29 | - name: AdditionalBuildFlags |
| 30 | displayName: Additional build flags for build_lib.bat |
| 31 | type: string |
| 32 | |
| 33 | |
| 34 | jobs: |
| 35 | - job: Windows_Packaging_${{ parameters.StageNameSuffix }} |
| 36 | workspace: |
| 37 | clean: all |
| 38 | pool: ${{ parameters.BuildPool }} |
| 39 | timeoutInMinutes: 300 |
| 40 | |
| 41 | steps: |
| 42 | - checkout: self |
| 43 | clean: true |
| 44 | submodules: none |
| 45 | |
| 46 | # Currently we can only run tests on x64. x86 tests faile. arm/arm64 tests can't be run as the build machine is amd64 |
| 47 | # TODO: Fix these issues so the nuget build is properly tested. |
| 48 | - ${{ if eq(parameters.BuildPlatform, 'x64') }}: |
| 49 | - task: BatchScript@1 |
| 50 | displayName: 'build onnxruntime-extensions and run tests' |
| 51 | inputs: |
| 52 | filename: '.\build_lib.bat' |
| 53 | arguments: '--${{parameters.BuildPlatform}} --build_dir $(Build.BinariesDirectory)/out --config RelWithDebInfo --cmake_generator "Visual Studio 16 2019" --enable_cxx_tests ${{parameters.AdditionalBuildFlags}}' |
| 54 | modifyEnvironment: true |
| 55 | workingFolder: $(Build.SourcesDirectory) |
| 56 | - ${{ else }}: |
| 57 | - task: BatchScript@1 |
| 58 | displayName: 'build onnxruntime-extensions' |
| 59 | inputs: |
| 60 | filename: '.\build_lib.bat' |
| 61 | arguments: '--${{parameters.BuildPlatform}} --build_dir $(Build.BinariesDirectory)/out --config RelWithDebInfo --cmake_generator "Visual Studio 16 2019" ${{parameters.AdditionalBuildFlags}}' |
| 62 | modifyEnvironment: true |
| 63 | workingFolder: $(Build.SourcesDirectory) |
| 64 | |
| 65 | - script: | |
| 66 | dir $(Build.BinariesDirectory)\out\RelWithDebInfo\lib\RelWithDebInfo |
| 67 | dir $(Build.BinariesDirectory)\out\RelWithDebInfo\bin\RelWithDebInfo |
| 68 | displayName: 'List built DLLs' |
| 69 | workingDirectory: $(Build.BinariesDirectory) |
| 70 | |
| 71 | - task: PowerShell@2 |
| 72 | displayName: 'Set version' |
| 73 | inputs: |
| 74 | targetType: 'inline' |
| 75 | script: | |
| 76 | $_OrtExtVersion=(cat version.txt) |
| 77 | echo "##vso[task.setvariable variable=OrtExtVersion;]$_OrtExtVersion" |
| 78 | workingDirectory: '$(Build.SourcesDirectory)' |
| 79 | |
| 80 | - task: PowerShell@2 |
| 81 | displayName: 'Copy and Create artifacts' |
| 82 | inputs: |
| 83 | targetType: 'inline' |
| 84 | script: | |
| 85 | $target_lib_path="$(Build.BinariesDirectory)/onnxruntime-extensions-win-${{parameters.BuildPlatform}}-$(OrtExtVersion)/lib" |
| 86 | New-Item $target_lib_path -ItemType Directory |
| 87 | cp bin/RelWithDebInfo/ortextensions.* $target_lib_path |
| 88 | cp lib/RelWithDebInfo/ortextensions.* $target_lib_path |
| 89 | workingDirectory: '$(Build.BinariesDirectory)/out/RelWithDebInfo' |
| 90 | |
| 91 | - template: win-esrp-dll.yml |
| 92 | parameters: |
| 93 | FolderPath: '$(Build.BinariesDirectory)/onnxruntime-extensions-win-${{parameters.BuildPlatform}}-$(OrtExtVersion)' |
| 94 | DisplayName: 'Sign DLL' |
| 95 | DoEsrp: 'true' |
| 96 | |
| 97 | - task: ArchiveFiles@2 |
| 98 | inputs: |
| 99 | rootFolderOrFile: '$(Build.BinariesDirectory)/onnxruntime-extensions-win-${{parameters.BuildPlatform}}-$(OrtExtVersion)' |
| 100 | includeRootFolder: true |
| 101 | archiveType: 'tar' # Options: zip, 7z, tar, wim |
| 102 | tarCompression: 'gz' |
| 103 | archiveFile: '$(Build.ArtifactStagingDirectory)/onnxruntime-extensions-win-${{parameters.BuildPlatform}}.tgz' |
| 104 | replaceExistingArchive: true |
| 105 | |
| 106 | - task: PublishPipelineArtifact@1 |
| 107 | inputs: |
| 108 | targetPath: '$(Build.ArtifactStagingDirectory)' |
| 109 | artifactName: 'onnxruntime-extensions-win-${{parameters.BuildPlatform}}' |
| 110 | |