onnxruntime/tools/ci_build/github/azure-pipelines/linux-cpu-minimal-build-ci-pipeline.yml

191 lines
8.3 KiB
YAML

# This CI has 4 major steps
# 1. Build full ORT, install the full ORT python wheel and use it to generate ort format test models
# and include ops config file for step 3
# 2. Build minimal ORT including all the kernels and disable exceptions.
# This step is build only to safe-guard the --disable_exceptions option.
# 3. Build minimal ORT include only the kernels using the include ops config file from step 1,
# and the models from <repo root>/onnxruntime/test/testdata/, run UT, and use onnx_test_runner to
# test the ort format models generated in step 1.
# Exceptions are enabled in this step to help debugging in case of CI failure.
# This step builds and tests ORT with and without type reduction enabled.
# 3.1. Build minimal ORT with type reduction from a globally allowed types list.
# This step uses a hard-coded list of types which may not include the types needed by the models
# in <repo root>/onnxruntime/test/testdata/, so the tests for those models are skipped.
# 4. Build baseline minimal ORT for Android arm64-v8a including no kernels and disable exceptions
# This step is to report the baseline binary size for Android
jobs:
- job: Linux_CPU_Minimal_Build_E2E
timeoutInMinutes: 120
workspace:
clean: all
pool: Linux-CPU
variables:
test_data_directory: $(Build.SourcesDirectory)/.test_data
steps:
- checkout: self
clean: true
submodules: recursive
- task: CmdLine@2
displayName: Create test data directory
inputs:
script: |
# Create a folder for all test data
mkdir -p $(test_data_directory)
workingDirectory: $(Build.SourcesDirectory)
- template: templates/get-docker-image-steps.yml
parameters:
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.centos
Context: tools/ci_build/github/linux/docker
DockerBuildArgs: "--build-arg BUILD_UID=$( id -u )"
Repository: onnxruntimecentoscpubuild
- task: CmdLine@2
displayName: Build full onnxruntime and generate ORT format test files
inputs:
script: |
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $(test_data_directory):/home/onnxruntimedev/.test_data \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecentoscpubuild \
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/ort_minimal/build_full_ort_and_create_ort_files.sh
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Build minimal onnxruntime [exceptions DISABLED, type reduction DISABLED]
inputs:
script: |
# We will try to build minimal ORT with exceptions disabled
# Only the building process is verified here, no test will be performed
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecentoscpubuild \
python3 /onnxruntime_src/tools/ci_build/build.py \
--build_dir /build --cmake_generator Ninja \
--config Debug\
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--skip_tests \
--minimal_build \
--disable_exceptions
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Build minimal onnxruntime [exceptions ENABLED, type reduction DISABLED, custom ops ENABLED] and run tests
inputs:
script: |
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $(test_data_directory):/home/onnxruntimedev/.test_data \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecentoscpubuild \
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/ort_minimal/build_minimal_ort_and_run_tests.sh \
--build-directory /build/without_type_reduction \
--reduced-ops-config /home/onnxruntimedev/.test_data/required_ops.ort_models.config \
--enable-custom-ops
workingDirectory: $(Build.SourcesDirectory)
- script: git checkout -- .
displayName: Discard local changes to Git repository files
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Build minimal onnxruntime [exceptions ENABLED, type reduction ENABLED] and run tests
inputs:
script: |
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $(test_data_directory):/home/onnxruntimedev/.test_data \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecentoscpubuild \
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/ort_minimal/build_minimal_ort_and_run_tests.sh \
--build-directory /build/with_type_reduction \
--reduced-ops-config /home/onnxruntimedev/.test_data/required_ops_and_types.ort_models.config \
--enable-type-reduction
workingDirectory: $(Build.SourcesDirectory)
- script: git checkout -- .
displayName: Discard local changes to Git repository files
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Build minimal onnxruntime [exceptions ENABLED, type reduction ENABLED (globally allowed types)] and run tests
inputs:
script: |
printf "%s\n%s\n" \
"!globally_allowed_types;bool,float,int8_t,uint8_t" \
"!no_ops_specified_means_all_ops_are_required" \
> $(test_data_directory)/globally_allowed_types.config && \
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $(test_data_directory):/home/onnxruntimedev/.test_data \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecentoscpubuild \
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/ort_minimal/build_minimal_ort_and_run_tests.sh \
--build-directory /build/with_type_reduction_globally_allowed_types \
--reduced-ops-config /home/onnxruntimedev/.test_data/globally_allowed_types.config \
--enable-type-reduction \
--skip-model-tests
workingDirectory: $(Build.SourcesDirectory)
- script: git checkout -- .
displayName: Discard local changes to Git repository files
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Build onnxruntime minimal baseline for Android arm64-v8a and report binary size
inputs:
script: |
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $ANDROID_HOME:/android_home \
--volume $(test_data_directory):/home/onnxruntimedev/.test_data \
-e ALLOW_RELEASED_ONNX_OPSET_ONLY=1 \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
-e BUILD_SOURCEVERSION=$(Build.SourceVersion) \
-e BUILD_ID=$(Build.BuildId) \
-e BUILD_REASON=$(Build.Reason) \
-e BUILD_BRANCH=$(Build.SourceBranch) \
-e DASHBOARD_MYSQL_ORT_PASSWORD=$(dashboard-mysql-ort-password) \
onnxruntimecentoscpubuild \
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/ort_minimal/build_minimal_ort_android_baseline_and_report_bin_size.sh
workingDirectory: $(Build.SourcesDirectory)
- task: PublishTestResults@2
displayName: 'Publish unit test results'
inputs:
testResultsFiles: '**/*.results.xml'
searchFolder: '$(Build.BinariesDirectory)'
testRunTitle: 'Unit Test Run'
condition: succeededOrFailed()
- template: templates/component-governance-component-detection-steps.yml
parameters:
condition: 'succeeded'
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()