onnxruntime/tools/ci_build/github/azure-pipelines/templates/c-api-linux-cpu.yml
Jian Chen 43e1e89453
Update aarch64 building pool to aiinfra-linux-ARM64-CPU-2019 (#12243)
* Setting new pool for arm64

* Setting defualt pool name

* adding DockerInstaller stage

* try to install docker from apt-get

* change to specific

* adding chmod to docker.sock

* install dotnet sdk

* specic dotnet 3.1.x

* add manuall step to install dotnet

* typo bass

* remove inputs

* change dotnet installation dir

* skipComponentGovernanceDetection on arm64 linux

* variables typo

* variables:
    - name: skipComponentGovernanceDetection
      value: true

* update variables

* skipComponentGovernanceDetection set to true

* moving varliables

* moving the variables again

* setting condition on cgd

* indentation

* indentation again

* conditional variable

* if

* remove cgd

* conditionl on cgd

* condition

* parameters

* clean up
2022-07-20 12:08:02 -04:00

102 lines
No EOL
4.4 KiB
YAML

# This file contains the ADO job that build libonnxruntime.so on Linux
parameters:
- name: AdditionalBuildFlags
displayName: Additional build flags for build.py
type: string
default: ''
- name: BaseImage
type: string
- name: OnnxruntimeArch
type: string
- name: OnnxruntimeCFlags
type: string
- name: OnnxruntimeCXXFlags
type: string
- name: OnnxruntimeNodejsBindingArch
type: string
- name: PoolName
type: string
default: 'Linux-CPU'
jobs:
- job: Linux_C_API_Packaging_CPU_${{parameters.OnnxruntimeArch}}
workspace:
clean: all
variables:
- name: skipComponentGovernanceDetection
value: ${{eq('${{parameters.OnnxruntimeNodejsBindingArch}}', 'arm64')}}
timeoutInMinutes: 210
pool: ${{parameters.PoolName}}
steps:
- bash: |
set -euo pipefail
if ! which docker; then
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo chmod 666 /var/run/docker.sock
fi
displayName: Install Docker Engine
- template: set-version-number-variables-step.yml
- template: get-docker-image-steps.yml
parameters:
Dockerfile: tools/ci_build/github/linux/docker/inference/${{parameters.OnnxruntimeArch}}/default/cpu/Dockerfile
Context: tools/ci_build/github/linux/docker/inference/${{parameters.OnnxruntimeArch}}/default/cpu
DockerBuildArgs: "--build-arg BUILD_UID=$( id -u ) --build-arg BASEIMAGE=${{parameters.BaseImage}}"
Repository: onnxruntimecpubuildcentos7${{parameters.OnnxruntimeArch}}
- task: CmdLine@2
inputs:
script: |
mkdir -p $HOME/.onnx
docker run --rm -e CFLAGS="${{parameters.OnnxruntimeCFlags}}" -e CXXFLAGS="${{parameters.OnnxruntimeCXXFlags}}" --volume /data/onnx:/data/onnx:ro --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build \
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimecpubuildcentos7${{parameters.OnnxruntimeArch}} /bin/bash -c "python3 \
/onnxruntime_src/tools/ci_build/build.py --build_java --build_nodejs --build_dir /build --config Release \
--skip_submodule_sync --parallel --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/linux-${{parameters.OnnxruntimeArch}}"
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build'
- script: |
set -e -x
mkdir $(Build.ArtifactStagingDirectory)/testdata
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
ls -al $(Build.ArtifactStagingDirectory)
displayName: 'Create Artifacts'
- template: java-api-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: 'linux-${{parameters.OnnxruntimeArch}}'
buildConfig: 'Release'
artifactName: 'onnxruntime-java-linux-${{parameters.OnnxruntimeArch}}'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.so'
nativeLibraryName: 'libonnxruntime4j_jni.so'
- template: c-api-artifacts-package-and-publish-steps-posix.yml
parameters:
buildConfig: 'Release'
artifactName: 'onnxruntime-linux-${{parameters.OnnxruntimeArch}}-$(OnnxRuntimeVersion)'
artifactNameNoVersionString: 'onnxruntime-linux-${{parameters.OnnxruntimeArch}}'
libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)'
- template: nodejs-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: '${{parameters.OnnxruntimeNodejsBindingArch}}'
os: 'linux'
artifactName: 'drop-onnxruntime-nodejs-linux-${{parameters.OnnxruntimeArch}}'
- ${{ if not(eq(parameters.OnnxruntimeNodejsBindingArch, 'arm64')) }}:
- template: component-governance-component-detection-steps.yml
parameters:
condition: 'succeeded'
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()