onnxruntime/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml
Du Li 095d55bf54
Cherry picking for Rel-1.6 (#6006)
* Update onnx (#5720)

* update onnx

* update docker image for testing
(cherry picked from commit 705d093167)

* cherry pick PR 5720

* C#: Add CreateFromMemory to FixedBufferOnnxValue to allow bind user buffers and pass custom binary compatible types (#5886)

Add CreateFromMemory to FixedBufferOnnxValue so users can bind their own custom binary compatible buffers to feed/fetch data.
(cherry picked from commit c2d610066a)

* [Java] Initial Apple Silicon support (#5891)

* Rearranging checks in onnxruntime_mlas.cmake to pickup Apple Silicon.

On an M1 Macbook Pro clang reports:

$ clang -dumpmachine
arm64-apple-darwin20.1.0

So the regex check needs to look for "arm64" first, as otherwise it
matches 32-bit ARM and you get NEON compilation failures.

* Adding Java side library loading support for Apple Silicon (and other aarch64 architectures).

* Adding Qgemm fix from @tracysh

* Fixes the java packaging on Windows.

* Missed a check in the java platform detector.
(cherry picked from commit 8b83c51a35)

* Add OpenVINO EP shared lib to Py Wheel (#5920)

* Add OpenVINO EP shared lib to Py Wheel

Include the libonnxruntime_providers_openvino.so/.dll to the wheel

* Follow libs.extend pattern as other EPs
(cherry picked from commit 40926867c3)

* Make NNAPI EP reject nodes with no-shape inputs (#5927)

(cherry picked from commit 87368655e2)

* Sahar/fix documentation shared lib (#5926)

* Update OpenVINO-ExecutionProvider.Md

update openvino-executionprovider.md for shared library

* Update Build.md

updated --build_shared_lib flag for building openvino shared provider lib

* Update Dockerfile.openvino

building for shared library with the new changes for openvino shared lib

* Revert "Update Build.md"

This reverts commit c9cf5fee76be7fdc10cadf07259f1d4ed5b45b93.

* Revert "Update Dockerfile.openvino "

This reverts commit e1624e4f93a4cfb425b6f21d7fb71b299a146740.

* Update OpenVINO-ExecutionProvider.md

fix documentation to the shared library

Co-authored-by: sfatimar <sahar.fatima@intel/com>
(cherry picked from commit 8168c91978)

* Update dockerfiles (#5929)

1. Remove conda from the images. Because conda contains a file named /opt/miniconda/lib/libcrypto.so.1.0.0 which can't pass our security scan. Also, it will be easier for us to manage the third party usage registrations.
2. Remove openssh from the images. Because the official openssh package provided by Ubuntu can't pass our security scan.
3. Reduce the image size to 1/3 by using stages. Also, because it contains less packages, it will be less often needed to update.
4. Put the LICENSE-IMAGE.txt file in right place. It is missed in current images. You can see it was added to a temp folder "/code" but it got deleted afterwards.
5. Update the CPU docker image's base image to Ubuntu 18.04. The GPU one is already 18.04. It's better to keep them the same.
6. Remove the build arg ONNXRUNTIME_REPO/ONNXRUNTIME_BRANCH. Instead, the new one always uses the local source. I feel it can reduce confusion.
(cherry picked from commit 1dbabb2362)

* Add Longformer Attention Cuda Op(#5932)

Limitation: Global tokens must be at the beginning of sequence.
(cherry picked from commit 31a6be3d67)

* Bug fix for MaskRCNN and FasterRCNN (#5935)

Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com>
(cherry picked from commit e39e82b43a)

* Fix publishing pipelines. (#5942)

Fix publishing pipelines.
(cherry picked from commit c4b55d29fe)

* Fix Python Linux GPU package name (#5943)

Fix Python Linux GPU package name. I accidentally added "noopenmp" to it.

(cherry picked from commit 5fdd9f0fd2)

* Update BUILD.md with shared provider information (#5944)

* Update build instructions to include information about shared providers

(cherry picked from commit 27513d1fd7)

* [OpenVINO]Fix memory leak in `IsDebugEnabled()` under Windows (#5948)

* w

* w

Co-authored-by: modav <modav@microsoft.com>
(cherry picked from commit e207589631)

* Add support for Python 3.8+ on Windows when CUDA is enabled (#5956)

(cherry picked from commit 015fbb3dbb)

* Support the cross compiling for Apple Silicon (#5974)

* support macos_arm64 cross compiling

* update the build docs

* update as commented.

* Update BUILD.md
(cherry picked from commit 2ec211ea7b)

* Update docker files to put 'unattended-upgrades' in a right place(#5983)

(cherry picked from commit 3323fb6082)

* Enable the xcode build for Apple Silicon (arm64 MacOS) (#5924)

* fix the build script for macos/xcode

* add the version check

* correct the osx-arch configuration

* typo
(cherry picked from commit 1852ade75d)

* Add python 3.9 support (#5874)

1. Add python 3.9 support(except Linux ARM)
2. Add Windows GPU python 3.8 to our packaging pipeline.

* Revert some pipeline changes in #5874

Co-authored-by: Ashwini Khade <askhade@microsoft.com>
Co-authored-by: Du Li <duli@OrtTrainingDev0.af05slrtruoetgaxwwjv5nsq5e.px.internal.cloudapp.net>
Co-authored-by: Dmitri Smirnov <yuslepukhin@users.noreply.github.com>
Co-authored-by: Adam Pocock <craigacp@gmail.com>
Co-authored-by: S. Manohar Karlapalem <manohar.karlapalem@intel.com>
Co-authored-by: Guoyu Wang <62914304+gwang-msft@users.noreply.github.com>
Co-authored-by: sfatimar <64512376+sfatimar@users.noreply.github.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Co-authored-by: Maajid khan <n.maajidkhan@gmail.com>
Co-authored-by: Ryan Hill <38674843+RyanUnderhill@users.noreply.github.com>
Co-authored-by: Moshe David <mosdav165@gmail.com>
Co-authored-by: Ivan Stojiljkovic <17503404+ivanst0@users.noreply.github.com>
Co-authored-by: Wenbing Li <10278425+wenbingl@users.noreply.github.com>
2020-12-02 13:45:20 -08:00

349 lines
14 KiB
YAML

schedules:
- cron: "0 8 * * *"
displayName: Daily Build
branches:
include:
- master
always: true
jobs:
- job: Linux_Java_API_Build_CPU_x64
workspace:
clean: all
timeoutInMinutes: 60
pool: 'Linux-CPU'
steps:
- template: templates/set-version-number-variables-step.yml
- template: templates/linux-set-variables-and-download.yml
- task: Docker@2
displayName: login
inputs:
containerRegistry: onnxruntimebuildcache
command: login
addPipelineData: false
- task: CmdLine@2
inputs:
script: |
mkdir -p $HOME/.onnx
docker run --rm --volume /data/onnx:/data/onnx:ro --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro --volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntimecentoscpubuild:chr /bin/bash -c "python3 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64"
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Run build and test'
- task: Docker@2
displayName: logout
inputs:
containerRegistry: onnxruntimebuildcache
command: logout
addPipelineData: false
- template: templates/java-api-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: 'linux-x64'
buildConfig: 'Release'
artifactName: 'onnxruntime-java-linux-x64'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.so'
nativeLibraryName: 'libonnxruntime4j_jni.so'
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- template: templates/clean-agent-build-directory-step.yml
- job: MacOS_Java_API_Build_CPU_x64
workspace:
clean: all
pool:
vmImage: 'macOS-10.14'
steps:
- template: templates/set-version-number-variables-step.yml
- script: |
export JAVA_HOME=$(java_home -v 11)
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --use_openmp --config RelWithDebInfo
displayName: 'Build and Test MacOS'
- template: templates/java-api-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: 'osx-x64'
buildConfig: 'RelWithDebInfo'
artifactName: 'onnxruntime-java-osx-x64'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.dylib'
nativeLibraryName: 'libonnxruntime4j_jni.dylib'
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- template: templates/clean-agent-build-directory-step.yml
- job: Windows_Java_API_Build_CPU_x64
workspace:
clean: all
pool: 'Win-CPU-2019'
timeoutInMinutes: 160
strategy:
maxParallel: 2
matrix:
# x86:
#EnvSetupScript: setup_env_x86.bat
#buildArch: x86
#msbuildArch: x86
#msbuildPlatform: Win32
#buildparameter: --x86
x64:
EnvSetupScript: setup_env.bat
buildArch: x64
msbuildArch: amd64
msbuildPlatform: x64
buildparameter:
steps:
- template: templates/telemetry-steps.yml
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
addToPath: true
architecture: $(buildArch)
- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- script: |
python -m pip install -q pyopenssl setuptools wheel numpy
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- powershell: |
$Env:USE_MSVC_STATIC_RUNTIME=1
$Env:ONNX_ML=1
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
python setup.py bdist_wheel
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
displayName: 'Install ONNX'
- template: templates/set-test-data-variables-step.yml
- template: templates/set-version-number-variables-step.yml
- task: PythonScript@0
displayName: 'Generate cmake config'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --enable_wcos --build_java --use_telemetry --update --cmake_generator "Visual Studio 16 2019" --enable_lto --disable_rtti --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'
workingDirectory: '$(Build.BinariesDirectory)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
platform: $(msbuildPlatform)
configuration: RelWithDebInfo
msbuildArchitecture: $(buildArch)
maximumCpuCount: true
logProjectEvents: true
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
createLogFile: true
- task: PythonScript@0
displayName: 'test'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_java --enable_wcos --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --disable_rtti --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'
workingDirectory: '$(Build.BinariesDirectory)'
- template: templates/java-api-artifacts-package-and-publish-steps-windows.yml
parameters:
buildConfig: RelWithDebInfo
artifactName: 'onnxruntime-java-win-$(buildArch)'
version: '$(OnnxRuntimeVersion)'
commitId: $(OnnxRuntimeGitCommitHash)
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- template: templates/clean-agent-build-directory-step.yml
- job: Jar_Packaging
workspace:
clean: all
pool: 'Win-CPU-2019'
dependsOn:
- Windows_Java_API_Build_CPU_x64
- Linux_Java_API_Build_CPU_x64
- MacOS_Java_API_Build_CPU_x64
condition: succeeded()
steps:
- template: templates/set-version-number-variables-step.yml
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact - Win x64'
inputs:
buildType: 'current'
artifactName: 'drop-onnxruntime-java-win-x64'
targetPath: '$(Build.BinariesDirectory)\java-artifact'
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact - Linux x64'
inputs:
buildType: 'current'
artifactName: 'drop-onnxruntime-java-linux-x64'
targetPath: '$(Build.BinariesDirectory)\java-artifact'
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact - MacOS x64'
inputs:
buildType: 'current'
artifactName: 'drop-onnxruntime-java-osx-x64'
targetPath: '$(Build.BinariesDirectory)\java-artifact'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64.zip'
destinationFolder: '$(Build.BinariesDirectory)\java-artifact'
cleanDestinationFolder: false
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64.zip'
destinationFolder: '$(Build.BinariesDirectory)\java-artifact'
cleanDestinationFolder: false
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-x64.zip'
destinationFolder: '$(Build.BinariesDirectory)\java-artifact'
cleanDestinationFolder: false
- task: CmdLine@2
inputs:
script: |
@echo on
pushd onnxruntime-java-linux-x64
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.so
del /F /Q libcustom_op_library.so
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar .
popd
pushd onnxruntime-java-osx-x64
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.dylib
del /F /Q libcustom_op_library.dylib
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar .
popd
workingDirectory: '$(Build.BinariesDirectory)\java-artifact'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64'
artifact: 'onnxruntime-java'
publishLocation: 'pipeline'
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- job: Final_Jar_Testing_Windows
workspace:
clean: all
pool: 'Win-CPU-2019'
timeoutInMinutes: 60
dependsOn:
Jar_Packaging
steps:
- template: templates/set-version-number-variables-step.yml
- task: DownloadPipelineArtifact@2
displayName: 'Download Final Jar'
inputs:
buildType: 'current'
artifactName: 'onnxruntime-java'
targetPath: '$(Build.BinariesDirectory)\final-jar'
- task: CmdLine@2
inputs:
script: |
mkdir test
pushd test
jar xf $(Build.BinariesDirectory)\final-jar\testing.jar
popd
powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar"
powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar"
java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)\final-jar'
- job: Final_Jar_Testing_Linux
workspace:
clean: all
pool: 'Linux-CPU'
timeoutInMinutes: 60
dependsOn:
Jar_Packaging
steps:
- template: templates/set-version-number-variables-step.yml
- task: DownloadPipelineArtifact@2
displayName: 'Download Final Jar'
inputs:
buildType: 'current'
artifactName: 'onnxruntime-java'
targetPath: '$(Build.BinariesDirectory)/final-jar'
- task: CmdLine@2
inputs:
script: |
sudo apt-get install -y openjdk-8-jdk
sudo apt autoremove
PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH}
echo "Java Version"
java --version
mkdir test
pushd test
jar xf $(Build.BinariesDirectory)/final-jar/testing.jar
popd
wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./
wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./
LD_LIBRARY_PATH=./test:${LD_LIBRARY_PATH}
java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)/final-jar'
- job: Final_Jar_Testing_MacOs
workspace:
clean: all
pool:
vmImage: 'macOS-10.14'
timeoutInMinutes: 60
dependsOn:
Jar_Packaging
steps:
- template: templates/set-version-number-variables-step.yml
- task: DownloadPipelineArtifact@2
displayName: 'Download Final Jar'
inputs:
buildType: 'current'
artifactName: 'onnxruntime-java'
targetPath: '$(Build.BinariesDirectory)/final-jar'
- task: CmdLine@2
inputs:
script: |
echo "Java Version"
java --version
mkdir test
pushd test
jar xf $(Build.BinariesDirectory)/final-jar/testing.jar
popd
wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./
wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./
DYLD_LIBRARY_PATH=./test:${DYLD_LIBRARY_PATH}
java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)/final-jar'