Skip to content

Commit

Permalink
add to gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlin54 committed Nov 12, 2024
1 parent b8b5146 commit 227f031
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug.apk
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug-androidTest.apk
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/fp32-xnnpack-custom/model.zip
curl -o https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/library_test_dir/app-debug.apk android-test-debug.apk
curl -o https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/library_test_dir/app-debug-androidTest.apk android-test-debug-androidTest.apk
unzip model.zip
mv *.pte model.pte
Expand Down
10 changes: 10 additions & 0 deletions build/build_android_llm_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ build_android_demo_apps() {
pushd extension/benchmark/android/benchmark
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
popd

pushd extension/android_test
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew testDebugUnitTest
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
popd
}

collect_artifacts_to_be_uploaded() {
Expand All @@ -158,6 +163,11 @@ collect_artifacts_to_be_uploaded() {
mkdir -p "${MINIBENCH_APP_DIR}"
cp extension/benchmark/android/benchmark/app/build/outputs/apk/debug/*.apk "${MINIBENCH_APP_DIR}"
cp extension/benchmark/android/benchmark/app/build/outputs/apk/androidTest/debug/*.apk "${MINIBENCH_APP_DIR}"
# Collect Java library test
JAVA_LIBRARY_TEST_DIR="${ARTIFACTS_DIR_NAME}/library_test_dir"
mkdir -p "${JAVA_LIBRARY_TEST_DIR}"
cp extension/android_test/build/outputs/apk/debug/*.apk "${JAVA_LIBRARY_TEST_DIR}"
cp extension/android_test/build/outputs/apk/androidTest/debug/*.apk "${JAVA_LIBRARY_TEST_DIR}"
}

main() {
Expand Down
5 changes: 5 additions & 0 deletions build/run_android_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ adb shell mkdir -p /data/local/tmp/llama
adb push model.pte /data/local/tmp/llama
adb push tokenizer.bin /data/local/tmp/llama
adb shell am instrument -w -r com.example.executorchllamademo.test/androidx.test.runner.AndroidJUnitRunner

adb install -t android-test-debug.apk
adb install -t android-test-debug-androidTest.apk

adb shell am instrument -w -r org.pytorch.executorch.test/androidx.test.runner.AndroidJUnitRunner
23 changes: 7 additions & 16 deletions extension/android_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,21 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
}
plugins {
id("com.android.application") version "8.1.0" apply false
}


apply plugin: 'com.android.library'

group 'org.pytorch.executorch'

apply plugin: "com.android.application"

android {
namespace 'org.pytorch.executorch'
compileSdkVersion 31
buildToolsVersion "29.0.0"
compileSdk = 34

defaultConfig {
minSdkVersion 28
targetSdkVersion 31
minSdk = 28
targetSdk = 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down

0 comments on commit 227f031

Please sign in to comment.