server.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # Server build and tests
  2. name: Server
  3. on:
  4. workflow_dispatch: # allows manual triggering
  5. inputs:
  6. slow_tests:
  7. description: 'Run slow tests'
  8. required: true
  9. type: boolean
  10. push:
  11. branches:
  12. - master
  13. paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/tests/**.*']
  14. pull_request:
  15. types: [opened, synchronize, reopened]
  16. paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/tests/**.*']
  17. schedule:
  18. - cron: '0 0 * * *'
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. server:
  24. runs-on: ubuntu-latest
  25. strategy:
  26. matrix:
  27. # TODO: temporary disabled due to linux kernel issues
  28. #sanitizer: [ADDRESS, THREAD, UNDEFINED]
  29. sanitizer: [UNDEFINED]
  30. build_type: [Debug]
  31. include:
  32. - build_type: Release
  33. sanitizer: ""
  34. fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken
  35. container:
  36. image: ubuntu:latest
  37. ports:
  38. - 8888
  39. options: --cpus 4
  40. steps:
  41. - name: Clone
  42. id: checkout
  43. uses: actions/checkout@v3
  44. with:
  45. fetch-depth: 0
  46. - name: Dependencies
  47. id: depends
  48. run: |
  49. apt-get update
  50. apt-get -y install \
  51. build-essential \
  52. git \
  53. cmake \
  54. python3-pip \
  55. wget \
  56. language-pack-en \
  57. libcurl4-openssl-dev
  58. - name: Build
  59. id: cmake_build
  60. run: |
  61. mkdir build
  62. cd build
  63. cmake .. \
  64. -DLLAMA_NATIVE=OFF \
  65. -DLLAMA_BUILD_SERVER=ON \
  66. -DLLAMA_CURL=ON \
  67. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  68. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  69. cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server
  70. - name: Tests dependencies
  71. id: test_dependencies
  72. run: |
  73. pip install -r examples/server/tests/requirements.txt
  74. - name: Tests
  75. id: server_integration_tests
  76. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  77. run: |
  78. cd examples/server/tests
  79. PORT=8888 ./tests.sh
  80. - name: Slow tests
  81. id: server_integration_tests_slow
  82. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  83. run: |
  84. cd examples/server/tests
  85. PORT=8888 ./tests.sh --stop --no-skipped --no-capture --tags slow
  86. server-windows:
  87. runs-on: windows-latest
  88. steps:
  89. - name: Clone
  90. id: checkout
  91. uses: actions/checkout@v3
  92. with:
  93. fetch-depth: 0
  94. - name: libCURL
  95. id: get_libcurl
  96. env:
  97. CURL_VERSION: 8.6.0_6
  98. run: |
  99. curl.exe -o $env:RUNNER_TEMP/curl.zip -L "https://curl.se/windows/dl-${env:CURL_VERSION}/curl-${env:CURL_VERSION}-win64-mingw.zip"
  100. mkdir $env:RUNNER_TEMP/libcurl
  101. tar.exe -xvf $env:RUNNER_TEMP/curl.zip --strip-components=1 -C $env:RUNNER_TEMP/libcurl
  102. - name: Build
  103. id: cmake_build
  104. run: |
  105. mkdir build
  106. cd build
  107. cmake .. -DLLAMA_CURL=ON -DCURL_LIBRARY="$env:RUNNER_TEMP/libcurl/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:RUNNER_TEMP/libcurl/include"
  108. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} --target server
  109. - name: Python setup
  110. id: setup_python
  111. uses: actions/setup-python@v5
  112. with:
  113. python-version: '3.11'
  114. - name: Tests dependencies
  115. id: test_dependencies
  116. run: |
  117. pip install -r examples/server/tests/requirements.txt
  118. - name: Copy Libcurl
  119. id: prepare_libcurl
  120. run: |
  121. cp $env:RUNNER_TEMP/libcurl/bin/libcurl-x64.dll ./build/bin/Release/libcurl-x64.dll
  122. - name: Tests
  123. id: server_integration_tests
  124. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  125. run: |
  126. cd examples/server/tests
  127. behave.exe --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
  128. - name: Slow tests
  129. id: server_integration_tests_slow
  130. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  131. run: |
  132. cd examples/server/tests
  133. behave.exe --stop --no-skipped --no-capture --tags slow