@@ -76,51 +76,206 @@ jobs:
7676 run : |
7777 pip install -r tools/server/tests/requirements.txt
7878
79- # Setup nodejs (to be used for verifying bundled index.html)
80- - uses : actions/setup-node@v4
79+ webui-setup :
80+ name : WebUI Setup
81+ runs-on : ubuntu-latest
82+ steps :
83+ - name : Checkout code
84+ uses : actions/checkout@v4
8185 with :
82- node-version : ' 22.11.0'
86+ fetch-depth : 0
87+ ref : ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
8388
84- - name : WebUI - Install dependencies
85- id : webui_lint
86- run : |
87- cd tools/server/webui
88- npm ci
89+ - name : Setup Node.js
90+ uses : actions/setup-node@v4
91+ with :
92+ node-version : " 22"
93+ cache : " npm"
94+ cache-dependency-path : " tools/server/webui/package-lock.json"
95+
96+ - name : Cache node_modules
97+ uses : actions/cache@v4
98+ id : cache-node-modules
99+ with :
100+ path : tools/server/webui/node_modules
101+ key : ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
102+ restore-keys : |
103+ ${{ runner.os }}-node-modules-
104+
105+ - name : Install dependencies
106+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
107+ run : npm ci
108+ working-directory : tools/server/webui
109+
110+ webui-check :
111+ needs : webui-setup
112+ name : WebUI Check
113+ runs-on : ubuntu-latest
114+ steps :
115+ - name : Checkout code
116+ uses : actions/checkout@v4
117+ with :
118+ fetch-depth : 0
119+ ref : ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
120+
121+ - name : Setup Node.js
122+ uses : actions/setup-node@v4
123+ with :
124+ node-version : " 22"
125+
126+ - name : Restore node_modules cache
127+ uses : actions/cache@v4
128+ with :
129+ path : tools/server/webui/node_modules
130+ key : ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
131+ restore-keys : |
132+ ${{ runner.os }}-node-modules-
133+
134+ - name : Run type checking
135+ run : npm run check
136+ working-directory : tools/server/webui
137+
138+ - name : Run linting
139+ run : npm run lint
140+ working-directory : tools/server/webui
141+
142+ webui-build :
143+ needs : webui-check
144+ name : WebUI Build
145+ runs-on : ubuntu-latest
146+ steps :
147+ - name : Checkout code
148+ uses : actions/checkout@v4
149+ with :
150+ fetch-depth : 0
151+ ref : ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
152+
153+ - name : Setup Node.js
154+ uses : actions/setup-node@v4
155+ with :
156+ node-version : " 22"
157+
158+ - name : Restore node_modules cache
159+ uses : actions/cache@v4
160+ with :
161+ path : tools/server/webui/node_modules
162+ key : ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
163+ restore-keys : |
164+ ${{ runner.os }}-node-modules-
165+
166+ - name : Build application
167+ run : npm run build
168+ working-directory : tools/server/webui
169+
170+ webui-tests :
171+ needs : webui-build
172+ name : Run WebUI tests
173+ permissions :
174+ contents : read
175+
176+ runs-on : ubuntu-latest
177+
178+ steps :
179+ - name : Checkout code
180+ uses : actions/checkout@v4
181+
182+ - name : Setup Node.js
183+ uses : actions/setup-node@v4
184+ with :
185+ node-version : " 22"
186+
187+ - name : Restore node_modules cache
188+ uses : actions/cache@v4
189+ with :
190+ path : tools/server/webui/node_modules
191+ key : ${{ runner.os }}-node-modules-${{ hashFiles('tools/server/webui/package-lock.json') }}
192+ restore-keys : |
193+ ${{ runner.os }}-node-modules-
194+
195+ - name : Install Playwright browsers
196+ run : npx playwright install --with-deps
197+ working-directory : tools/server/webui
198+
199+ - name : Build Storybook
200+ run : npm run build-storybook
201+ working-directory : tools/server/webui
202+
203+ - name : Run Client tests
204+ run : npm run test:client
205+ working-directory : tools/server/webui
89206
90- - name : WebUI - Check code format
91- id : webui_format
207+ - name : Run Server tests
208+ run : npm run test:server
209+ working-directory : tools/server/webui
210+
211+ - name : Run UI tests
212+ run : npm run test:ui
213+ working-directory : tools/server/webui
214+
215+ - name : Run E2E tests
216+ run : npm run test:e2e
217+ working-directory : tools/server/webui
218+
219+ server-build :
220+ needs : [webui-tests]
221+ runs-on : ubuntu-latest
222+
223+ strategy :
224+ matrix :
225+ sanitizer : [ADDRESS, UNDEFINED] # THREAD is broken
226+ build_type : [RelWithDebInfo]
227+ include :
228+ - build_type : Release
229+ sanitizer : " "
230+ fail-fast : false # While -DLLAMA_SANITIZE_THREAD=ON is broken
231+
232+ steps :
233+ - name : Dependencies
234+ id : depends
92235 run : |
93- git config --global --add safe.directory $(realpath .)
94- cd tools/server/webui
95- git status
96-
97- npm run format
98- git status
99- modified_files="$(git status -s)"
100- echo "Modified files: ${modified_files}"
101- if [ -n "${modified_files}" ]; then
102- echo "Files do not follow coding style. To fix: npm run format"
103- echo "${modified_files}"
104- exit 1
105- fi
106-
107- - name : Verify bundled index.html
108- id : verify_server_index_html
236+ sudo apt-get update
237+ sudo apt-get -y install \
238+ build-essential \
239+ xxd \
240+ git \
241+ cmake \
242+ curl \
243+ wget \
244+ language-pack-en \
245+ libcurl4-openssl-dev
246+
247+ - name : Clone
248+ id : checkout
249+ uses : actions/checkout@v4
250+ with :
251+ fetch-depth : 0
252+ ref : ${{ github.event.inputs.sha || github.event.pull_request.head.sha || github.sha || github.head_ref || github.ref_name }}
253+
254+ - name : Python setup
255+ id : setup_python
256+ uses : actions/setup-python@v5
257+ with :
258+ python-version : ' 3.11'
259+
260+ - name : Tests dependencies
261+ id : test_dependencies
109262 run : |
110- git config --global --add safe.directory $(realpath .)
111- cd tools/server/webui
112- git status
113-
114- npm run build
115- git status
116- modified_files="$(git status -s)"
117- echo "Modified files: ${modified_files}"
118- if [ -n "${modified_files}" ]; then
119- echo "Repository is dirty or server/webui is not built as expected"
120- echo "Hint: You may need to follow Web UI build guide in server/README.md"
121- echo "${modified_files}"
122- exit 1
123- fi
263+ pip install -r tools/server/tests/requirements.txt
264+
265+ - name : Setup Node.js for WebUI
266+ uses : actions/setup-node@v4
267+ with :
268+ node-version : " 22"
269+ cache : " npm"
270+ cache-dependency-path : " tools/server/webui/package-lock.json"
271+
272+ - name : Install WebUI dependencies
273+ run : npm ci
274+ working-directory : tools/server/webui
275+
276+ - name : Build WebUI
277+ run : npm run build
278+ working-directory : tools/server/webui
124279
125280 - name : Build (no OpenMP)
126281 id : cmake_build_no_openmp
0 commit comments