From 524b8589d55a051256b19cb8888fd9252f4acb3e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 03:23:56 +0000 Subject: [PATCH 1/4] Initial plan From b8c44df7f90b9c3ee0977392ba19b0cd3f76bf87 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 03:26:37 +0000 Subject: [PATCH 2/4] Add custom AAR field to llm-android.yml workflow Co-authored-by: kirklandsign <107070759+kirklandsign@users.noreply.github.com> --- .github/workflows/llm-android.yml | 13 ++++++++++++- llm/android/LlamaDemo/scripts/run-ci-tests.sh | 17 +++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index 789ba0f266..1177c9c7eb 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -32,6 +32,10 @@ on: description: 'Custom URL for tokenizer file (only used when model_preset is custom)' required: false type: string + local_aar: + description: 'URL to download a local AAR file. When set, the workflow will download the AAR and use it instead of the Maven dependency.' + required: false + type: string permissions: contents: read @@ -74,6 +78,12 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 + - name: Download local AAR + if: ${{ inputs.local_aar }} + run: | + mkdir -p llm/android/LlamaDemo/app/libs + curl -fL -o llm/android/LlamaDemo/app/libs/executorch.aar "${{ inputs.local_aar }}" + - name: AVD cache uses: actions/cache@v4 id: avd-cache @@ -145,6 +155,7 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 env: MODEL_PRESET: ${{ inputs.model_preset || 'stories' }} + USE_LOCAL_AAR: ${{ inputs.local_aar != '' }} with: api-level: ${{ env.API_LEVEL }} arch: ${{ env.ARCH }} @@ -154,7 +165,7 @@ jobs: emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save -memory 16384 disable-animations: true working-directory: llm/android/LlamaDemo - script: bash ./scripts/run-ci-tests.sh "$MODEL_PRESET" "$MODEL_FILE" "$TOKENIZER_FILE" + script: bash ./scripts/run-ci-tests.sh "$MODEL_PRESET" "$MODEL_FILE" "$TOKENIZER_FILE" "$USE_LOCAL_AAR" - name: Add model response to summary if: always() diff --git a/llm/android/LlamaDemo/scripts/run-ci-tests.sh b/llm/android/LlamaDemo/scripts/run-ci-tests.sh index a26ecbbc49..729616012a 100755 --- a/llm/android/LlamaDemo/scripts/run-ci-tests.sh +++ b/llm/android/LlamaDemo/scripts/run-ci-tests.sh @@ -6,7 +6,7 @@ # LICENSE file in the root directory of this source tree. # CI test script for running instrumentation tests with pre-downloaded models -# Usage: ./run-ci-tests.sh +# Usage: ./run-ci-tests.sh [use_local_aar] # # This script is designed for CI environments where models are pre-downloaded # to /tmp/llama_models/ before the emulator starts. @@ -16,11 +16,13 @@ set -ex MODEL_PRESET="$1" MODEL_FILE="$2" TOKENIZER_FILE="$3" +USE_LOCAL_AAR="${4:-false}" echo "=== Test Configuration ===" echo "MODEL_PRESET: $MODEL_PRESET" echo "MODEL_FILE: $MODEL_FILE" echo "TOKENIZER_FILE: $TOKENIZER_FILE" +echo "USE_LOCAL_AAR: $USE_LOCAL_AAR" echo "=== Emulator Memory Info ===" adb shell cat /proc/meminfo | head -5 @@ -90,9 +92,16 @@ adb logcat > /tmp/logcat.txt & LOGCAT_PID=$! echo "=== Starting Gradle ===" -./gradlew connectedCheck \ - -PskipModelDownload=true \ - -PmodelPreset="$MODEL_PRESET" +if [ "$USE_LOCAL_AAR" = "true" ]; then + ./gradlew connectedCheck \ + -PskipModelDownload=true \ + -PmodelPreset="$MODEL_PRESET" \ + -PuseLocalAar=true +else + ./gradlew connectedCheck \ + -PskipModelDownload=true \ + -PmodelPreset="$MODEL_PRESET" +fi TEST_EXIT_CODE=$? echo "=== Model directory after Gradle ===" From c6a2e5ca8250f044f5447e89c5e0463028da7b45 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 03:27:25 +0000 Subject: [PATCH 3/4] Refactor gradle command to reduce code duplication Co-authored-by: kirklandsign <107070759+kirklandsign@users.noreply.github.com> --- llm/android/LlamaDemo/scripts/run-ci-tests.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/llm/android/LlamaDemo/scripts/run-ci-tests.sh b/llm/android/LlamaDemo/scripts/run-ci-tests.sh index 729616012a..ed84cfbcd7 100755 --- a/llm/android/LlamaDemo/scripts/run-ci-tests.sh +++ b/llm/android/LlamaDemo/scripts/run-ci-tests.sh @@ -92,16 +92,11 @@ adb logcat > /tmp/logcat.txt & LOGCAT_PID=$! echo "=== Starting Gradle ===" +GRADLE_ARGS="-PskipModelDownload=true -PmodelPreset=$MODEL_PRESET" if [ "$USE_LOCAL_AAR" = "true" ]; then - ./gradlew connectedCheck \ - -PskipModelDownload=true \ - -PmodelPreset="$MODEL_PRESET" \ - -PuseLocalAar=true -else - ./gradlew connectedCheck \ - -PskipModelDownload=true \ - -PmodelPreset="$MODEL_PRESET" + GRADLE_ARGS="$GRADLE_ARGS -PuseLocalAar=true" fi +./gradlew connectedCheck $GRADLE_ARGS TEST_EXIT_CODE=$? echo "=== Model directory after Gradle ===" From c9c96ba495763b166b490f00d19c00af8d5a0aad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 03:28:21 +0000 Subject: [PATCH 4/4] Add proper quoting to gradle arguments Co-authored-by: kirklandsign <107070759+kirklandsign@users.noreply.github.com> --- llm/android/LlamaDemo/scripts/run-ci-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llm/android/LlamaDemo/scripts/run-ci-tests.sh b/llm/android/LlamaDemo/scripts/run-ci-tests.sh index ed84cfbcd7..cfe6f8d662 100755 --- a/llm/android/LlamaDemo/scripts/run-ci-tests.sh +++ b/llm/android/LlamaDemo/scripts/run-ci-tests.sh @@ -92,11 +92,11 @@ adb logcat > /tmp/logcat.txt & LOGCAT_PID=$! echo "=== Starting Gradle ===" -GRADLE_ARGS="-PskipModelDownload=true -PmodelPreset=$MODEL_PRESET" +GRADLE_ARGS="-PskipModelDownload=true -PmodelPreset=\"$MODEL_PRESET\"" if [ "$USE_LOCAL_AAR" = "true" ]; then GRADLE_ARGS="$GRADLE_ARGS -PuseLocalAar=true" fi -./gradlew connectedCheck $GRADLE_ARGS +eval ./gradlew connectedCheck "$GRADLE_ARGS" TEST_EXIT_CODE=$? echo "=== Model directory after Gradle ==="