microsoft/onnxruntime-extensions

Public

mirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/support-python-3-14

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.pipelines/templates/build-package-for-linux.yml

114lines · modecode

1# This file contains the ADO job that build so-file on Linux
2parameters:
3- name: IsReleaseBuild
4 displayName: "Is this a release build?"
5 type: boolean
6 default: false
7
8- name: OrtExtensionsArch
9 type: string
10
11- name: PoolName
12 type: string
13 default: 'onnxruntime-Ubuntu2204-AMD-CPU'
14
15- name: OrtExtensionsCFlags
16 type: string
17
18- name: OrtExtensionsCXXFlags
19 type: string
20
21- name: AdditionalBuildFlags
22 displayName: Additional build flags for build_lib.sh
23 type: string
24
25jobs:
26- job: Linux_C_API_Packaging_CPU_${{parameters.OrtExtensionsArch}}
27
28 workspace:
29 clean: all
30 timeoutInMinutes: 210
31 pool: ${{parameters.PoolName}}
32 steps:
33 - checkout: self
34 clean: true
35 submodules: none
36
37 - bash: |
38 if [ "${{parameters.OrtExtensionsArch}}" == "x64" ]; then
39 sudo apt-get update
40 sudo apt-get install -y libssh-dev
41 else
42 sudo dnf update -y
43 sudo dnf install -y libssh-devel
44 fi
45 displayName: Install OpenSSL for Azure custom ops
46
47 # NOTE: on arm64 machine, CMake version needs to be updated since we now require CMake 3.28 or newer.
48 - ${{ if eq(parameters.OrtExtensionsArch, 'x64') }}:
49 - bash: |
50 export CFLAGS="${{parameters.OrtExtensionsCFlags}}"
51 export CXXFLAGS="${{parameters.OrtExtensionsCXXFlags}}"
52 ./build_lib.sh --build_dir $(Build.BinariesDirectory)/out/ --config RelWithDebInfo --parallel --enable_cxx_tests ${{parameters.AdditionalBuildFlags}}
53 workingDirectory: '$(Build.SourcesDirectory)'
54 displayName: 'build onnxruntime-extensions and run tests'
55 - ${{ else }}:
56 - bash: |
57 if ! dnf list installed cmake &>/dev/null; then
58 echo "CMake is not installed. Installing/upgrading cmake."
59 pip install cmake --upgrade
60 else
61 echo "CMake is already installed."
62 fi
63 export PATH=~/.local/bin:$PATH
64 cmake --version
65 export CFLAGS="${{parameters.OrtExtensionsCFlags}}"
66 export CXXFLAGS="${{parameters.OrtExtensionsCXXFlags}}"
67 ./build_lib.sh --build_dir $(Build.BinariesDirectory)/out/ --config RelWithDebInfo --parallel --enable_cxx_tests ${{parameters.AdditionalBuildFlags}}
68 workingDirectory: '$(Build.SourcesDirectory)'
69 displayName: 'build onnxruntime-extensions'
70
71 - template: set-package-version-variable-step.yml
72 parameters:
73 IsReleaseBuild: true
74 PackageVersionVariableName: ORT_EXTENSIONS_VERSION
75
76 - bash: |
77 set -e -x
78
79 lib_target=$(Build.BinariesDirectory)/onnxruntime-extensions-linux-${{parameters.OrtExtensionsArch}}-$(ORT_EXTENSIONS_VERSION)/lib
80 mkdir -p $lib_target
81
82 ls -l out/RelWithDebInfo/lib
83 cp out/RelWithDebInfo/lib/libortextensions.so $lib_target
84
85 cd $lib_target
86 objcopy --only-keep-debug libortextensions.so libortextensions.so.dbg
87 objcopy --strip-debug libortextensions.so
88 objcopy --add-gnu-debuglink=libortextensions.so.dbg libortextensions.so
89
90 displayName: create and copy artifacts.
91 workingDirectory: $(Build.BinariesDirectory)
92
93
94 - task: ArchiveFiles@2
95 inputs:
96 rootFolderOrFile: '$(Build.BinariesDirectory)/onnxruntime-extensions-linux-${{parameters.OrtExtensionsArch}}-$(ORT_EXTENSIONS_VERSION)'
97 includeRootFolder: true
98 archiveType: 'tar' # Options: zip, 7z, tar, wim
99 tarCompression: 'gz'
100 archiveFile: '$(Build.ArtifactStagingDirectory)/onnxruntime-extensions-linux-${{parameters.OrtExtensionsArch}}.tgz'
101 replaceExistingArchive: true
102
103 - task: PublishPipelineArtifact@1
104 inputs:
105 targetPath: '$(Build.ArtifactStagingDirectory)'
106 artifactName: 'onnxruntime-extensions-linux-${{parameters.OrtExtensionsArch}}'
107
108 - template: component-governance-component-detection-steps.yml
109 parameters :
110 condition : 'succeeded'
111
112 - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
113 displayName: 'Clean Agent Directories'
114 condition: always()
115