1# Server WebUI build and tests
 2name: Server WebUI
 3
 4on:
 5  workflow_dispatch: # allows manual triggering
 6    inputs:
 7      sha:
 8        description: 'Commit SHA1 to build'
 9        required: false
10        type: string
11  push:
12    branches:
13      - master
14    paths: ['.github/workflows/server-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**']
15  pull_request:
16    types: [opened, synchronize, reopened]
17    paths: ['.github/workflows/server-webui.yml', 'tools/server/webui/**.*', 'tools/server/tests/**.*', 'tools/server/public/**']
18
19env:
20  LLAMA_LOG_COLORS: 1
21  LLAMA_LOG_PREFIX: 1
22  LLAMA_LOG_TIMESTAMPS: 1
23  LLAMA_LOG_VERBOSITY: 10
24
25concurrency:
26  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }}
27  cancel-in-progress: true
28
29jobs:
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@v6
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
41      - name: Setup Node.js
42        id: node
43        uses: actions/setup-node@v6
44        with:
45          node-version: "22"
46          cache: "npm"
47          cache-dependency-path: "tools/server/webui/package-lock.json"
48
49      - name: Install dependencies
50        id: setup
51        if: ${{ steps.node.conclusion == 'success' }}
52        run: npm ci
53        working-directory: tools/server/webui
54
55      - name: Run type checking
56        if: ${{ always() && steps.setup.conclusion == 'success' }}
57        run: npm run check
58        working-directory: tools/server/webui
59
60      - name: Run linting
61        if: ${{ always() && steps.setup.conclusion == 'success' }}
62        run: npm run lint
63        working-directory: tools/server/webui
64
65      - name: Build application
66        if: ${{ always() && steps.setup.conclusion == 'success' }}
67        run: npm run build
68        working-directory: tools/server/webui
69
70      - name: Install Playwright browsers
71        id: playwright
72        if: ${{ always() && steps.setup.conclusion == 'success' }}
73        run: npx playwright install --with-deps
74        working-directory: tools/server/webui
75
76      - name: Build Storybook
77        if: ${{ always() && steps.playwright.conclusion == 'success' }}
78        run: npm run build-storybook
79        working-directory: tools/server/webui
80
81      - name: Run Client tests
82        if: ${{ always() && steps.playwright.conclusion == 'success' }}
83        run: npm run test:client
84        working-directory: tools/server/webui
85
86      - name: Run Unit tests
87        if: ${{ always() && steps.playwright.conclusion == 'success' }}
88        run: npm run test:unit
89        working-directory: tools/server/webui
90
91      - name: Run UI tests
92        if: ${{ always() && steps.playwright.conclusion == 'success' }}
93        run: npm run test:ui -- --testTimeout=60000
94        working-directory: tools/server/webui
95
96      - name: Run E2E tests
97        if: ${{ always() && steps.playwright.conclusion == 'success' }}
98        run: npm run test:e2e
99        working-directory: tools/server/webui