Skip to content

Commit 511e92f

Browse files
committed
update workflows with ui flows
1 parent 2e597b0 commit 511e92f

File tree

8 files changed

+464
-582
lines changed

8 files changed

+464
-582
lines changed

.github/workflows/development.yml

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- name: Run pre-commit checks
8282
run: SKIP=ruff-format pre-commit run --all-files
8383

84-
ui-precommit-check:
84+
ui-precommit-checks:
8585
permissions:
8686
contents: "read"
8787
runs-on: ubuntu-latest
@@ -205,3 +205,62 @@ jobs:
205205
They will be retained for **up to 30 days**.
206206
`
207207
})
208+
209+
ui-pr-preview:
210+
needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-integration-tests]
211+
permissions:
212+
contents: write
213+
pull-requests: write
214+
issues: write
215+
runs-on: ubuntu-latest
216+
steps:
217+
- name: Check out code
218+
uses: actions/checkout@v3
219+
220+
- name: Install dependencies
221+
run: npm ci
222+
223+
- name: Build app to root
224+
id: build
225+
run: |
226+
# Export vars to ensure they are loaded before build
227+
export $(grep -v '^#' .env.development | xargs)
228+
229+
PR_NUMBER=${{ github.event.pull_request.number }}
230+
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
231+
232+
# Set asset prefix and base path with PR number
233+
ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/pr/${PR_NUMBER}
234+
USE_MOCK_DATA=true
235+
BASE_PATH=/ui/pr/${PR_NUMBER}
236+
GIT_SHA=${{ github.sha }}
237+
export ASSET_PREFIX=${ASSET_PREFIX}
238+
export BASE_PATH=${BASE_PATH}
239+
export GIT_SHA=${GIT_SHA}
240+
export USE_MOCK_DATA=${USE_MOCK_DATA}
241+
npm run build
242+
243+
- name: Deploy to GitHub Pages
244+
uses: peaceiris/actions-gh-pages@v3
245+
with:
246+
github_token: ${{ secrets.GITHUB_TOKEN }}
247+
publish_dir: ./ui/out
248+
destination_dir: ui/pr/${{ steps.build.outputs.pr_number }}
249+
keep_files: false
250+
user_name: ${{ github.actor }}
251+
user_email: ${{ github.actor }}@users.noreply.github.com
252+
publish_branch: gh-pages
253+
254+
- name: Set deployment url
255+
id: deploy
256+
run: |
257+
DEPLOY_URL=https://neuralmagic.github.io/guidellm/ui/pr/${{ steps.build.outputs.pr_number }}
258+
echo "url=${DEPLOY_URL}" >> $GITHUB_OUTPUT
259+
260+
- name: Post Deployment URL to PR
261+
uses: peter-evans/create-or-update-comment@v3
262+
with:
263+
token: ${{ secrets.GITHUB_TOKEN }}
264+
issue-number: ${{ github.event.pull_request.number }}
265+
body: |
266+
🎉 **Live Preview:** [Click here to view the live version](${{ steps.deploy.outputs.url }})

.github/workflows/main.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ jobs:
2222
- name: Run quality checks
2323
run: tox -e quality
2424

25+
ui-quality-checks:
26+
permissions:
27+
contents: "read"
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Check out code
31+
uses: actions/checkout@v3
32+
33+
- name: Install dependencies
34+
run: npm ci
35+
36+
- name: Run quality and typing checks
37+
run: npm run lint
38+
2539
type-checks:
2640
runs-on: ubuntu-latest
2741
strategy:
@@ -38,6 +52,20 @@ jobs:
3852
- name: Run quality checks
3953
run: tox -e types
4054

55+
ui-type-checks:
56+
permissions:
57+
contents: "read"
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Check out code
61+
uses: actions/checkout@v3
62+
63+
- name: Install dependencies
64+
run: npm ci
65+
66+
- name: Run quality and typing checks
67+
run: npm run type-check
68+
4169
precommit-checks:
4270
runs-on: ubuntu-latest
4371
strategy:
@@ -54,6 +82,20 @@ jobs:
5482
- name: Run pre-commit checks
5583
run: SKIP=ruff-format pre-commit run --all-files
5684

85+
ui-precommit-checks:
86+
permissions:
87+
contents: "read"
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Check out code
91+
uses: actions/checkout@v3
92+
93+
- name: Install dependencies
94+
run: npm ci
95+
96+
- name: Run pre-commit checks
97+
run: npx husky run pre-commit
98+
5799
unit-tests:
58100
runs-on: ubuntu-latest
59101
strategy:
@@ -70,6 +112,20 @@ jobs:
70112
- name: Run unit tests
71113
run: tox -e test-unit -- -m "smoke or sanity"
72114

115+
ui-unit-tests:
116+
permissions:
117+
contents: "read"
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Check out code
121+
uses: actions/checkout@v3
122+
123+
- name: Install dependencies
124+
run: npm ci
125+
126+
- name: Run unit tests
127+
run: npm run test:unit
128+
73129
integration-tests:
74130
runs-on: ubuntu-latest
75131
strategy:
@@ -85,3 +141,55 @@ jobs:
85141
run: pip install tox
86142
- name: Run integration tests
87143
run: tox -e test-integration -- -m smoke
144+
145+
ui-integration-tests:
146+
permissions:
147+
contents: "read"
148+
runs-on: ubuntu-latest
149+
steps:
150+
- name: Check out code
151+
uses: actions/checkout@v3
152+
153+
- name: Install dependencies
154+
run: npm ci
155+
156+
- name: Run integration tests
157+
run: npm run test:integration
158+
159+
deploy-ui-build:
160+
needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-integration-tests]
161+
permissions:
162+
contents: write
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Check out code
166+
uses: actions/checkout@v3
167+
168+
- name: Install dependencies
169+
run: npm ci
170+
171+
- name: Build app to root
172+
id: build
173+
run: |
174+
# Export vars to ensure they are loaded before build
175+
export $(grep -v '^#' .env.development | xargs)
176+
177+
# Set asset prefix and base path with PR number
178+
ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/dev
179+
BASE_PATH=/ui/dev
180+
GIT_SHA=${{ github.sha }}
181+
export ASSET_PREFIX=${ASSET_PREFIX}
182+
export BASE_PATH=${BASE_PATH}
183+
export GIT_SHA=${GIT_SHA}
184+
npm run build
185+
186+
- name: Deploy to GitHub Pages
187+
uses: peaceiris/actions-gh-pages@v3
188+
with:
189+
github_token: ${{ secrets.GITHUB_TOKEN }}
190+
publish_dir: ./ui/out
191+
destination_dir: ui/dev
192+
keep_files: false
193+
user_name: ${{ github.actor }}
194+
user_email: ${{ github.actor }}@users.noreply.github.com
195+
publish_branch: gh-pages

.github/workflows/release-candidate.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ jobs:
3838
- name: Run unit tests
3939
run: tox -e test-unit
4040

41+
ui-unit-tests:
42+
permissions:
43+
contents: "read"
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Check out code
47+
uses: actions/checkout@v3
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Run unit tests
53+
run: npm run test:unit
54+
4155
integration-tests:
4256
runs-on: ubuntu-latest
4357
strategy:
@@ -54,6 +68,20 @@ jobs:
5468
- name: Run integration tests
5569
run: tox -e test-integration
5670

71+
ui-integration-tests:
72+
permissions:
73+
contents: "read"
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Check out code
77+
uses: actions/checkout@v3
78+
79+
- name: Install dependencies
80+
run: npm ci
81+
82+
- name: Run integration tests
83+
run: npm run test:integration
84+
5785
e2e-tests:
5886
runs-on: ubuntu-latest
5987
strategy:
@@ -70,6 +98,30 @@ jobs:
7098
- name: Run end-to-end tests
7199
run: tox -e test-e2e
72100

101+
ui-e2e-tests:
102+
permissions:
103+
contents: "read"
104+
id-token: "write"
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Check out code
108+
uses: actions/checkout@v3
109+
110+
- name: Install dependencies
111+
run: npm ci
112+
113+
- name: Generate Build
114+
run: |
115+
npm run build
116+
117+
- name: Start the Next.js app
118+
run: |
119+
npx serve@latest src/ui/out &
120+
npx wait-on http://localhost:3000 # Wait until the app is ready
121+
122+
- name: Run Cypress tests
123+
run: npm run test:e2e --headless
124+
73125
build-and-publish:
74126
needs: [unit-tests, integration-tests, e2e-tests]
75127
runs-on: ubuntu-latest
@@ -115,3 +167,99 @@ jobs:
115167
username: ${{ secrets.PYPI_PUBLIC_USER }}
116168
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
117169
whl: $(find dist -name '*.tar.gz')
170+
171+
publish-versioned-ui-build:
172+
needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests]
173+
permissions:
174+
contents: write
175+
runs-on: ubuntu-latest
176+
steps:
177+
- name: Check out code
178+
uses: actions/checkout@v3
179+
180+
- name: Install dependencies
181+
run: npm ci
182+
183+
- name: "Set GIT_TAG"
184+
id: vars
185+
run: |
186+
if [ -z "${{ github.ref_name }}" ]; then
187+
echo "TAG=latest" >> $GITHUB_ENV
188+
else
189+
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
190+
fi
191+
192+
- name: Build app to root
193+
id: build
194+
run: |
195+
# Export vars to ensure they are loaded before build
196+
export $(grep -v '^#' .env.staging | xargs)
197+
198+
# Set asset prefix and base path with git tag
199+
ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/release/${TAG}
200+
BASE_PATH=/ui/release/${TAG}
201+
GIT_SHA=${{ github.sha }}
202+
export ASSET_PREFIX=${ASSET_PREFIX}
203+
export BASE_PATH=${BASE_PATH}
204+
export GIT_SHA=${GIT_SHA}
205+
npm run build
206+
207+
- name: Deploy versioned build to GitHub Pages
208+
uses: peaceiris/actions-gh-pages@v3
209+
with:
210+
github_token: ${{ secrets.GITHUB_TOKEN }}
211+
publish_dir: ./ui/out
212+
destination_dir: ui/release/${TAG}
213+
keep_files: false
214+
user_name: ${{ github.actor }}
215+
user_email: ${{ github.actor }}@users.noreply.github.com
216+
publish_branch: gh-pages
217+
218+
publish-latest-ui-build:
219+
needs: [publish-versioned-ui-build]
220+
permissions:
221+
contents: write
222+
pull-requests: write
223+
issues: write
224+
runs-on: ubuntu-latest
225+
steps:
226+
- name: Check out code
227+
uses: actions/checkout@v3
228+
229+
- name: Install dependencies
230+
run: npm ci
231+
232+
- name: "Set GIT_TAG"
233+
id: vars
234+
run: |
235+
if [ -z "${{ github.ref_name }}" ]; then
236+
echo "TAG=latest" >> $GITHUB_ENV
237+
else
238+
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
239+
fi
240+
241+
- name: Build app to root
242+
id: build
243+
run: |
244+
# Export vars to ensure they are loaded before build
245+
export $(grep -v '^#' .env.development | xargs)
246+
247+
# Set asset prefix and base path with git tag
248+
ASSET_PREFIX=https://neuralmagic.github.io/guidellm/release/latest
249+
BASE_PATH=/release/latest
250+
GIT_SHA=${{ github.sha }}
251+
export ASSET_PREFIX=${ASSET_PREFIX}
252+
export BASE_PATH=${BASE_PATH}
253+
export GIT_SHA=${GIT_SHA}
254+
npm run build
255+
256+
- name: Update latest build in GitHub Pages
257+
uses: peaceiris/actions-gh-pages@v3
258+
with:
259+
github_token: ${{ secrets.GITHUB_TOKEN }}
260+
publish_dir: ./ui/out
261+
destination_dir: ui/release/latest
262+
keep_files: false
263+
user_name: ${{ github.actor }}
264+
user_email: ${{ github.actor }}@users.noreply.github.com
265+
publish_branch: gh-pages

0 commit comments

Comments
 (0)