|
| 1 | +# Server WebUI build and tests |
| 2 | +name: Server WebUI |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: # allows manual triggering |
| 6 | + inputs: |
| 7 | + sha: |
| 8 | + description: 'Commit SHA1 to build' |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + slow_tests: |
| 12 | + description: 'Run slow tests' |
| 13 | + required: true |
| 14 | + type: boolean |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - master |
| 18 | + paths: ['.github/workflows/server-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**'] |
| 19 | + pull_request: |
| 20 | + types: [opened, synchronize, reopened] |
| 21 | + paths: ['.github/workflows/server-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**'] |
| 22 | + |
| 23 | +env: |
| 24 | + LLAMA_LOG_COLORS: 1 |
| 25 | + LLAMA_LOG_PREFIX: 1 |
| 26 | + LLAMA_LOG_TIMESTAMPS: 1 |
| 27 | + LLAMA_LOG_VERBOSITY: 10 |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +jobs: |
| 34 | + webui-setup: |
| 35 | + name: WebUI Setup |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - name: Checkout code |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
| 42 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 43 | + |
| 44 | + - name: Setup Node.js |
| 45 | + uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: "22" |
| 48 | + cache: "npm" |
| 49 | + cache-dependency-path: "tools/server/webui/package-lock.json" |
| 50 | + |
| 51 | + - name: Cache node_modules |
| 52 | + uses: actions/cache@v4 |
| 53 | + id: cache-node-modules |
| 54 | + with: |
| 55 | + path: tools/server/webui/node_modules |
| 56 | + key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }} |
| 57 | + restore-keys: | |
| 58 | + ${{ runner.os }}-node-modules- |
| 59 | +
|
| 60 | + - name: Install dependencies |
| 61 | + if: steps.cache-node-modules.outputs.cache-hit != 'true' |
| 62 | + run: npm ci |
| 63 | + working-directory: tools/server/webui |
| 64 | + |
| 65 | + webui-check: |
| 66 | + needs: webui-setup |
| 67 | + name: WebUI Check |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - name: Checkout code |
| 71 | + uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + fetch-depth: 0 |
| 74 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 75 | + |
| 76 | + - name: Setup Node.js |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: "22" |
| 80 | + |
| 81 | + - name: Restore node_modules cache |
| 82 | + uses: actions/cache@v4 |
| 83 | + with: |
| 84 | + path: tools/server/webui/node_modules |
| 85 | + key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }} |
| 86 | + restore-keys: | |
| 87 | + ${{ runner.os }}-node-modules- |
| 88 | +
|
| 89 | + - name: Run type checking |
| 90 | + run: npm run check |
| 91 | + working-directory: tools/server/webui |
| 92 | + |
| 93 | + - name: Run linting |
| 94 | + run: npm run lint |
| 95 | + working-directory: tools/server/webui |
| 96 | + |
| 97 | + webui-build: |
| 98 | + needs: webui-check |
| 99 | + name: WebUI Build |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Checkout code |
| 103 | + uses: actions/checkout@v4 |
| 104 | + with: |
| 105 | + fetch-depth: 0 |
| 106 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 107 | + |
| 108 | + - name: Setup Node.js |
| 109 | + uses: actions/setup-node@v4 |
| 110 | + with: |
| 111 | + node-version: "22" |
| 112 | + |
| 113 | + - name: Restore node_modules cache |
| 114 | + uses: actions/cache@v4 |
| 115 | + with: |
| 116 | + path: tools/server/webui/node_modules |
| 117 | + key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }} |
| 118 | + restore-keys: | |
| 119 | + ${{ runner.os }}-node-modules- |
| 120 | +
|
| 121 | + - name: Build application |
| 122 | + run: npm run build |
| 123 | + working-directory: tools/server/webui |
| 124 | + |
| 125 | + webui-tests: |
| 126 | + needs: webui-build |
| 127 | + name: Run WebUI tests |
| 128 | + permissions: |
| 129 | + contents: read |
| 130 | + |
| 131 | + runs-on: ubuntu-latest |
| 132 | + |
| 133 | + steps: |
| 134 | + - name: Checkout code |
| 135 | + uses: actions/checkout@v4 |
| 136 | + |
| 137 | + - name: Setup Node.js |
| 138 | + uses: actions/setup-node@v4 |
| 139 | + with: |
| 140 | + node-version: "22" |
| 141 | + |
| 142 | + - name: Restore node_modules cache |
| 143 | + uses: actions/cache@v4 |
| 144 | + with: |
| 145 | + path: tools/server/webui/node_modules |
| 146 | + key: ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }} |
| 147 | + restore-keys: | |
| 148 | + ${{ runner.os }}-node-modules- |
| 149 | +
|
| 150 | + - name: Install Playwright browsers |
| 151 | + run: npx playwright install --with-deps |
| 152 | + working-directory: tools/server/webui |
| 153 | + |
| 154 | + - name: Build Storybook |
| 155 | + run: npm run build-storybook |
| 156 | + working-directory: tools/server/webui |
| 157 | + |
| 158 | + - name: Run Client tests |
| 159 | + run: npm run test:client |
| 160 | + working-directory: tools/server/webui |
| 161 | + |
| 162 | + - name: Run Server tests |
| 163 | + run: npm run test:server |
| 164 | + working-directory: tools/server/webui |
| 165 | + |
| 166 | + - name: Run UI tests |
| 167 | + run: npm run test:ui -- --testTimeout=60000 |
| 168 | + working-directory: tools/server/webui |
| 169 | + |
| 170 | + - name: Run E2E tests |
| 171 | + run: npm run test:e2e |
| 172 | + working-directory: tools/server/webui |
| 173 | + |
| 174 | + server-build: |
| 175 | + needs: [webui-tests] |
| 176 | + runs-on: ubuntu-latest |
| 177 | + |
| 178 | + strategy: |
| 179 | + matrix: |
| 180 | + sanitizer: [ADDRESS, UNDEFINED] # THREAD is broken |
| 181 | + build_type: [RelWithDebInfo] |
| 182 | + include: |
| 183 | + - build_type: Release |
| 184 | + sanitizer: "" |
| 185 | + fail-fast: false # While -DLLAMA_SANITIZE_THREAD=ON is broken |
| 186 | + |
| 187 | + steps: |
| 188 | + - name: Dependencies |
| 189 | + id: depends |
| 190 | + run: | |
| 191 | + sudo apt-get update |
| 192 | + sudo apt-get -y install \ |
| 193 | + build-essential \ |
| 194 | + xxd \ |
| 195 | + git \ |
| 196 | + cmake \ |
| 197 | + curl \ |
| 198 | + wget \ |
| 199 | + language-pack-en \ |
| 200 | + libssl-dev |
| 201 | +
|
| 202 | + - name: Clone |
| 203 | + id: checkout |
| 204 | + uses: actions/checkout@v4 |
| 205 | + with: |
| 206 | + fetch-depth: 0 |
| 207 | + ref: ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }} |
| 208 | + |
| 209 | + - name: Python setup |
| 210 | + id: setup_python |
| 211 | + uses: actions/setup-python@v5 |
| 212 | + with: |
| 213 | + python-version: '3.11' |
| 214 | + |
| 215 | + - name: Tests dependencies |
| 216 | + id: test_dependencies |
| 217 | + run: | |
| 218 | + pip install -r tools/server/tests/requirements.txt |
| 219 | +
|
| 220 | + - name: Setup Node.js for WebUI |
| 221 | + uses: actions/setup-node@v4 |
| 222 | + with: |
| 223 | + node-version: "22" |
| 224 | + cache: "npm" |
| 225 | + cache-dependency-path: "tools/server/webui/package-lock.json" |
| 226 | + |
| 227 | + - name: Install WebUI dependencies |
| 228 | + run: npm ci |
| 229 | + working-directory: tools/server/webui |
| 230 | + |
| 231 | + - name: Build WebUI |
| 232 | + run: npm run build |
| 233 | + working-directory: tools/server/webui |
| 234 | + |
| 235 | + - name: Build (no OpenMP) |
| 236 | + id: cmake_build_no_openmp |
| 237 | + if: ${{ matrix.sanitizer == 'THREAD' }} |
| 238 | + run: | |
| 239 | + cmake -B build \ |
| 240 | + -DGGML_NATIVE=OFF \ |
| 241 | + -DLLAMA_CURL=OFF \ |
| 242 | + -DLLAMA_OPENSSL=ON \ |
| 243 | + -DLLAMA_BUILD_SERVER=ON \ |
| 244 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 245 | + -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \ |
| 246 | + -DGGML_OPENMP=OFF ; |
| 247 | + cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server |
| 248 | +
|
| 249 | + - name: Build (sanitizers) |
| 250 | + id: cmake_build_sanitizers |
| 251 | + if: ${{ matrix.sanitizer != '' && matrix.sanitizer != 'THREAD' }} |
| 252 | + run: | |
| 253 | + cmake -B build \ |
| 254 | + -DGGML_NATIVE=OFF \ |
| 255 | + -DLLAMA_CURL=OFF \ |
| 256 | + -DLLAMA_OPENSSL=ON \ |
| 257 | + -DLLAMA_BUILD_SERVER=ON \ |
| 258 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 259 | + -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ; |
| 260 | + cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server |
| 261 | +
|
| 262 | + - name: Build (sanitizers) |
| 263 | + id: cmake_build |
| 264 | + if: ${{ matrix.sanitizer == '' }} |
| 265 | + run: | |
| 266 | + cmake -B build \ |
| 267 | + -DGGML_NATIVE=OFF \ |
| 268 | + -DLLAMA_CURL=OFF \ |
| 269 | + -DLLAMA_OPENSSL=ON \ |
| 270 | + -DLLAMA_BUILD_SERVER=ON \ |
| 271 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ; |
| 272 | + cmake --build build --config ${{ matrix.build_type }} -j $(nproc) --target llama-server |
| 273 | +
|
| 274 | + - name: Tests |
| 275 | + id: server_integration_tests |
| 276 | + if: ${{ matrix.sanitizer == '' }} |
| 277 | + env: |
| 278 | + GITHUB_ACTIONS: "true" |
| 279 | + run: | |
| 280 | + cd tools/server/tests |
| 281 | + ./tests.sh |
| 282 | +
|
| 283 | + - name: Tests (sanitizers) |
| 284 | + id: server_integration_tests_sanitizers |
| 285 | + if: ${{ matrix.sanitizer != '' }} |
| 286 | + run: | |
| 287 | + cd tools/server/tests |
| 288 | + LLAMA_SANITIZE=1 ./tests.sh |
| 289 | +
|
| 290 | + - name: Slow tests |
| 291 | + id: server_integration_tests_slow |
| 292 | + if: ${{ (github.event.schedule || github.event.inputs.slow_tests == 'true') && matrix.build_type == 'Release' }} |
| 293 | + run: | |
| 294 | + cd tools/server/tests |
| 295 | + SLOW_TESTS=1 ./tests.sh |
0 commit comments