Skip to content

Commit ce8083a

Browse files
authored
Update android-build.yml
1 parent 573327d commit ce8083a

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

.github/workflows/android-build.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@ on:
33
workflow_dispatch:
44
push:
55
branches:
6-
- AE
7-
- rel-*
6+
- AE
7+
- rel-*
88
pull_request:
9+
910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1112
cancel-in-progress: true
13+
1214
env:
1315
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1"
1416
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime"
1517
ORT_NIGHTLY_SOURCE: "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json"
1618
# ANDROID_ABI: "arm64-v8a"
1719
ANDROID_ABI: "x86_64"
20+
1821
jobs:
1922
android_x64:
2023
# Note: linux is the only good option for the Android emulator currently.
2124
# it doesn't work on macos-14.
2225
# HVF error: HV_UNSUPPORTED
2326
# it works on macos-13 but with macos-15 being released soon that isn't a long term solution.
2427
runs-on: ubuntu-latest
28+
2529
steps:
2630
- name: Checkout OnnxRuntime GenAI repo
2731
uses: actions/checkout@v4
@@ -69,7 +73,7 @@ jobs:
6973
echo "$ORT_NIGHTLY_VERSION"
7074
echo "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" >> $GITHUB_ENV
7175
72-
# have to create a dummy project to use `add package`
76+
# Have to create a dummy project to use `add package`
7377
- name: Download OnnxRuntime Nightly
7478
run: |
7579
dotnet new console
@@ -99,7 +103,29 @@ jobs:
99103
sudo udevadm control --reload-rules
100104
sudo udevadm trigger --name-match=kvm
101105
106+
# - name: Run Android tests
107+
# run: |
108+
# set -e -x
109+
# ./build.sh --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST_HOME} --config=RelWithDebInfo --android_abi=${{ env.ANDROID_ABI }} --parallel --build_java --android_run_emulator --test
110+
102111
- name: Run Android tests
103112
run: |
104113
set -e -x
105-
./build.sh --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST_HOME} --config=RelWithDebInfo --android_abi=${{ env.ANDROID_ABI }} --parallel --build_java --android_run_emulator --test
114+
115+
# Ensure Android SDK tools are installed
116+
echo "Installing required Android SDK components..."
117+
yes | sdkmanager "platform-tools" "emulator" "system-images;android-27;default;x86_64"
118+
119+
# Set the ANDROID_HOME environment variable if not already set
120+
export ANDROID_HOME=/usr/local/lib/android/sdk
121+
export ANDROID_SDK_ROOT=$ANDROID_HOME
122+
123+
# Check if emulator is installed
124+
if [ ! -f "$ANDROID_HOME/emulator/emulator" ]; then
125+
echo "Emulator not found at $ANDROID_HOME/emulator/emulator. Exiting..."
126+
exit 1
127+
fi
128+
129+
# Run the build script with the appropriate flags
130+
./build.sh --android --android_api=27 --android_ndk_path=${ANDROID_NDK_LATEST_HOME} --config=RelWithDebInfo --android_abi=${{ env.ANDROID_ABI }} --parallel --build_java --android_run_emulator --test
131+

0 commit comments

Comments
 (0)