server.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Server build and tests
  2. name: Server
  3. on:
  4. workflow_dispatch: # allows manual triggering
  5. inputs:
  6. sha:
  7. description: 'Commit SHA1 to build'
  8. required: false
  9. type: string
  10. slow_tests:
  11. description: 'Run slow tests'
  12. required: true
  13. type: boolean
  14. push:
  15. branches:
  16. - master
  17. paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'tools/server/**.*']
  18. pull_request:
  19. types: [opened, synchronize, reopened]
  20. paths: ['.github/workflows/server.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'tools/server/**.*']
  21. env:
  22. LLAMA_LOG_COLORS: 1
  23. LLAMA_LOG_PREFIX: 1
  24. LLAMA_LOG_TIMESTAMPS: 1
  25. LLAMA_LOG_VERBOSITY: 10
  26. concurrency:
  27. group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }}
  28. cancel-in-progress: true
  29. jobs:
  30. server:
  31. runs-on: ubuntu-latest
  32. strategy:
  33. matrix:
  34. sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken
  35. build_type: [RelWithDebInfo]
  36. include:
  37. - build_type: Release
  38. sanitizer: ""
  39. extra_args: ""
  40. - build_type: Release
  41. sanitizer: ""
  42. extra_args: "LLAMA_ARG_BACKEND_SAMPLING=1"
  43. fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken
  44. steps:
  45. - name: Dependencies
  46. id: depends
  47. run: |
  48. sudo apt-get update
  49. sudo apt-get -y install \
  50. build-essential \
  51. xxd \
  52. git \
  53. cmake \
  54. curl \
  55. wget \
  56. language-pack-en \
  57. libssl-dev
  58. - name: Clone
  59. id: checkout
  60. uses: actions/checkout@v4
  61. with:
  62. fetch-depth: 0
  63. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  64. - name: Build
  65. id: cmake_build
  66. run: |
  67. cmake -B build -DLLAMA_BUILD_BORINGSSL=ON
  68. cmake --build build --config ${{ matrix.build_type }} -j ${env:NUMBER_OF_PROCESSORS} --target llama-server
  69. - name: Python setup
  70. id: setup_python
  71. uses: actions/setup-python@v5
  72. with:
  73. python-version: '3.11'
  74. - name: Tests dependencies
  75. id: test_dependencies
  76. run: |
  77. pip install -r tools/server/tests/requirements.txt
  78. - name: Tests
  79. id: server_integration_tests
  80. if: ${{ (!matrix.disabled_on_pr || !github.event.pull_request) && matrix.build_type == 'Release' }}
  81. run: |
  82. cd tools/server/tests
  83. export ${{ matrix.extra_args }}
  84. pytest -v -x -m "not slow"
  85. server-windows:
  86. runs-on: windows-2022
  87. steps:
  88. - name: Clone
  89. id: checkout
  90. uses: actions/checkout@v4
  91. with:
  92. fetch-depth: 0
  93. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  94. - name: Build
  95. id: cmake_build
  96. run: |
  97. cmake -B build -DLLAMA_BUILD_BORINGSSL=ON
  98. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS} --target llama-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 tools/server/tests/requirements.txt
  108. - name: Tests
  109. id: server_integration_tests
  110. if: ${{ !matrix.disabled_on_pr || !github.event.pull_request }}
  111. run: |
  112. cd tools/server/tests
  113. $env:PYTHONIOENCODING = ":replace"
  114. pytest -v -x -m "not slow"
  115. - name: Slow tests
  116. id: server_integration_tests_slow
  117. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  118. run: |
  119. cd tools/server/tests
  120. $env:SLOW_TESTS = "1"
  121. pytest -v -x