server-webui.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. # Server WebUI build and tests
  2. name: Server WebUI
  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-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**']
  18. pull_request:
  19. types: [opened, synchronize, reopened]
  20. paths: ['.github/workflows/server-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**']
  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. webui-check:
  31. name: WebUI Checks
  32. runs-on: ubuntu-latest
  33. continue-on-error: true
  34. steps:
  35. - name: Checkout code
  36. uses: actions/checkout@v4
  37. with:
  38. fetch-depth: 0
  39. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  40. - name: Setup Node.js
  41. id: node
  42. uses: actions/setup-node@v4
  43. with:
  44. node-version: "22"
  45. cache: "npm"
  46. cache-dependency-path: "tools/server/webui/package-lock.json"
  47. - name: Install dependencies
  48. id: setup
  49. if: ${{ steps.node.conclusion == 'success' }}
  50. run: npm ci
  51. working-directory: tools/server/webui
  52. - name: Run type checking
  53. if: ${{ always() && steps.setup.conclusion == 'success' }}
  54. run: npm run check
  55. working-directory: tools/server/webui
  56. - name: Run linting
  57. if: ${{ always() && steps.setup.conclusion == 'success' }}
  58. run: npm run lint
  59. working-directory: tools/server/webui
  60. - name: Build application
  61. if: ${{ always() && steps.setup.conclusion == 'success' }}
  62. run: npm run build
  63. working-directory: tools/server/webui
  64. - name: Install Playwright browsers
  65. id: playwright
  66. if: ${{ always() && steps.setup.conclusion == 'success' }}
  67. run: npx playwright install --with-deps
  68. working-directory: tools/server/webui
  69. - name: Build Storybook
  70. if: ${{ always() && steps.playwright.conclusion == 'success' }}
  71. run: npm run build-storybook
  72. working-directory: tools/server/webui
  73. - name: Run Client tests
  74. if: ${{ always() && steps.playwright.conclusion == 'success' }}
  75. run: npm run test:client
  76. working-directory: tools/server/webui
  77. - name: Run Unit tests
  78. if: ${{ always() && steps.playwright.conclusion == 'success' }}
  79. run: npm run test:unit
  80. working-directory: tools/server/webui
  81. - name: Run UI tests
  82. if: ${{ always() && steps.playwright.conclusion == 'success' }}
  83. run: npm run test:ui -- --testTimeout=60000
  84. working-directory: tools/server/webui
  85. - name: Run E2E tests
  86. if: ${{ always() && steps.playwright.conclusion == 'success' }}
  87. run: npm run test:e2e
  88. working-directory: tools/server/webui
  89. server-build:
  90. runs-on: ubuntu-latest
  91. strategy:
  92. matrix:
  93. sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken
  94. build_type: [RelWithDebInfo]
  95. include:
  96. - build_type: Release
  97. sanitizer: ""
  98. fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken
  99. steps:
  100. - name: Dependencies
  101. id: depends
  102. run: |
  103. sudo apt-get update
  104. sudo apt-get -y install \
  105. build-essential \
  106. xxd \
  107. git \
  108. cmake \
  109. curl \
  110. wget \
  111. language-pack-en \
  112. libssl-dev
  113. - name: Clone
  114. id: checkout
  115. uses: actions/checkout@v4
  116. with:
  117. fetch-depth: 0
  118. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  119. - name: Python setup
  120. id: setup_python
  121. uses: actions/setup-python@v5
  122. with:
  123. python-version: '3.11'
  124. - name: Tests dependencies
  125. id: test_dependencies
  126. run: |
  127. pip install -r tools/server/tests/requirements.txt
  128. - name: Setup Node.js for WebUI
  129. uses: actions/setup-node@v4
  130. with:
  131. node-version: "22"
  132. cache: "npm"
  133. cache-dependency-path: "tools/server/webui/package-lock.json"
  134. - name: Install WebUI dependencies
  135. run: npm ci
  136. working-directory: tools/server/webui
  137. - name: Build WebUI
  138. run: npm run build
  139. working-directory: tools/server/webui
  140. - name: Build (no OpenMP)
  141. id: cmake_build_no_openmp
  142. if: ${{ matrix.sanitizer == 'THREAD' }}
  143. run: |
  144. cmake -B build \
  145. -DGGML_NATIVE=OFF \
  146. -DLLAMA_CURL=OFF \
  147. -DLLAMA_OPENSSL=ON \
  148. -DLLAMA_BUILD_SERVER=ON \
  149. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  150. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  151. -DGGML_OPENMP=OFF ;
  152. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  153. - name: Build (sanitizers)
  154. id: cmake_build_sanitizers
  155. if: ${{ matrix.sanitizer != '' && matrix.sanitizer != 'THREAD' }}
  156. run: |
  157. cmake -B build \
  158. -DGGML_NATIVE=OFF \
  159. -DLLAMA_CURL=OFF \
  160. -DLLAMA_OPENSSL=ON \
  161. -DLLAMA_BUILD_SERVER=ON \
  162. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  163. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  164. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  165. - name: Build (sanitizers)
  166. id: cmake_build
  167. if: ${{ matrix.sanitizer == '' }}
  168. run: |
  169. cmake -B build \
  170. -DGGML_NATIVE=OFF \
  171. -DLLAMA_CURL=OFF \
  172. -DLLAMA_OPENSSL=ON \
  173. -DLLAMA_BUILD_SERVER=ON \
  174. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ;
  175. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  176. - name: Tests
  177. id: server_integration_tests
  178. if: ${{ matrix.sanitizer == '' }}
  179. env:
  180. GITHUB_ACTIONS: "true"
  181. run: |
  182. cd tools/server/tests
  183. ./tests.sh
  184. - name: Tests (sanitizers)
  185. id: server_integration_tests_sanitizers
  186. if: ${{ matrix.sanitizer != '' }}
  187. run: |
  188. cd tools/server/tests
  189. LLAMA_SANITIZE=1 ./tests.sh
  190. - name: Slow tests
  191. id: server_integration_tests_slow
  192. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  193. run: |
  194. cd tools/server/tests
  195. SLOW_TESTS=1 ./tests.sh