Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
NDK_VERSION: '27.0.12077973'

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Install NDK and CMake
run: |
yes | sdkmanager --install "ndk;${{ env.NDK_VERSION }}" "cmake;3.22.1" || true

- name: Run unit tests
run: ./gradlew testDebugUnitTest --no-daemon -Pandroid.ndkVersion=${{ env.NDK_VERSION }}

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-results
path: app/build/reports/tests/

# Instrumented tests are disabled for now due to Vulkan shader compilation
# issues in CI. The tests also make real API calls to HuggingFace which
# makes them inherently flaky. Run locally with: ./gradlew connectedDebugAndroidTest
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "app/src/main/cpp/llama.cpp"]
path = app/src/main/cpp/llama.cpp
url = https://github.com/ggml-org/llama.cpp.git
[submodule "third_party/Vulkan-Headers"]
path = third_party/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ android {
buildFeatures {
viewBinding = true
}
ndkVersion = "28.2.13676358"
ndkVersion = project.findProperty("android.ndkVersion")?.toString() ?: "27.0.12077973"

packaging {
jniLibs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class HuggingFaceApiClientTest {
val files = result.getOrNull()!!

// Verify all required files found
assertTrue(files.configFile.isConfig)
assertNotNull(files.configFile)
assertTrue(files.configFile!!.isConfig)
assertTrue(files.languageFile.isGGUF)
assertTrue(files.visionFile.isMMProj)
assertNotNull(files.visionFile)
assertTrue(files.visionFile!!.isMMProj)
assertFalse(files.languageFile.isMMProj)
}

Expand Down
15 changes: 10 additions & 5 deletions app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(BUILD_TARGET "unknown")
set(LLAMA_BUILD_NUMBER 0)
set(LLAMA_BUILD_COMMIT "unknown")
set(LLAMA_BUILD_COMMON ON)
set(LLAMA_BUILD_TOOLS ON)
set(LLAMA_BUILD_TOOLS OFF)

# =============================================================================
# Vulkan Variant (Simplified - only build option)
Expand All @@ -26,14 +26,19 @@ set(LLAMA_BUILD_TOOLS ON)
set(GGML_VULKAN ON)
set(GGML_CPU_KLEIDIAI OFF)

# Set Vulkan headers path
set(VULKAN_HEADERS_INSTALL_DIR /home/bowserj/Vulkan-Headers)
set(Vulkan_INCLUDE_DIR /home/bowserj/Vulkan-Headers/include)
include_directories(/home/bowserj/Vulkan-Headers/include)
# Set Vulkan headers path (relative to project root)
set(VULKAN_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../third_party/Vulkan-Headers)
set(VULKAN_HEADERS_INSTALL_DIR ${VULKAN_HEADERS_DIR})
set(Vulkan_INCLUDE_DIR ${VULKAN_HEADERS_DIR}/include)
include_directories(${VULKAN_HEADERS_DIR}/include)

# Load llama.cpp
add_subdirectory(llama.cpp build-llama)

# Build mtmd (multimodal) library - not built when LLAMA_BUILD_TOOLS is OFF
set(LLAMA_INSTALL_VERSION "0.0.0")
add_subdirectory(llama.cpp/tools/mtmd build-mtmd)

# Build Vulkan library
add_library(baseweightsnap SHARED
mtmd-android.cpp
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/llama.cpp
Submodule llama.cpp added at f99ef5
1 change: 1 addition & 0 deletions third_party/Vulkan-Headers
Submodule Vulkan-Headers added at 2fa203