1
0

server.yml 6.1 KB

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