11name : Development
22
33on :
4- pull_request :
4+ pull_request_target :
55 types : [opened, synchronize, reopened]
66
77jobs :
8+ quality-checks :
9+ runs-on : ubuntu-latest
10+ strategy :
11+ matrix :
12+ python : ["3.9", "3.13"]
13+ steps :
14+ - uses : actions/checkout@v4
15+ - name : Set up Python
16+ uses : actions/setup-python@v5
17+ with :
18+ python-version : ${{ matrix.python }}
19+ - name : Install dependencies
20+ run : pip install tox
21+ - name : Run quality checks
22+ run : tox -e quality
23+
24+ ui-quality-checks :
25+ permissions :
26+ contents : " read"
27+ runs-on : ubuntu-latest
28+ steps :
29+ - name : Check out code
30+ uses : actions/checkout@v3
31+
32+ - name : Set up Node.js 22
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : ' 22'
36+
37+ - name : Install dependencies
38+ run : npm ci
39+
40+ - name : Run quality and typing checks
41+ run : npm run lint
42+
43+ type-checks :
44+ runs-on : ubuntu-latest
45+ strategy :
46+ matrix :
47+ python : ["3.9", "3.13"]
48+ steps :
49+ - uses : actions/checkout@v4
50+ - name : Set up Python
51+ uses : actions/setup-python@v5
52+ with :
53+ python-version : ${{ matrix.python }}
54+ - name : Install dependencies
55+ run : pip install tox
56+ - name : Run quality checks
57+ run : tox -e types
58+
59+ ui-type-checks :
60+ permissions :
61+ contents : " read"
62+ runs-on : ubuntu-latest
63+ steps :
64+ - name : Check out code
65+ uses : actions/checkout@v3
66+
67+ - name : Set up Node.js 22
68+ uses : actions/setup-node@v4
69+ with :
70+ node-version : ' 22'
71+
72+ - name : Install dependencies
73+ run : npm ci
74+
75+ - name : Run quality and typing checks
76+ run : npm run type-check
77+
878 precommit-checks :
979 runs-on : ubuntu-latest
1080 strategy :
@@ -18,17 +88,244 @@ jobs:
1888 python-version : ${{ matrix.python }}
1989 - name : Install dependencies
2090 run : pip install pre-commit
21- - name : Dump .env.local tail (hex + ASCII)
91+ - name : Run pre-commit checks
92+ run : SKIP=ruff-format pre-commit run --all-files
93+
94+ ui-precommit-checks :
95+ permissions :
96+ contents : " read"
97+ runs-on : ubuntu-latest
98+ steps :
99+ - name : Check out code
100+ uses : actions/checkout@v3
101+
102+ - name : Set up Node.js 22
103+ uses : actions/setup-node@v4
104+ with :
105+ node-version : ' 22'
106+
107+ - name : Install dependencies
108+ run : npm ci
109+
110+ - name : Run pre-commit checks
111+ run : npx husky run pre-commit
112+
113+ unit-tests :
114+ runs-on : ubuntu-latest
115+ strategy :
116+ matrix :
117+ python : ["3.9", "3.13"]
118+ steps :
119+ - uses : actions/checkout@v4
120+ - name : Set up Python
121+ uses : actions/setup-python@v5
122+ with :
123+ python-version : ${{ matrix.python }}
124+ - name : Install dependencies
125+ run : pip install tox
126+ - name : Run unit tests
127+ run : tox -e test-unit -- -m "smoke or sanity"
128+
129+ ui-unit-tests :
130+ permissions :
131+ contents : " read"
132+ runs-on : ubuntu-latest
133+ steps :
134+ - name : Check out code
135+ uses : actions/checkout@v3
136+
137+ - name : Set up Node.js 22
138+ uses : actions/setup-node@v4
139+ with :
140+ node-version : ' 22'
141+
142+ - name : Install dependencies
143+ run : npm ci
144+
145+ - name : Run unit tests
146+ run : npm run test:unit
147+
148+ integration-tests :
149+ runs-on : ubuntu-latest
150+ strategy :
151+ matrix :
152+ python : ["3.9", "3.13"]
153+ steps :
154+ - uses : actions/checkout@v4
155+ - name : Set up Python
156+ uses : actions/setup-python@v5
157+ with :
158+ python-version : ${{ matrix.python }}
159+ - name : Install dependencies
160+ run : pip install tox
161+ - name : Run integration tests
162+ run : tox -e test-integration -- -m smoke
163+
164+ ui-integration-tests :
165+ permissions :
166+ contents : " read"
167+ runs-on : ubuntu-latest
168+ steps :
169+ - name : Check out code
170+ uses : actions/checkout@v3
171+
172+ - name : Set up Node.js 22
173+ uses : actions/setup-node@v4
174+ with :
175+ node-version : ' 22'
176+
177+ - name : Install dependencies
178+ run : npm ci
179+
180+ - name : Run integration tests
181+ run : npm run test:integration
182+
183+ build :
184+ runs-on : ubuntu-latest
185+ strategy :
186+ matrix :
187+ python : ["3.9"]
188+ steps :
189+ - name : Checkout code
190+ uses : actions/checkout@v4
191+ with :
192+ fetch-depth : 0
193+ - name : Set up Python
194+ uses : actions/setup-python@v5
195+ with :
196+ python-version : ${{ matrix.python }}
197+ - name : Install dependencies
198+ run : pip install tox
199+ - name : Build the package
200+ run : |
201+ export GUIDELLM_BUILD_TYPE=dev
202+ export GUIDELLM_BUILD_ITERATION=${{ github.event.pull_request.number }}
203+ tox -e build
204+ - name : Upload build artifacts
205+ id : artifact-upload
206+ uses : actions/upload-artifact@v4
207+ with :
208+ name : build-artifacts
209+ path : dist/*
210+ compression-level : 6
211+ if-no-files-found : error
212+ retention-days : 30
213+ - name : Generate GitHub App token
214+ id : app-token
215+ uses : actions/create-github-app-token@v1
216+ with :
217+ app-id : ${{ secrets.GH_NM_REDHAT_AUTOMATION_APP_ID }}
218+ private-key : ${{ secrets.GH_NM_REDHAT_AUTOMATION_APP_PRIVATE_KEY }}
219+ - name : Comment Install instructions
220+ uses : actions/github-script@v7
221+ with :
222+ github-token : ${{ steps.app-token.outputs.token }}
223+ script : |
224+ github.rest.issues.createComment({
225+ issue_number: context.issue.number,
226+ owner: context.repo.owner,
227+ repo: context.repo.repo,
228+ body: `📦 **Build Artifacts Available**
229+ The build artifacts (\`.whl\` and \`.tar.gz\`) have been successfully generated and are available for download: ${{ steps.artifact-upload.outputs.artifact-url }}.
230+ They will be retained for **up to 30 days**.
231+ `
232+ })
233+
234+ ui-pr-preview :
235+ needs : [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-integration-tests]
236+ permissions :
237+ contents : write
238+ pull-requests : write
239+ issues : write
240+ runs-on : ubuntu-latest
241+ steps :
242+ - name : Check out code
243+ uses : actions/checkout@v3
244+ with :
245+ fetch-depth : 0
246+
247+ - name : Check if UI-related files changed
248+ id : check-changes
249+ run : |
250+ BASE_BRANCH=${{ github.event.pull_request.base.ref }}
251+ CHANGED_FILES=$(git diff --name-only origin/$BASE_BRANCH...HEAD)
252+ SHOULD_BUILD=false
253+
254+ if echo "$CHANGED_FILES" | grep -q "^src/ui/"; then
255+ echo "UI source files changed"
256+ SHOULD_BUILD=true
257+ fi
258+
259+ echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
260+ echo "Should build: $SHOULD_BUILD"
261+
262+ - name : Install dependencies
263+ if : steps.check-changes.outputs.should_build == 'true'
264+ run : npm ci
265+
266+ - name : Build app to root
267+ if : steps.check-changes.outputs.should_build == 'true'
268+ id : build
22269 run : |
23- echo '--- od -c tail ---'
24- od -c -A n -v src/ui/.env.local | tail -n 3
25- echo '--- od -tx1 last two bytes ---'
26- od -tx1 -A n -v -j $(($(stat -c%s src/ui/.env.local)-2)) -N2 src/ui/.env.local
27- echo '--- git eol info ---'
28- git ls-files --eol -- src/ui/.env.local
29- echo '--- git attributes ---'
30- git check-attr -a -- src/ui/.env.local
31- - name : Run end-of-file-fixer only, verbose
270+ # Export vars to ensure they are loaded before build
271+ export $(grep -v '^#' .env.development | xargs)
272+
273+ PR_NUMBER=${{ github.event.pull_request.number }}
274+ echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
275+
276+ # Set asset prefix and base path with PR number
277+ ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/pr/${PR_NUMBER}
278+ USE_MOCK_DATA=true
279+ BASE_PATH=/ui/pr/${PR_NUMBER}
280+ GIT_SHA=${{ github.sha }}
281+ export ASSET_PREFIX=${ASSET_PREFIX}
282+ export BASE_PATH=${BASE_PATH}
283+ export GIT_SHA=${GIT_SHA}
284+ export USE_MOCK_DATA=${USE_MOCK_DATA}
285+ npm run build
286+
287+ - name : Deploy to GitHub Pages
288+ if : steps.check-changes.outputs.should_build == 'true'
289+ uses : peaceiris/actions-gh-pages@v3
290+ with :
291+ github_token : ${{ secrets.GITHUB_TOKEN }}
292+ publish_dir : ./src/ui/out
293+ destination_dir : ui/pr/${{ steps.build.outputs.pr_number }}
294+ keep_files : false
295+ user_name : ${{ github.actor }}
296+ user_email : ${{ github.actor }}@users.noreply.github.com
297+ publish_branch : gh-pages
298+ commit_message : ' build: Deploy preview build for PR #${{ github.event.pull_request.number }}'
299+
300+ - name : Set deployment url
301+ if : steps.check-changes.outputs.should_build == 'true'
302+ id : deploy
32303 run : |
33- pre-commit run end-of-file-fixer --files src/ui/.env.local --verbose --color always || true
34- echo "--- exit code: $?" # we expect 1 if it rewrote
304+ DEPLOY_URL=https://neuralmagic.github.io/guidellm/ui/pr/${{ steps.build.outputs.pr_number }}
305+ echo "url=${DEPLOY_URL}" >> $GITHUB_OUTPUT
306+
307+ - name : Find PR comment
308+ if : steps.check-changes.outputs.should_build == 'true'
309+ uses : peter-evans/find-comment@v2
310+ id : find-comment
311+ with :
312+ token : ${{ secrets.GITHUB_TOKEN }}
313+ issue-number : ${{ github.event.pull_request.number }}
314+ body-includes : ' <!-- pr-preview-comment -->'
315+
316+ - name : Post Deployment URL to PR
317+ if : steps.check-changes.outputs.should_build == 'true'
318+ uses : peter-evans/create-or-update-comment@v3
319+ with :
320+ token : ${{ secrets.GITHUB_TOKEN }}
321+ comment-id : ${{ steps.find-comment.outputs.comment-id }}
322+ issue-number : ${{ github.event.pull_request.number }}
323+ edit-mode : replace
324+ body : |
325+ <!-- pr-preview-comment -->
326+ 🎉 **Live Preview:** [Click here to view the live version](${{ steps.deploy.outputs.url }})
327+ *Last updated: ${{ github.sha }}*
328+
329+ - name : Skip build notification
330+ if : steps.check-changes.outputs.should_build == 'false'
331+ run : echo "Skipping UI preview build - no relevant files changed"
0 commit comments