Team Ai
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 20d agoView on Hugging Face
0likes1.2kdownloads
build-android.yml150 linesDownload Raw Back to workflows
1name: CI (android)2 3on:4  workflow_dispatch:5  push:6    branches:7      - master8    paths:9      - '.github/workflows/build-android.yml'10      - '**/CMakeLists.txt'11      - '**/.cmake'12      - '**/*.h'13      - '**/*.hpp'14      - '**/*.c'15      - '**/*.cpp'16 17  pull_request:18    types: [opened, synchronize, reopened]19    paths:20      - '.github/workflows/build-android.yml'21      - 'examples/llama.android/**'22 23concurrency:24  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}25  cancel-in-progress: true26 27env:28  GGML_NLOOP: 329  GGML_N_THREADS: 130  LLAMA_ARG_LOG_COLORS: 131  LLAMA_ARG_LOG_PREFIX: 132  LLAMA_ARG_LOG_TIMESTAMPS: 133 34jobs:35  default:36    runs-on: ubuntu-24.04  # previously ubuntu-latest37 38    steps:39      - name: Clone40        uses: actions/checkout@v641        with:42          fetch-depth: 043          lfs: false44 45      - name: Set up JDK46        uses: actions/setup-java@v547        with:48          java-version: 1749          distribution: zulu50 51      - name: Setup Android SDK52        uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.453        with:54          log-accepted-android-sdk-licenses: false55 56      - name: Build57        run: |58          cd examples/llama.android59          ./gradlew build --no-daemon60 61  ndk:62    runs-on: ubuntu-24.04  # previously ubuntu-latest63    container:64      image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3'65    defaults:66      run:67        shell: bash68 69    steps:70      - name: Clone71        uses: actions/checkout@v672        with:73          fetch-depth: 074          lfs: false75 76      - name: Dependencies77        run: |78          apt-get update79          apt-get install -y build-essential80 81      - name: Build82        id: ndk_build83        run: |84          cmake -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 build85          cmake --build build86          cmake --install build --prefix pkg-adb/llama.cpp87 88      - name: Upload Android Build Artifact89        if: ${{ always() && steps.ndk_build.outcome == 'success' }}90        uses: actions/upload-artifact@v691        with:92          name: llama-cpp-android-arm64-cpu93          path: pkg-adb/llama.cpp94 95  arm64:96    runs-on: ubuntu-24.04  # previously ubuntu-latest97 98    env:99      NDK_VERSION: "29.0.14206865"100 101    steps:102      - name: Clone103        id: checkout104        uses: actions/checkout@v6105 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 case108      # example:109      #   cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831110      #   cache on:  https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394111      #112      #- name: ccache113      #  uses: ggml-org/ccache-action@v1.2.24114      #  with:115      #    key: android-ubuntu-arm64116      #    evict-old-files: 1d117      #    save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}118 119      - name: Set up JDK120        uses: actions/setup-java@v5121        with:122          java-version: 17123          distribution: temurin124 125      - name: Setup Android SDK126        uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4127        with:128          log-accepted-android-sdk-licenses: false129 130      - name: Install NDK131        run: |132          sdkmanager "ndk;${{ env.NDK_VERSION }}"133          echo "ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.NDK_VERSION }}" >> $GITHUB_ENV134 135      - name: Build136        id: cmake_build137        run: |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=ON149          time cmake --build build --config Release -j $(nproc)150