microsoft/onnxruntime-extensions
Publicmirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/java_packaging.yml
184lines · modeblame
7b789ab5Sayan Shaw2 years ago | 1 | parameters: |
| 2 | - name: JavaPackagingandPublishing | |
| 3 | displayName: Package and Publish Java Package | |
| 4 | type: boolean | |
| 5 | default: true | |
| 6 | stages: | |
| 7 | - stage: Java_Packaging_and_Publishing | |
| 8 | jobs: | |
| 9 | | |
| 10 | - job: Windows_CPU_Java_Packaging | |
| 11 | workspace: | |
| 12 | clean: all | |
| 13 | pool: {name: 'onnxruntime-Win-CPU-2022'} | |
| 14 | | |
| 15 | steps: | |
23213299Sayan Shaw2 years ago | 16 | - task: PowerShell@2 |
| 17 | displayName: 'Set version' | |
| 18 | inputs: | |
| 19 | targetType: 'inline' | |
| 20 | script: | | |
| 21 | $_ExtVersion=(cat version.txt) | |
| 22 | echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion" | |
| 23 | workingDirectory: '$(Build.SourcesDirectory)' | |
| 24 | | |
7b789ab5Sayan Shaw2 years ago | 25 | - script: | |
| 26 | call .\build.bat -DOCOS_BUILD_JAVA=ON | |
| 27 | displayName: build the extensions java package | |
| 28 | | |
| 29 | - task: CopyFiles@2 | |
| 30 | displayName: 'Copy Java Files for Windows Arch to Artifact Staging Directory' | |
| 31 | inputs: | |
| 32 | SourceFolder: 'out\Windows\java\build\libs' | |
| 33 | TargetFolder: '$(Build.ArtifactStagingDirectory)' | |
| 34 | | |
2bf26008Sayan Shaw2 years ago | 35 | - script: | |
| 36 | cd $(Build.ArtifactStagingDirectory) | |
23213299Sayan Shaw2 years ago | 37 | jar xvf onnxruntime-extensions-$(OrtExtVersion).jar |
2bf26008Sayan Shaw2 years ago | 38 | tree $(Build.ArtifactStagingDirectory) /f |
| 39 | displayName: Unpack JAR to sign DLL | |
| 40 | | |
| 41 | - template: templates/win-esrp-dll.yml | |
| 42 | parameters: | |
| 43 | FolderPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/win-x64' | |
| 44 | DisplayName: 'Sign DLL' | |
| 45 | DoEsrp: 'true' | |
| 46 | | |
23213299Sayan Shaw2 years ago | 47 | - publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/ |
| 48 | displayName: 'Publish Windows Binaries for Combined JAR' | |
| 49 | artifact: WindowsBinaries | |
7b789ab5Sayan Shaw2 years ago | 50 | |
| 51 | - template: templates/component-governance-component-detection-steps.yml | |
| 52 | parameters : | |
| 53 | condition : 'succeeded' | |
| 54 | | |
| 55 | - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 | |
| 56 | displayName: 'Clean Agent Directories' | |
| 57 | condition: always() | |
| 58 | | |
| 59 | - job: Linux_CPU_Java_Packaging | |
| 60 | workspace: | |
| 61 | clean: all | |
| 62 | pool: {name: 'Azure-Pipelines-EO-Ubuntu-2004-aiinfra'} | |
| 63 | | |
| 64 | steps: | |
23213299Sayan Shaw2 years ago | 65 | - task: PowerShell@2 |
| 66 | displayName: 'Set version' | |
| 67 | inputs: | |
| 68 | targetType: 'inline' | |
| 69 | script: | | |
| 70 | $_ExtVersion=(cat version.txt) | |
| 71 | echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion" | |
| 72 | workingDirectory: '$(Build.SourcesDirectory)' | |
| 73 | | |
7b789ab5Sayan Shaw2 years ago | 74 | - script: | |
| 75 | sh ./build.sh -DOCOS_BUILD_JAVA=ON | |
| 76 | displayName: build the extensions java package | |
| 77 | | |
| 78 | - task: CopyFiles@2 | |
| 79 | displayName: 'Copy Java Files for $(Agent.OS) Arch to Artifact Staging Directory' | |
| 80 | inputs: | |
| 81 | SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs' | |
| 82 | TargetFolder: '$(Build.ArtifactStagingDirectory)' | |
| 83 | | |
23213299Sayan Shaw2 years ago | 84 | - script: | |
| 85 | cd $(Build.ArtifactStagingDirectory) | |
| 86 | echo $(OrtExtVersion) | |
| 87 | jar xvf onnxruntime-extensions-$(OrtExtVersion).jar | |
| 88 | tree $(Build.ArtifactStagingDirectory) /f | |
| 89 | displayName: Unpack JAR | |
| 90 | | |
| 91 | - publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/ | |
| 92 | displayName: 'Publish Linux Binaries for Combined JAR' | |
| 93 | artifact: LinuxBinaries | |
7b789ab5Sayan Shaw2 years ago | 94 | |
| 95 | - template: templates/component-governance-component-detection-steps.yml | |
| 96 | parameters : | |
| 97 | condition : 'succeeded' | |
| 98 | | |
| 99 | - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 | |
| 100 | displayName: 'Clean Agent Directories' | |
| 101 | condition: always() | |
| 102 | | |
| 103 | - job: MacOS_CPU_Java_Packaging | |
23213299Sayan Shaw2 years ago | 104 | dependsOn: |
| 105 | - Windows_CPU_Java_Packaging | |
| 106 | - Linux_CPU_Java_Packaging | |
7b789ab5Sayan Shaw2 years ago | 107 | workspace: |
| 108 | clean: all | |
| 109 | pool: | |
| 110 | vmImage: 'macOS-13' | |
| 111 | | |
| 112 | steps: | |
23213299Sayan Shaw2 years ago | 113 | - task: PowerShell@2 |
| 114 | displayName: 'Set version' | |
| 115 | inputs: | |
| 116 | targetType: 'inline' | |
| 117 | script: | | |
| 118 | $_ExtVersion=(cat version.txt) | |
| 119 | echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion" | |
| 120 | workingDirectory: '$(Build.SourcesDirectory)' | |
| 121 | | |
7b789ab5Sayan Shaw2 years ago | 122 | - script: | |
| 123 | sh ./build.sh -DOCOS_BUILD_JAVA=ON | |
| 124 | displayName: build the extensions java package | |
| 125 | | |
| 126 | - task: CopyFiles@2 | |
| 127 | displayName: 'Copy Java Files for $(Agent.OS) Arch to Artifact Staging Directory' | |
| 128 | inputs: | |
| 129 | SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs' | |
| 130 | TargetFolder: '$(Build.ArtifactStagingDirectory)' | |
| 131 | | |
23213299Sayan Shaw2 years ago | 132 | - script: | |
| 133 | cd $(Build.ArtifactStagingDirectory) | |
| 134 | echo $(OrtExtVersion) | |
| 135 | jar xvf onnxruntime-extensions-$(OrtExtVersion).jar | |
| 136 | brew install tree | |
| 137 | tree $(Build.ArtifactStagingDirectory) | |
| 138 | displayName: Unpack JAR to view contents | |
| 139 | | |
| 140 | - task: DownloadPipelineArtifact@0 | |
| 141 | displayName: 'Download Windows Pipeline Artifact' | |
| 142 | inputs: | |
| 143 | artifactName: 'WindowsBinaries' | |
| 144 | targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/' | |
| 145 | | |
| 146 | - task: DownloadPipelineArtifact@0 | |
| 147 | displayName: 'Download Linux Pipeline Artifact' | |
| 148 | inputs: | |
| 149 | artifactName: 'LinuxBinaries' | |
| 150 | targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/' | |
| 151 | | |
| 152 | - script: | | |
| 153 | brew install tree | |
| 154 | tree $(Build.ArtifactStagingDirectory) | |
| 155 | displayName: Print contents | |
| 156 | | |
| 157 | - script: | | |
| 158 | cd $(Build.ArtifactStagingDirectory) | |
| 159 | rm onnxruntime-extensions-$(OrtExtVersion).jar | |
| 160 | jar cmf0 META-INF/MANIFEST.MF onnxruntime-extensions-$(OrtExtVersion).jar * | |
| 161 | displayName: Combine and pack JAR with Windows, Linux and MacOS Binaries | |
| 162 | | |
c9bba37fSayan Shaw2 years ago | 163 | - script: | |
| 164 | cd $(Build.ArtifactStagingDirectory) | |
| 165 | mkdir drop | |
| 166 | cp onnxruntime-extensions-$(OrtExtVersion).jar drop/onnxruntime-extensions-$(OrtExtVersion).jar | |
| 167 | cp onnxruntime-extensions-$(OrtExtVersion)-javadoc.jar drop/onnxruntime-extensions-$(OrtExtVersion)-javadoc.jar | |
| 168 | cp onnxruntime-extensions-$(OrtExtVersion)-sources.jar drop/onnxruntime-extensions-$(OrtExtVersion)-sources.jar | |
| 169 | cp META-INF/maven/com.microsoft.onnxruntime/onnxruntime-extensions/pom.xml drop/onnxruntime-extensions-$(OrtExtVersion).pom | |
| 170 | displayName: Move files to a drop folder for publishing | |
| 171 | | |
7b789ab5Sayan Shaw2 years ago | 172 | - task: PublishPipelineArtifact@1 |
| 173 | displayName: 'Publish MacOS Artifact' | |
| 174 | inputs: | |
c9bba37fSayan Shaw2 years ago | 175 | targetPath: '$(Build.ArtifactStagingDirectory)/drop' |
23213299Sayan Shaw2 years ago | 176 | artifact: 'drop-onnxruntime-extensions-java-cpu' |
7b789ab5Sayan Shaw2 years ago | 177 | |
| 178 | - template: templates/component-governance-component-detection-steps.yml | |
| 179 | parameters : | |
| 180 | condition : 'succeeded' | |
| 181 | | |
| 182 | - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 | |
| 183 | displayName: 'Clean Agent Directories' | |
| 184 | condition: always() |