server.yml 4.6 KB

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