From 2475175805fe9be7170e7077b35eadb1a1ea0517 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 15:52:23 -0800 Subject: [PATCH 1/7] Split LlamaDemo Android workflow into separate file Move LlamaDemo build and instrumentation tests to llm-android.yml with pull_request trigger. Keep android-build.yml for nightly builds of both LlamaDemo and DeepLabV3Demo on schedule only. --- .github/workflows/android-build.yml | 70 ---------------- .github/workflows/llm-android.yml | 124 ++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/llm-android.yml diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index c6f77fd00c..e66a839a97 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -7,8 +7,6 @@ name: Android Build on: - pull_request: - branches: [main] schedule: # Run nightly at midnight UTC - cron: '0 0 * * *' @@ -69,71 +67,3 @@ jobs: name: ${{ matrix.name }}-apk path: ${{ matrix.path }}/app/build/outputs/apk/ if-no-files-found: warn - - instrumentation-test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - name: LlamaDemo - path: llm/android/LlamaDemo - env: - API_LEVEL: 34 - ARCH: x86_64 - EMULATOR_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - - name: Instrumentation Test ${{ matrix.name }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - - name: AVD cache - uses: actions/cache@v4 - id: avd-cache - with: - path: | - ~/.android/avd/* - ~/.android/adb* - key: avd-${{ env.API_LEVEL }}-${{ env.ARCH }} - - - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ env.API_LEVEL }} - arch: ${{ env.ARCH }} - force-avd-creation: false - ram-size: 16384M - emulator-options: ${{ env.EMULATOR_OPTIONS }} - disable-animations: false - working-directory: ${{ matrix.path }} - script: echo "Generated AVD snapshot for caching." - - - name: Run instrumentation tests - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ env.API_LEVEL }} - arch: ${{ env.ARCH }} - force-avd-creation: false - ram-size: 6144M - emulator-options: -no-snapshot-save ${{ env.EMULATOR_OPTIONS }} - disable-animations: true - working-directory: ${{ matrix.path }} - script: | - ./gradlew connectedCheck diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml new file mode 100644 index 0000000000..f29c04a32a --- /dev/null +++ b/.github/workflows/llm-android.yml @@ -0,0 +1,124 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +name: LlamaDemo Android + +on: + pull_request: + branches: [main] + paths: + - 'llm/android/**' + - '.github/workflows/llm-android.yml' + workflow_dispatch: + inputs: + 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 + +jobs: + build: + runs-on: ubuntu-latest + name: Build LlamaDemo + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - 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: Build with Gradle + working-directory: llm/android/LlamaDemo + run: | + if [ -n "${{ inputs.local_aar }}" ]; then + ./gradlew build --no-daemon -PuseLocalAar=true + else + ./gradlew build --no-daemon + fi + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: LlamaDemo-apk + path: llm/android/LlamaDemo/app/build/outputs/apk/ + if-no-files-found: warn + + instrumentation-test: + runs-on: ubuntu-latest + env: + API_LEVEL: 34 + ARCH: x86_64 + EMULATOR_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + + name: Instrumentation Test LlamaDemo + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ env.API_LEVEL }}-${{ env.ARCH }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.API_LEVEL }} + arch: ${{ env.ARCH }} + force-avd-creation: false + ram-size: 16384M + emulator-options: ${{ env.EMULATOR_OPTIONS }} + disable-animations: false + working-directory: llm/android/LlamaDemo + script: echo "Generated AVD snapshot for caching." + + - name: Run instrumentation tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.API_LEVEL }} + arch: ${{ env.ARCH }} + force-avd-creation: false + ram-size: 6144M + emulator-options: -no-snapshot-save ${{ env.EMULATOR_OPTIONS }} + disable-animations: true + working-directory: llm/android/LlamaDemo + script: | + ./gradlew connectedCheck From 0f044e1d383a6e9304e379f18b8cde1477733234 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:01:58 -0800 Subject: [PATCH 2/7] Remove build job from llm-android.yml, keep only instrumentation test The build is already handled by android-build.yml on schedule. This workflow now only runs connectedCheck for PR validation. --- .github/workflows/llm-android.yml | 45 +------------------------------ 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index f29c04a32a..d25c4d3481 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -13,54 +13,11 @@ on: - 'llm/android/**' - '.github/workflows/llm-android.yml' workflow_dispatch: - inputs: - 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 jobs: - build: - runs-on: ubuntu-latest - name: Build LlamaDemo - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - 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: Build with Gradle - working-directory: llm/android/LlamaDemo - run: | - if [ -n "${{ inputs.local_aar }}" ]; then - ./gradlew build --no-daemon -PuseLocalAar=true - else - ./gradlew build --no-daemon - fi - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: LlamaDemo-apk - path: llm/android/LlamaDemo/app/build/outputs/apk/ - if-no-files-found: warn - instrumentation-test: runs-on: ubuntu-latest env: @@ -104,7 +61,7 @@ jobs: api-level: ${{ env.API_LEVEL }} arch: ${{ env.ARCH }} force-avd-creation: false - ram-size: 16384M + ram-size: 6144M emulator-options: ${{ env.EMULATOR_OPTIONS }} disable-animations: false working-directory: llm/android/LlamaDemo From 660b493e10bf7f9dac749c43978eb34dad41e7ac Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:08:02 -0800 Subject: [PATCH 3/7] Add configurable model URL inputs for instrumentation tests - Add pte_url and tokenizer_url workflow_dispatch inputs with stories model defaults - Download and rename files to model.pte and tokenizer.model - Update SanityCheck.java and UIWorkflowTest.java to use model.pte - Add skipModelDownload gradle flag to skip automatic download when CI pushes models directly --- .github/workflows/llm-android.yml | 33 ++++++++++- llm/android/LlamaDemo/app/build.gradle.kts | 59 +++++++++++-------- .../executorchllamademo/SanityCheck.java | 2 +- .../executorchllamademo/UIWorkflowTest.java | 12 ++-- 4 files changed, 75 insertions(+), 31 deletions(-) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index d25c4d3481..4a18181bf8 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -13,10 +13,26 @@ on: - 'llm/android/**' - '.github/workflows/llm-android.yml' workflow_dispatch: + inputs: + pte_url: + description: 'URL to download model .pte file' + required: false + type: string + default: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/stories110M.pte' + tokenizer_url: + description: 'URL to download tokenizer file' + required: false + type: string + default: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/tokenizer.model' permissions: contents: read +env: + # Default URLs for pull_request trigger (workflow_dispatch inputs override these) + DEFAULT_PTE_URL: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/stories110M.pte' + DEFAULT_TOKENIZER_URL: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/tokenizer.model' + jobs: instrumentation-test: runs-on: ubuntu-latest @@ -45,6 +61,19 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 + - name: Download model files + run: | + PTE_URL="${{ inputs.pte_url || env.DEFAULT_PTE_URL }}" + TOKENIZER_URL="${{ inputs.tokenizer_url || env.DEFAULT_TOKENIZER_URL }}" + + mkdir -p /tmp/llama-models + echo "Downloading model from $PTE_URL" + curl -fL -o /tmp/llama-models/model.pte "$PTE_URL" + echo "Downloading tokenizer from $TOKENIZER_URL" + curl -fL -o /tmp/llama-models/tokenizer.model "$TOKENIZER_URL" + + ls -la /tmp/llama-models/ + - name: AVD cache uses: actions/cache@v4 id: avd-cache @@ -78,4 +107,6 @@ jobs: disable-animations: true working-directory: llm/android/LlamaDemo script: | - ./gradlew connectedCheck + adb push /tmp/llama-models/model.pte /data/local/tmp/llama/ + adb push /tmp/llama-models/tokenizer.model /data/local/tmp/llama/ + ./gradlew connectedCheck -PskipModelDownload=true diff --git a/llm/android/LlamaDemo/app/build.gradle.kts b/llm/android/LlamaDemo/app/build.gradle.kts index 5335e4f45c..ed5c06d95c 100644 --- a/llm/android/LlamaDemo/app/build.gradle.kts +++ b/llm/android/LlamaDemo/app/build.gradle.kts @@ -14,10 +14,11 @@ plugins { // Model files configuration for instrumentation tests val modelFilesBaseUrl = "https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114" val deviceModelDir = "/data/local/tmp/llama" -val modelFiles = listOf( - "stories110M.pte", - "tokenizer.model" +val modelFiles = mapOf( + "stories110M.pte" to "model.pte", + "tokenizer.model" to "tokenizer.model" ) +val skipModelDownload: Boolean = (project.findProperty("skipModelDownload") as? String)?.toBoolean() ?: false fun execCmd(vararg args: String): String { val process = ProcessBuilder(*args) @@ -42,6 +43,11 @@ tasks.register("pushModelFiles") { group = "verification" doLast { + if (skipModelDownload) { + logger.lifecycle("Skipping model download (skipModelDownload=true)") + return@doLast + } + // Check if adb is available val adbPath = android.adbExecutable.absolutePath val (adbCheckCode, _) = execCmdWithExitCode(adbPath, "devices") @@ -50,8 +56,8 @@ tasks.register("pushModelFiles") { } // Check which files need to be pushed - val filesToPush = modelFiles.filter { fileName -> - val devicePath = "$deviceModelDir/$fileName" + val filesToPush = modelFiles.filter { (_, targetName) -> + val devicePath = "$deviceModelDir/$targetName" val (exitCode, _) = execCmdWithExitCode(adbPath, "shell", "test -f $devicePath && echo exists") exitCode != 0 } @@ -61,7 +67,7 @@ tasks.register("pushModelFiles") { return@doLast } - logger.lifecycle("Need to push ${filesToPush.size} model file(s): ${filesToPush.joinToString(", ")}") + logger.lifecycle("Need to push ${filesToPush.size} model file(s): ${filesToPush.values.joinToString(", ")}") // Create temp directory using mktemp val tempDir = execCmd("mktemp", "-d") @@ -71,45 +77,52 @@ tasks.register("pushModelFiles") { // Create device directory execCmd(adbPath, "shell", "mkdir -p $deviceModelDir") - for (fileName in filesToPush) { - val localPath = "$tempDir/$fileName" - val checksumPath = "$tempDir/$fileName.sha256sums" - val devicePath = "$deviceModelDir/$fileName" + for ((sourceName, targetName) in filesToPush) { + val localPath = "$tempDir/$targetName" + val checksumPath = "$tempDir/$sourceName.sha256sums" + val devicePath = "$deviceModelDir/$targetName" - // Download file - logger.lifecycle("Downloading $fileName...") + // Download file (with original name for checksum verification, then rename) + val downloadPath = "$tempDir/$sourceName" + logger.lifecycle("Downloading $sourceName...") val (dlCode, dlOutput) = execCmdWithExitCode( - "curl", "-fL", "-o", localPath, "$modelFilesBaseUrl/$fileName" + "curl", "-fL", "-o", downloadPath, "$modelFilesBaseUrl/$sourceName" ) if (dlCode != 0) { - throw GradleException("Failed to download $fileName: $dlOutput") + throw GradleException("Failed to download $sourceName: $dlOutput") } // Download and verify checksum - logger.lifecycle("Verifying checksum for $fileName...") + logger.lifecycle("Verifying checksum for $sourceName...") val (csDownloadCode, csDownloadOutput) = execCmdWithExitCode( - "curl", "-fL", "-o", checksumPath, "$modelFilesBaseUrl/$fileName.sha256sums" + "curl", "-fL", "-o", checksumPath, "$modelFilesBaseUrl/$sourceName.sha256sums" ) if (csDownloadCode != 0) { - throw GradleException("Failed to download checksum for $fileName: $csDownloadOutput") + throw GradleException("Failed to download checksum for $sourceName: $csDownloadOutput") } // Verify checksum (run sha256sum in the temp directory) val (verifyCode, verifyOutput) = execCmdWithExitCode( - "bash", "-c", "cd $tempDir && sha256sum -c $fileName.sha256sums" + "bash", "-c", "cd $tempDir && sha256sum -c $sourceName.sha256sums" ) if (verifyCode != 0) { - throw GradleException("Checksum verification failed for $fileName: $verifyOutput") + throw GradleException("Checksum verification failed for $sourceName: $verifyOutput") + } + logger.lifecycle("Checksum verified for $sourceName") + + // Rename file if needed + if (sourceName != targetName) { + execCmd("mv", downloadPath, localPath) + logger.lifecycle("Renamed $sourceName to $targetName") } - logger.lifecycle("Checksum verified for $fileName") // Push to device - logger.lifecycle("Pushing $fileName to device...") + logger.lifecycle("Pushing $targetName to device...") val (pushCode, pushOutput) = execCmdWithExitCode(adbPath, "push", localPath, devicePath) if (pushCode != 0) { - throw GradleException("Failed to push $fileName to device: $pushOutput") + throw GradleException("Failed to push $targetName to device: $pushOutput") } - logger.lifecycle("Successfully pushed $fileName") + logger.lifecycle("Successfully pushed $targetName") } } finally { // Clean up temp directory diff --git a/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/SanityCheck.java b/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/SanityCheck.java index 714ef09f0a..a5fe8b126e 100644 --- a/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/SanityCheck.java +++ b/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/SanityCheck.java @@ -25,7 +25,7 @@ public class SanityCheck implements LlmCallback { private static final String RESOURCE_PATH = "/data/local/tmp/llama/"; private static final String TOKENIZER_PATH = "tokenizer.model"; - private static final String MODEL_PATH = "stories110M.pte"; + private static final String MODEL_PATH = "model.pte"; private final List results = new ArrayList<>(); diff --git a/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/UIWorkflowTest.java b/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/UIWorkflowTest.java index a1b901d68f..d1b599d974 100644 --- a/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/UIWorkflowTest.java +++ b/llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/UIWorkflowTest.java @@ -70,7 +70,7 @@ public void clearSharedPreferences() { * 1. Dismiss the "Please Select a Model" dialog * 2. Click settings button * 3. Verify model path and tokenizer path show default "no selection" text - * 4. Click model selection, select stories110M.pte + * 4. Click model selection, select model.pte * 5. Click tokenizer selection, select tokenizer.model * 6. Click load model button */ @@ -92,10 +92,10 @@ public void testModelLoadingWorkflow() throws Exception { onView(withId(R.id.modelTextView)).check(matches(withText("no model selected"))); onView(withId(R.id.tokenizerTextView)).check(matches(withText("no tokenizer selected"))); - // Step 3: Click model selection button and select stories110M.pte + // Step 3: Click model selection button and select model.pte onView(withId(R.id.modelImageButton)).perform(click()); - // Select the model file containing "stories110M.pte" - onData(hasToString(containsString("stories110M.pte"))).inRoot(isDialog()).perform(click()); + // Select the model file containing "model.pte" + onData(hasToString(containsString("model.pte"))).inRoot(isDialog()).perform(click()); // Step 4: Click tokenizer selection button and select tokenizer.model onView(withId(R.id.tokenizerImageButton)).perform(click()); @@ -139,10 +139,10 @@ public void testSendMessageAndReceiveResponse() throws Exception { // Verify load button is initially disabled (no model/tokenizer selected) onView(withId(R.id.loadModelButton)).check(matches(not(isEnabled()))); - // Select model - choose stories110M.pte + // Select model - choose model.pte onView(withId(R.id.modelImageButton)).perform(click()); Thread.sleep(300); // Wait for dialog to appear - onData(hasToString(containsString("stories110M.pte"))).inRoot(isDialog()).perform(click()); + onData(hasToString(containsString("model.pte"))).inRoot(isDialog()).perform(click()); Thread.sleep(300); // Wait for dialog to dismiss and UI to update // Select tokenizer - choose tokenizer.model From 9eff3232097768a3d0687aaa32248da1f29fa41a Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:15:06 -0800 Subject: [PATCH 4/7] Fix --- .github/workflows/llm-android.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index 4a18181bf8..141ca0e4e5 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -107,6 +107,7 @@ jobs: disable-animations: true working-directory: llm/android/LlamaDemo script: | + adb shell mkdir -p /data/local/tmp/llama/ adb push /tmp/llama-models/model.pte /data/local/tmp/llama/ adb push /tmp/llama-models/tokenizer.model /data/local/tmp/llama/ ./gradlew connectedCheck -PskipModelDownload=true From 923442b53bbd0260618121404552e31cc6ee01b5 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:22:28 -0800 Subject: [PATCH 5/7] Use linux.24xl.spr-metal runner for LlamaDemo instrumentation tests --- .github/workflows/llm-android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index 141ca0e4e5..f92f678309 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -35,7 +35,7 @@ env: jobs: instrumentation-test: - runs-on: ubuntu-latest + runs-on: linux.24xl.spr-metal env: API_LEVEL: 34 ARCH: x86_64 From 25b762b2522a195f5aedeb93b431933832ce3310 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:47:31 -0800 Subject: [PATCH 6/7] Add X11 library dependencies for Android emulator on metal runner The emulator requires libx11-xcb and related libraries even in headless mode. Without these, the emulator fails with "Could not open libX11-xcb.so.1" and never boots. --- .github/workflows/llm-android.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index f92f678309..bce6ef57f9 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -52,6 +52,24 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm + - name: Install Android Emulator dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libx11-xcb1 \ + libxcb1 \ + libxcb-glx0 \ + libxcb-shm0 \ + libpulse0 \ + libnss3 \ + libxcomposite1 \ + libxcursor1 \ + libxi6 \ + libxtst6 \ + libasound2 \ + libgl1-mesa-glx \ + libgl1-mesa-dri + - name: Set up JDK 17 uses: actions/setup-java@v4 with: From fcf1614f950245a7e40a092f6e5f1659351e5224 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 14 Jan 2026 16:50:18 -0800 Subject: [PATCH 7/7] Add Android SDK setup and emulator dependencies for metal runner The custom metal runner lacks pre-installed Android SDK and X11 libraries that GitHub-hosted runners have. This adds: - dnf packages for X11/graphics libs required by the emulator - android-actions/setup-android@v3 to install and configure the SDK - sdkmanager step to install emulator, platform-tools, and system image Fixes "undefined/platform-tools/adb" path issue and "Could not open libX11-xcb.so.1" error. --- .github/workflows/llm-android.yml | 35 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/llm-android.yml b/.github/workflows/llm-android.yml index bce6ef57f9..b379d2287f 100644 --- a/.github/workflows/llm-android.yml +++ b/.github/workflows/llm-android.yml @@ -54,21 +54,26 @@ jobs: - name: Install Android Emulator dependencies run: | - sudo apt-get update - sudo apt-get install -y \ - libx11-xcb1 \ - libxcb1 \ - libxcb-glx0 \ - libxcb-shm0 \ - libpulse0 \ - libnss3 \ - libxcomposite1 \ - libxcursor1 \ - libxi6 \ - libxtst6 \ - libasound2 \ - libgl1-mesa-glx \ - libgl1-mesa-dri + cat /etc/os-release + sudo dnf install -y \ + libX11-xcb \ + libxcb \ + pulseaudio-libs \ + nss \ + libXcomposite \ + libXcursor \ + libXi \ + libXtst \ + alsa-lib \ + mesa-libGL \ + mesa-dri-drivers + + - name: Set up Android SDK + uses: android-actions/setup-android@v3 + + - name: Install Android Emulator and system image + run: | + sdkmanager --install "emulator" "platform-tools" "platforms;android-${{ env.API_LEVEL }}" "system-images;android-${{ env.API_LEVEL }};default;${{ env.ARCH }}" - name: Set up JDK 17 uses: actions/setup-java@v4