server.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  25. build_type: [Debug, Release]
  26. include:
  27. - build_type: Release
  28. sanitizer: ""
  29. exclude:
  30. - build_type: Release
  31. sanitizer: ADDRESS
  32. - build_type: Release
  33. sanitizer: THREAD
  34. - build_type: Release
  35. sanitizer: UNDEFINED
  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. - 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. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  67. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  68. cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server
  69. - name: Tests dependencies
  70. id: test_dependencies
  71. run: |
  72. pip install -r examples/server/tests/requirements.txt
  73. - name: Tests
  74. id: server_integration_tests
  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 != '' && matrix.build_type == 'Release' || github.event.inputs.slow_tests == 'true' }}
  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: Build
  93. id: cmake_build
  94. run: |
  95. mkdir build
  96. cd build
  97. cmake .. -DLLAMA_BUILD_SERVER=ON -DCMAKE_BUILD_TYPE=Release ;
  98. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} --target server
  99. - name: Python setup
  100. id: setup_python
  101. uses: actions/setup-python@v5
  102. with:
  103. python-version: '3.11'
  104. - name: Tests dependencies
  105. id: test_dependencies
  106. run: |
  107. pip install -r examples/server/tests/requirements.txt
  108. - name: Tests
  109. id: server_integration_tests
  110. run: |
  111. cd examples/server/tests
  112. behave.exe --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
  113. - name: Slow tests
  114. id: server_integration_tests_slow
  115. if: ${{ github.event.schedule != '' || github.event.inputs.slow_tests == 'true' }}
  116. run: |
  117. cd examples/server/tests
  118. behave.exe --stop --no-skipped --no-capture --tags slow