Team Ai
Apppublic

KBaba7/llama.cpp

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
server.yml240 linesDownload Raw Back to workflows
1# Server build and tests2name: Server3 4on:5  workflow_dispatch: # allows manual triggering6    inputs:7      sha:8        description: 'Commit SHA1 to build'9        required: false10        type: string11      slow_tests:12        description: 'Run slow tests'13        required: true14        type: boolean15  push:16    branches:17      - master18    paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/**.*']19  pull_request:20    types: [opened, synchronize, reopened]21    paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/**.*']22 23env:24  LLAMA_LOG_COLORS: 125  LLAMA_LOG_PREFIX: 126  LLAMA_LOG_TIMESTAMPS: 127  LLAMA_LOG_VERBOSITY: 1028 29concurrency:30  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }}31  cancel-in-progress: true32 33jobs:34  server:35    runs-on: ubuntu-latest36 37    strategy:38      matrix:39        sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken40        build_type: [RelWithDebInfo]41        include:42          - build_type: Release43            sanitizer: ""44      fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken45 46    steps:47      - name: Dependencies48        id: depends49        run: |50          sudo apt-get update51          sudo apt-get -y install \52            build-essential \53            xxd \54            git \55            cmake \56            curl \57            wget \58            language-pack-en \59            libcurl4-openssl-dev60 61      - name: Clone62        id: checkout63        uses: actions/checkout@v464        with:65          fetch-depth: 066          ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}67 68      - name: Python setup69        id: setup_python70        uses: actions/setup-python@v571        with:72          python-version: '3.11'73 74      - name: Tests dependencies75        id: test_dependencies76        run: |77          pip install -r examples/server/tests/requirements.txt78 79      # Setup nodejs (to be used for verifying bundled index.html)80      - uses: actions/setup-node@v481        with:82          node-version: '22.11.0'83 84      - name: WebUI - Install dependencies85        id: webui_lint86        run: |87          cd examples/server/webui88          npm ci89 90      - name: WebUI - Check code format91        id: webui_format92        run: |93          git config --global --add safe.directory $(realpath .)94          cd examples/server/webui95          git status96 97          npm run format98          git status99          modified_files="$(git status -s)"100          echo "Modified files: ${modified_files}"101          if [ -n "${modified_files}" ]; then102            echo "Files do not follow coding style. To fix: npm run format"103            echo "${modified_files}"104            exit 1105          fi106 107      - name: Verify bundled index.html108        id: verify_server_index_html109        run: |110          git config --global --add safe.directory $(realpath .)111          cd examples/server/webui112          git status113 114          npm run build115          git status116          modified_files="$(git status -s)"117          echo "Modified files: ${modified_files}"118          if [ -n "${modified_files}" ]; then119            echo "Repository is dirty or server/webui is not built as expected"120            echo "Hint: You may need to follow Web UI build guide in server/README.md"121            echo "${modified_files}"122            exit 1123          fi124 125      - name: Build (no OpenMP)126        id: cmake_build_no_openmp127        if: ${{ matrix.sanitizer == 'THREAD' }}128        run: |129          cmake -B build \130              -DGGML_NATIVE=OFF \131              -DLLAMA_BUILD_SERVER=ON \132              -DLLAMA_CURL=ON \133              -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \134              -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \135              -DGGML_OPENMP=OFF ;136          cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server137 138      - name: Build (sanitizers)139        id: cmake_build_sanitizers140        if: ${{ matrix.sanitizer != '' && matrix.sanitizer != 'THREAD' }}141        run: |142          cmake -B build \143              -DGGML_NATIVE=OFF \144              -DLLAMA_BUILD_SERVER=ON \145              -DLLAMA_CURL=ON \146              -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \147              -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;148          cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server149 150      - name: Build (sanitizers)151        id: cmake_build152        if: ${{ matrix.sanitizer == '' }}153        run: |154          cmake -B build \155              -DGGML_NATIVE=OFF \156              -DLLAMA_BUILD_SERVER=ON \157              -DLLAMA_CURL=ON \158              -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ;159          cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server160 161      - name: Tests162        id: server_integration_tests163        if: ${{ matrix.sanitizer == '' }}164        run: |165          cd examples/server/tests166          ./tests.sh167 168      - name: Tests (sanitizers)169        id: server_integration_tests_sanitizers170        if: ${{ matrix.sanitizer != '' }}171        run: |172          cd examples/server/tests173          LLAMA_SANITIZE=1 ./tests.sh174 175      - name: Slow tests176        id: server_integration_tests_slow177        if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}178        run: |179          cd examples/server/tests180          SLOW_TESTS=1 ./tests.sh181 182 183  server-windows:184    runs-on: windows-2019185 186    steps:187      - name: Clone188        id: checkout189        uses: actions/checkout@v4190        with:191          fetch-depth: 0192          ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}193 194      - name: libCURL195        id: get_libcurl196        env:197          CURL_VERSION: 8.6.0_6198        run: |199          curl.exe -o $env:RUNNER_TEMP/curl.zip -L "https://curl.se/windows/dl-${env:CURL_VERSION}/curl-${env:CURL_VERSION}-win64-mingw.zip"200          mkdir $env:RUNNER_TEMP/libcurl201          tar.exe -xvf $env:RUNNER_TEMP/curl.zip --strip-components=1 -C $env:RUNNER_TEMP/libcurl202 203      - name: Build204        id: cmake_build205        run: |206          cmake -B build -DLLAMA_CURL=ON -DCURL_LIBRARY="$env:RUNNER_TEMP/libcurl/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:RUNNER_TEMP/libcurl/include"207          cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS} --target llama-server208 209      - name: Python setup210        id: setup_python211        uses: actions/setup-python@v5212        with:213          python-version: '3.11'214 215      - name: Tests dependencies216        id: test_dependencies217        run: |218          pip install -r examples/server/tests/requirements.txt219 220      - name: Copy Libcurl221        id: prepare_libcurl222        run: |223          cp $env:RUNNER_TEMP/libcurl/bin/libcurl-x64.dll ./build/bin/Release/libcurl-x64.dll224 225      - name: Tests226        id: server_integration_tests227        if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}228        run: |229          cd examples/server/tests230          $env:PYTHONIOENCODING = ":replace"231          pytest -v -x -m "not slow"232 233      - name: Slow tests234        id: server_integration_tests_slow235        if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}236        run: |237          cd examples/server/tests238          $env:SLOW_TESTS = "1"239          pytest -v -x240