server-webui.yml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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-setup:
  31. name: WebUI Setup
  32. runs-on: ubuntu-latest
  33. steps:
  34. - name: Checkout code
  35. uses: actions/checkout@v4
  36. with:
  37. fetch-depth: 0
  38. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  39. - name: Setup Node.js
  40. uses: actions/setup-node@v4
  41. with:
  42. node-version: "22"
  43. cache: "npm"
  44. cache-dependency-path: "tools/server/webui/package-lock.json"
  45. - name: Cache node_modules
  46. uses: actions/cache@v4
  47. id: cache-node-modules
  48. with:
  49. path: tools/server/webui/node_modules
  50. key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
  51. restore-keys: |
  52. ${{ runner.os }}-node-modules-
  53. - name: Install dependencies
  54. if: steps.cache-node-modules.outputs.cache-hit != 'true'
  55. run: npm ci
  56. working-directory: tools/server/webui
  57. webui-check:
  58. needs: webui-setup
  59. name: WebUI Check
  60. runs-on: ubuntu-latest
  61. steps:
  62. - name: Checkout code
  63. uses: actions/checkout@v4
  64. with:
  65. fetch-depth: 0
  66. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  67. - name: Setup Node.js
  68. uses: actions/setup-node@v4
  69. with:
  70. node-version: "22"
  71. - name: Restore node_modules cache
  72. uses: actions/cache@v4
  73. with:
  74. path: tools/server/webui/node_modules
  75. key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
  76. restore-keys: |
  77. ${{ runner.os }}-node-modules-
  78. - name: Run type checking
  79. run: npm run check
  80. working-directory: tools/server/webui
  81. - name: Run linting
  82. run: npm run lint
  83. working-directory: tools/server/webui
  84. webui-build:
  85. needs: webui-check
  86. name: WebUI Build
  87. runs-on: ubuntu-latest
  88. steps:
  89. - name: Checkout code
  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: Setup Node.js
  95. uses: actions/setup-node@v4
  96. with:
  97. node-version: "22"
  98. - name: Restore node_modules cache
  99. uses: actions/cache@v4
  100. with:
  101. path: tools/server/webui/node_modules
  102. key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
  103. restore-keys: |
  104. ${{ runner.os }}-node-modules-
  105. - name: Build application
  106. run: npm run build
  107. working-directory: tools/server/webui
  108. webui-tests:
  109. needs: webui-build
  110. name: Run WebUI tests
  111. permissions:
  112. contents: read
  113. runs-on: ubuntu-latest
  114. steps:
  115. - name: Checkout code
  116. uses: actions/checkout@v4
  117. - name: Setup Node.js
  118. uses: actions/setup-node@v4
  119. with:
  120. node-version: "22"
  121. - name: Restore node_modules cache
  122. uses: actions/cache@v4
  123. with:
  124. path: tools/server/webui/node_modules
  125. key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
  126. restore-keys: |
  127. ${{ runner.os }}-node-modules-
  128. - name: Install Playwright browsers
  129. run: npx playwright install --with-deps
  130. working-directory: tools/server/webui
  131. - name: Build Storybook
  132. run: npm run build-storybook
  133. working-directory: tools/server/webui
  134. - name: Run Client tests
  135. run: npm run test:client
  136. working-directory: tools/server/webui
  137. - name: Run Server tests
  138. run: npm run test:server
  139. working-directory: tools/server/webui
  140. - name: Run UI tests
  141. run: npm run test:ui -- --testTimeout=60000
  142. working-directory: tools/server/webui
  143. - name: Run E2E tests
  144. run: npm run test:e2e
  145. working-directory: tools/server/webui
  146. server-build:
  147. needs: [webui-tests]
  148. runs-on: ubuntu-latest
  149. strategy:
  150. matrix:
  151. sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken
  152. build_type: [RelWithDebInfo]
  153. include:
  154. - build_type: Release
  155. sanitizer: ""
  156. fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken
  157. steps:
  158. - name: Dependencies
  159. id: depends
  160. run: |
  161. sudo apt-get update
  162. sudo apt-get -y install \
  163. build-essential \
  164. xxd \
  165. git \
  166. cmake \
  167. curl \
  168. wget \
  169. language-pack-en \
  170. libssl-dev
  171. - name: Clone
  172. id: checkout
  173. uses: actions/checkout@v4
  174. with:
  175. fetch-depth: 0
  176. ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
  177. - name: Python setup
  178. id: setup_python
  179. uses: actions/setup-python@v5
  180. with:
  181. python-version: '3.11'
  182. - name: Tests dependencies
  183. id: test_dependencies
  184. run: |
  185. pip install -r tools/server/tests/requirements.txt
  186. - name: Setup Node.js for WebUI
  187. uses: actions/setup-node@v4
  188. with:
  189. node-version: "22"
  190. cache: "npm"
  191. cache-dependency-path: "tools/server/webui/package-lock.json"
  192. - name: Install WebUI dependencies
  193. run: npm ci
  194. working-directory: tools/server/webui
  195. - name: Build WebUI
  196. run: npm run build
  197. working-directory: tools/server/webui
  198. - name: Build (no OpenMP)
  199. id: cmake_build_no_openmp
  200. if: ${{ matrix.sanitizer == 'THREAD' }}
  201. run: |
  202. cmake -B build \
  203. -DGGML_NATIVE=OFF \
  204. -DLLAMA_CURL=OFF \
  205. -DLLAMA_OPENSSL=ON \
  206. -DLLAMA_BUILD_SERVER=ON \
  207. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  208. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  209. -DGGML_OPENMP=OFF ;
  210. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  211. - name: Build (sanitizers)
  212. id: cmake_build_sanitizers
  213. if: ${{ matrix.sanitizer != '' && matrix.sanitizer != 'THREAD' }}
  214. run: |
  215. cmake -B build \
  216. -DGGML_NATIVE=OFF \
  217. -DLLAMA_CURL=OFF \
  218. -DLLAMA_OPENSSL=ON \
  219. -DLLAMA_BUILD_SERVER=ON \
  220. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  221. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ;
  222. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  223. - name: Build (sanitizers)
  224. id: cmake_build
  225. if: ${{ matrix.sanitizer == '' }}
  226. run: |
  227. cmake -B build \
  228. -DGGML_NATIVE=OFF \
  229. -DLLAMA_CURL=OFF \
  230. -DLLAMA_OPENSSL=ON \
  231. -DLLAMA_BUILD_SERVER=ON \
  232. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ;
  233. cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server
  234. - name: Tests
  235. id: server_integration_tests
  236. if: ${{ matrix.sanitizer == '' }}
  237. env:
  238. GITHUB_ACTIONS: "true"
  239. run: |
  240. cd tools/server/tests
  241. ./tests.sh
  242. - name: Tests (sanitizers)
  243. id: server_integration_tests_sanitizers
  244. if: ${{ matrix.sanitizer != '' }}
  245. run: |
  246. cd tools/server/tests
  247. LLAMA_SANITIZE=1 ./tests.sh
  248. - name: Slow tests
  249. id: server_integration_tests_slow
  250. if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }}
  251. run: |
  252. cd tools/server/tests
  253. SLOW_TESTS=1 ./tests.sh