|
| 1 | +# Server build and tests conversion from safetensors and inference |
| 2 | +name: Server conversion and inference |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: # allows manual triggering |
| 6 | + inputs: |
| 7 | + sha: |
| 8 | + description: 'Commit SHA1 to build' |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + slow_tests: |
| 12 | + description: 'Run slow tests' |
| 13 | + required: true |
| 14 | + type: boolean |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - master |
| 18 | + 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 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + server: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken |
| 34 | + build_type: [RelWithDebInfo] |
| 35 | + include: |
| 36 | + - build_type: Release |
| 37 | + sanitizer: "" |
| 38 | + fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Dependencies |
| 42 | + id: depends |
| 43 | + run: | |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get -y install \ |
| 46 | + build-essential \ |
| 47 | + xxd \ |
| 48 | + git \ |
| 49 | + cmake \ |
| 50 | + curl \ |
| 51 | + wget \ |
| 52 | + language-pack-en \ |
| 53 | + libcurl4-openssl-dev |
| 54 | +
|
| 55 | + - name: Clone |
| 56 | + id: checkout |
| 57 | + uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + fetch-depth: 0 |
| 60 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 61 | + |
| 62 | + - name: Python setup |
| 63 | + id: setup_python |
| 64 | + uses: actions/setup-python@v5 |
| 65 | + with: |
| 66 | + python-version: '3.11' |
| 67 | + |
| 68 | + - name: Tests dependencies |
| 69 | + id: test_dependencies |
| 70 | + run: | |
| 71 | + pip install -r examples/server/tests/requirements.txt |
| 72 | +
|
| 73 | + - name: Verify server deps |
| 74 | + id: verify_server_deps |
| 75 | + run: | |
| 76 | + git config --global --add safe.directory $(realpath .) |
| 77 | + cd examples/server |
| 78 | + git ls-files --others --modified |
| 79 | + git status |
| 80 | + ./deps.sh |
| 81 | + git status |
| 82 | + not_ignored_files="$(git ls-files --others --modified)" |
| 83 | + echo "Modified files: ${not_ignored_files}" |
| 84 | + if [ -n "${not_ignored_files}" ]; then |
| 85 | + echo "Repository is dirty or server deps are not built as expected" |
| 86 | + echo "${not_ignored_files}" |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | +
|
| 90 | + - name: Build (no OpenMP) |
| 91 | + id: cmake_build_no_openmp |
| 92 | + if: ${{ matrix.sanitizer == 'THREAD' }} |
| 93 | + run: | |
| 94 | + cmake -B build \ |
| 95 | + -DGGML_NATIVE=OFF \ |
| 96 | + -DLLAMA_BUILD_SERVER=ON \ |
| 97 | + -DLLAMA_CURL=ON \ |
| 98 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 99 | + -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \ |
| 100 | + -DGGML_OPENMP=OFF ; |
| 101 | + cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server |
| 102 | +
|
| 103 | + - name: Build |
| 104 | + id: cmake_build |
| 105 | + if: ${{ matrix.sanitizer != 'THREAD' }} |
| 106 | + run: | |
| 107 | + cmake -B build \ |
| 108 | + -DGGML_NATIVE=OFF \ |
| 109 | + -DLLAMA_BUILD_SERVER=ON \ |
| 110 | + -DLLAMA_CURL=ON \ |
| 111 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 112 | + -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ; |
| 113 | + cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server |
| 114 | +
|
| 115 | + - name: Lora convert and inference tests |
| 116 | + id: test_lora_conversion_inference |
| 117 | + if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }} |
| 118 | + run: ./tests/test-lora-conversion-inference.sh |
| 119 | + |
| 120 | + |
| 121 | + server-windows: |
| 122 | + runs-on: windows-2019 |
| 123 | + |
| 124 | + steps: |
| 125 | + - name: Clone |
| 126 | + id: checkout |
| 127 | + uses: actions/checkout@v4 |
| 128 | + with: |
| 129 | + fetch-depth: 0 |
| 130 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 131 | + |
| 132 | + - name: libCURL |
| 133 | + id: get_libcurl |
| 134 | + env: |
| 135 | + CURL_VERSION: 8.6.0_6 |
| 136 | + run: | |
| 137 | + curl.exe -o $env:RUNNER_TEMP/curl.zip -L "https://curl.se/windows/dl-${env:CURL_VERSION}/curl-${env:CURL_VERSION}-win64-mingw.zip" |
| 138 | + mkdir $env:RUNNER_TEMP/libcurl |
| 139 | + tar.exe -xvf $env:RUNNER_TEMP/curl.zip --strip-components=1 -C $env:RUNNER_TEMP/libcurl |
| 140 | +
|
| 141 | + - name: Build |
| 142 | + id: cmake_build |
| 143 | + run: | |
| 144 | + cmake -B build -DLLAMA_CURL=ON -DCURL_LIBRARY="$env:RUNNER_TEMP/libcurl/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:RUNNER_TEMP/libcurl/include" |
| 145 | + cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS} --target llama-server |
| 146 | +
|
| 147 | + - name: Python setup |
| 148 | + id: setup_python |
| 149 | + uses: actions/setup-python@v5 |
| 150 | + with: |
| 151 | + python-version: '3.11' |
| 152 | + |
| 153 | + - name: Tests dependencies |
| 154 | + id: test_dependencies |
| 155 | + run: | |
| 156 | + pip install -r examples/server/tests/requirements.txt |
| 157 | +
|
| 158 | + - name: Copy Libcurl |
| 159 | + id: prepare_libcurl |
| 160 | + run: | |
| 161 | + cp $env:RUNNER_TEMP/libcurl/bin/libcurl-x64.dll ./build/bin/Release/libcurl-x64.dll |
| 162 | +
|
| 163 | + - name: Lora convert and inference tests |
| 164 | + id: test_lora_conversion_inference |
| 165 | + if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }} |
| 166 | + run: ./tests/test-lora-conversion-inference.sh |
0 commit comments