char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
234a6ebaa
char/aliceai-t5-moe
1name : CI (android) 2 3on : 4workflow_dispatch : 5push : 6branches : 7- master 8paths : 9- '.github/workflows/build-android.yml' 10- '**/CMakeLists.txt' 11- '**/.cmake' 12- '**/*.h' 13- '**/*.hpp' 14- '**/*.c' 15- '**/*.cpp' 16 17pull_request : 18types : [ opened , synchronize , reopened ] 19paths : 20- '.github/workflows/build-android.yml' 21- 'examples/llama.android/**' 22 23concurrency : 24group : ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} 25cancel-in-progress : true 26 27env : 28GGML_NLOOP : 3 29GGML_N_THREADS : 1 30LLAMA_ARG_LOG_COLORS : 1 31LLAMA_ARG_LOG_PREFIX : 1 32LLAMA_ARG_LOG_TIMESTAMPS : 1 33 34jobs : 35default : 36runs-on : ubuntu-latest 37 38steps : 39- name : Clone 40uses : actions/checkout@v6 41with : 42fetch-depth : 0 43lfs : false 44 45- name : Set up JDK 46uses : actions/setup-java@v5 47with : 48java-version : 17 49distribution : zulu 50 51- name : Setup Android SDK 52uses : android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 53with : 54log-accepted-android-sdk-licenses : false 55 56- name : Build 57run : | 58cd examples/llama.android 59./gradlew build --no-daemon 60 61ndk : 62runs-on : ubuntu-latest 63container : 64image : 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3' 65defaults : 66run : 67shell : bash 68 69steps : 70- name : Clone 71uses : actions/checkout@v6 72with : 73fetch-depth : 0 74lfs : false 75 76- name : Dependencies 77run : | 78apt-get update 79apt-get install -y build-essential 80 81- name : Build 82id : ndk_build 83run : | 84cmake -D ANDROID_ABI=arm64-v8a -D ANDROID_PLATFORM=android-31 -D CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -D GGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.5-a+fp16+i8mm -G Ninja -D LLAMA_OPENSSL=OFF -D GGML_OPENMP=OFF -B build 85cmake --build build 86cmake --install build --prefix pkg-adb/llama.cpp 87 88- name : Upload Android Build Artifact 89if : ${{ always() && steps.ndk_build.outcome == 'success' }} 90uses : actions/upload-artifact@v6 91with : 92name : llama-cpp-android-arm64-cpu 93path : pkg-adb/llama.cpp 94 95arm64 : 96runs-on : ubuntu-latest 97 98env : 99NDK_VERSION : "29.0.14206865" 100 101steps : 102- name : Clone 103id : checkout 104uses : actions/checkout@v6 105 106# note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789) 107# for some reason, the ccache does not improve the build time in this case 108# example: 109# cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831 110# cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394 111# 112#- name: ccache 113# uses: ggml-org/ccache-action@v1.2.24 114# with: 115# key: android-ubuntu-arm64 116# evict-old-files: 1d 117# save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 118 119- name : Set up JDK 120uses : actions/setup-java@v5 121with : 122java-version : 17 123distribution : temurin 124 125- name : Setup Android SDK 126uses : android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 127with : 128log-accepted-android-sdk-licenses : false 129 130- name : Install NDK 131run : | 132sdkmanager "ndk;${{ env.NDK_VERSION }}" 133echo "ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.NDK_VERSION }}" >> $GITHUB_ENV 134 135- name : Build 136id : cmake_build 137run : | 138 cmake -B build \ 139 -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ 140 -DANDROID_ABI=arm64-v8a \ 141 -DANDROID_PLATFORM=android-28 \ 142 -DLLAMA_FATAL_WARNINGS=ON \ 143 -DGGML_BACKEND_DL=ON \ 144 -DGGML_NATIVE=OFF \ 145 -DGGML_CPU_ALL_VARIANTS=ON \ 146 -DGGML_OPENMP=OFF \ 147 -DLLAMA_BUILD_BORINGSSL=ON \ 148 -DGGML_RPC=ON 149 time cmake --build build --config Release -j $(nproc)