Skip to content

Commit

Permalink
add missing build_java in Android testing stage. (#12187)
Browse files Browse the repository at this point in the history
add missing build_java in testing
  • Loading branch information
mszhanyi authored Jul 27, 2022
1 parent 2b2367e commit 4df4471
Showing 1 changed file with 43 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Known Limits
# 1. Anchors are not supported in GHA
# https://github.community/t/support-for-yaml-anchors/16128/90
# 2. today most cloud-based CI services are still lacking hardware acceleration support from the host VM,
# 2. today most cloud-based CI services are still lacking hardware acceleration support from the host VM,
# which is the no.1 blocker for running tests on modern Android Emulators (especially on recent API levels) on CI.

jobs:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
overWrite: true

- task: CopyFiles@2
displayName: Copy test data
displayName: Copy test data
inputs:
contents: 'build/**/testdata/**'
targetFolder: $(Build.ArtifactStagingDirectory)
Expand All @@ -84,7 +84,9 @@ jobs:
- task: CopyFiles@2
displayName: Copy test executables
inputs:
contents: 'build/Debug/*'
contents: |
build/Debug/*
build/Debug/java/androidtest/android/**
targetFolder: $(Build.ArtifactStagingDirectory)
overWrite: true

Expand Down Expand Up @@ -114,6 +116,9 @@ jobs:
artifact: 'CPUBuildOutput'
path: $(Build.SourcesDirectory)

- script: /bin/bash tools/ci_build/github/android/setup_gradle_wrapper.sh $(pwd)
displayName: Setup gradle wrapper to use gradle 6.8.3

- script: |
python3 tools/python/run_android_emulator.py \
--android-sdk-root ${ANDROID_SDK_ROOT} \
Expand All @@ -122,6 +127,15 @@ jobs:
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid
displayName: Start Android emulator
# Start switching to jdk 11 after the Android Emulator is started
# since Android SDK manager requires java 8
- task: JavaToolInstaller@0
displayName: Use jdk 11
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- script: |
python3 tools/ci_build/build.py \
--android \
Expand All @@ -130,6 +144,7 @@ jobs:
--android_ndk_path $ANDROID_NDK_HOME \
--android_abi=x86_64 \
--android_api=30 \
--build_java \
--test
displayName: CPU EP, Test on Android Emulator
Expand Down Expand Up @@ -219,15 +234,17 @@ jobs:
- task: CopyFiles@2
displayName: Copy Test Executables
inputs:
contents: 'build_nnapi/Debug/*'
contents: |
build_nnapi/Debug/*
build_nnapi/Debug/java/androidtest/android/**
targetFolder: $(Build.ArtifactStagingDirectory)
overWrite: true

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: NNAPIBuildOutput

- template: templates/clean-agent-build-directory-step.yml

- job: Test_NNAPI_EP
Expand Down Expand Up @@ -255,14 +272,26 @@ jobs:
inputs:
versionSpec: $(pythonVersion)

- script: /bin/bash tools/ci_build/github/android/setup_gradle_wrapper.sh $(pwd)
displayName: Setup gradle wrapper to use gradle 6.8.3

- script: |
python3 tools/python/run_android_emulator.py \
--android-sdk-root ${ANDROID_SDK_ROOT} \
--create-avd --system-image "system-images;android-30;google_apis;x86_64" \
--start --emulator-extra-args="-partition-size 4096" \
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid
displayName: Start Android emulator
# Start switching to jdk 11 after the Android Emulator is started
# since Android SDK manager requires java 8
- task: JavaToolInstaller@0
displayName: Use jdk 11
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- script: |
python3 tools/ci_build/build.py \
--android \
Expand All @@ -271,6 +300,7 @@ jobs:
--android_ndk_path $ANDROID_NDK_HOME \
--android_abi=x86_64 \
--android_api=29 \
--build_java \
--use_nnapi \
--test
displayName: NNAPI EP, Test, CodeCoverage on Android Emulator
Expand All @@ -287,18 +317,6 @@ jobs:
$(Build.SourcesDirectory)/protobuf_install
displayName: Build Host Protoc
- script: /bin/bash tools/ci_build/github/android/setup_gradle_wrapper.sh $(pwd)
displayName: Setup gradle wrapper to use gradle 6.8.3

# Start switching to jdk 11 after the Android Emulator is started
# since Android SDK manager requires java 8
- task: JavaToolInstaller@0
displayName: Use jdk 11
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- script: /bin/bash tools/ci_build/github/linux/ort_minimal/nnapi_minimal_build_minimal_ort_and_run_tests.sh $(pwd)
# Build Minimal ORT with NNAPI and reduced Ops, run unit tests on Android Emulator
displayName: Build Minimal ORT with NNAPI and run tests
Expand All @@ -310,7 +328,7 @@ jobs:
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid
displayName: Stop Android emulator
condition: always()
- template: templates/clean-agent-build-directory-step.yml

# The below jobs only run on master build
Expand Down Expand Up @@ -346,7 +364,7 @@ jobs:
$(Build.BinariesDirectory)/protobuf \
$(Build.SourcesDirectory)/protobuf_install
displayName: Build Host Protoc
- script: |
python3 tools/python/run_android_emulator.py \
--android-sdk-root ${ANDROID_SDK_ROOT} \
Expand Down Expand Up @@ -380,7 +398,7 @@ jobs:
--build_java \
--code_coverage
displayName: NNAPI EP, Build, Test, CodeCoverage on Android Emulator
- script: |
python3 -m pip install gcovr && \
python3 tools/ci_build/coverage.py \
Expand Down Expand Up @@ -408,9 +426,9 @@ jobs:
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid
displayName: Stop Android emulator
condition: always()
- template: templates/clean-agent-build-directory-step.yml

- job: Update_Dashboard
workspace:
clean: all
Expand All @@ -419,7 +437,7 @@ jobs:
value: true
pool: 'Linux-CPU-2019'
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
dependsOn:
dependsOn:
- Test_CPU_EP
- NNAPI_EP_MASTER
steps:
Expand All @@ -437,5 +455,5 @@ jobs:
scriptPath: $(Build.SourcesDirectory)/tools/ci_build/github/linux/upload_code_coverage_data.sh
arguments: '"$(Build.BinariesDirectory)/coverage_rpt.txt" "https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=$(Build.BuildId)" arm android nnapi'
workingDirectory: '$(Build.BinariesDirectory)'

- template: templates/clean-agent-build-directory-step.yml

0 comments on commit 4df4471

Please sign in to comment.