server.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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]
  26. include:
  27. - build_type: Release
  28. sanitizer: ""
  29. - build_type: Debug
  30. sanitizer: THREAD
  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. - name: Build
  56. id: cmake_build
  57. run: |
  58. mkdir build
  59. cd build
  60. cmake .. \
  61. -DLLAMA_NATIVE=OFF \
  62. -DLLAMA_BUILD_SERVER=ON \
  63. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  64. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  65. cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server
  66. - name: Tests dependencies
  67. id: test_dependencies
  68. run: |
  69. pip install -r examples/server/tests/requirements.txt
  70. - name: Tests
  71. id: server_integration_tests
  72. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  73. run: |
  74. cd examples/server/tests
  75. PORT=8888 ./tests.sh
  76. - name: Slow tests
  77. id: server_integration_tests_slow
  78. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  79. run: |
  80. cd examples/server/tests
  81. PORT=8888 ./tests.sh --stop --no-skipped --no-capture --tags slow
  82. server-windows:
  83. runs-on: windows-latest
  84. steps:
  85. - name: Clone
  86. id: checkout
  87. uses: actions/checkout@v3
  88. with:
  89. fetch-depth: 0
  90. - name: Build
  91. id: cmake_build
  92. run: |
  93. mkdir build
  94. cd build
  95. cmake .. -DLLAMA_BUILD_SERVER=ON -DCMAKE_BUILD_TYPE=Release ;
  96. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} --target server
  97. - name: Python setup
  98. id: setup_python
  99. uses: actions/setup-python@v5
  100. with:
  101. python-version: '3.11'
  102. - name: Tests dependencies
  103. id: test_dependencies
  104. run: |
  105. pip install -r examples/server/tests/requirements.txt
  106. - name: Tests
  107. id: server_integration_tests
  108. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  109. run: |
  110. cd examples/server/tests
  111. behave.exe --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
  112. - name: Slow tests
  113. id: server_integration_tests_slow
  114. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  115. run: |
  116. cd examples/server/tests
  117. behave.exe --stop --no-skipped --no-capture --tags slow