server.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. disabled_on_pr: true
  35. fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken
  36. container:
  37. image: ubuntu:latest
  38. ports:
  39. - 8888
  40. options: --cpus 4
  41. steps:
  42. - name: Clone
  43. id: checkout
  44. uses: actions/checkout@v3
  45. with:
  46. fetch-depth: 0
  47. - name: Dependencies
  48. id: depends
  49. run: |
  50. apt-get update
  51. apt-get -y install \
  52. build-essential \
  53. git \
  54. cmake \
  55. python3-pip \
  56. wget \
  57. language-pack-en \
  58. libcurl4-openssl-dev
  59. - name: Build
  60. id: cmake_build
  61. run: |
  62. mkdir build
  63. cd build
  64. cmake .. \
  65. -DLLAMA_NATIVE=OFF \
  66. -DLLAMA_BUILD_SERVER=ON \
  67. -DLLAMA_CURL=ON \
  68. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  69. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  70. cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server
  71. - name: Tests dependencies
  72. id: test_dependencies
  73. run: |
  74. pip install -r examples/server/tests/requirements.txt
  75. - name: Tests
  76. id: server_integration_tests
  77. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  78. run: |
  79. cd examples/server/tests
  80. PORT=8888 ./tests.sh
  81. - name: Slow tests
  82. id: server_integration_tests_slow
  83. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  84. run: |
  85. cd examples/server/tests
  86. PORT=8888 ./tests.sh --stop --no-skipped --no-capture --tags slow
  87. server-windows:
  88. runs-on: windows-latest
  89. steps:
  90. - name: Clone
  91. id: checkout
  92. uses: actions/checkout@v3
  93. with:
  94. fetch-depth: 0
  95. - name: libCURL
  96. id: get_libcurl
  97. env:
  98. CURL_VERSION: 8.6.0_6
  99. run: |
  100. curl.exe -o $env:RUNNER_TEMP/curl.zip -L "https://curl.se/windows/dl-${env:CURL_VERSION}/curl-${env:CURL_VERSION}-win64-mingw.zip"
  101. mkdir $env:RUNNER_TEMP/libcurl
  102. tar.exe -xvf $env:RUNNER_TEMP/curl.zip --strip-components=1 -C $env:RUNNER_TEMP/libcurl
  103. - name: Build
  104. id: cmake_build
  105. run: |
  106. mkdir build
  107. cd build
  108. cmake .. -DLLAMA_CURL=ON -DCURL_LIBRARY="$env:RUNNER_TEMP/libcurl/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:RUNNER_TEMP/libcurl/include"
  109. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} --target server
  110. - name: Python setup
  111. id: setup_python
  112. uses: actions/setup-python@v5
  113. with:
  114. python-version: '3.11'
  115. - name: Tests dependencies
  116. id: test_dependencies
  117. run: |
  118. pip install -r examples/server/tests/requirements.txt
  119. - name: Copy Libcurl
  120. id: prepare_libcurl
  121. run: |
  122. cp $env:RUNNER_TEMP/libcurl/bin/libcurl-x64.dll ./build/bin/Release/libcurl-x64.dll
  123. - name: Tests
  124. id: server_integration_tests
  125. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  126. run: |
  127. cd examples/server/tests
  128. behave.exe --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
  129. - name: Slow tests
  130. id: server_integration_tests_slow
  131. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  132. run: |
  133. cd examples/server/tests
  134. behave.exe --stop --no-skipped --no-capture --tags slow