-
Notifications
You must be signed in to change notification settings - Fork 58
354 lines (318 loc) · 11.5 KB
/
Copy pathpublish.yml
File metadata and controls
354 lines (318 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
name: Build and Publish to PyPI
on:
push:
branches:
- production
jobs:
# ============================================================
# 1. Frontend Build
# ============================================================
react-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: DashAI/front
steps:
- uses: actions/checkout@v4
- name: Enable Corepack and use Yarn 3
run: corepack enable
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "yarn"
cache-dependency-path: DashAI/front/yarn.lock
- name: Install and build
run: |
yarn install --frozen-lockfile
yarn build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: react-build
path: DashAI/front/build
retention-days: 1
- name: Run frontend tests
run: yarn test --passWithNoTests
# ============================================================
# 2. Publish to PyPI
# ============================================================
publish-pypi:
needs: react-build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download frontend build artifact
uses: actions/download-artifact@v4
with:
name: react-build
path: DashAI/front/build
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build Python package
run: uv build
- name: Verify frontend is included in wheel
run: |
if ! zipinfo dist/*.whl | grep -q 'DashAI/front/build'; then
echo "Frontend files not found in the wheel package!"
exit 1
fi
- name: Check distribution metadata
run: uvx twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: uvx twine upload --skip-existing dist/*
# ============================================================
# 3. Build Windows Executable
# ============================================================
build-windows-executable:
needs: react-build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download React build artifact
uses: actions/download-artifact@v4
with:
name: react-build
path: DashAI/front/build
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true
- name: Install dependencies (CPU-only)
run: |
uv sync --locked --extra cpu --no-dev
uv pip install pyinstaller
- name: Build executable
shell: cmd
run: |
uv run --no-sync pyinstaller --clean --noconfirm dashai.spec
- name: Install Inno Setup
run: choco install innosetup -y
- name: Build Windows Installer
shell: cmd
run: |
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer/installer.iss
- name: Upload Windows Installer
uses: actions/upload-artifact@v4
with:
name: dashAI-windows-installer
path: installer/dashAI-Installer.exe
retention-days: 1
# ============================================================
# 4. Build macOS ARM64 Executable
# ============================================================
build-macos-arm64:
needs: react-build
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Download React build artifact
uses: actions/download-artifact@v4
with:
name: react-build
path: DashAI/front/build
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true
- name: Install dependencies (CPU-only)
run: |
uv sync --locked --extra cpu --no-dev
uv pip install pyinstaller
brew install create-dmg
- name: Build ARM64 App Bundle
run: |
uv run --no-sync pyinstaller --clean --noconfirm dashai.spec
- name: Sign App Bundle (ad-hoc)
run: |
codesign --force --deep --sign - dist/dashAI.app
- name: Create DMG
run: |
rm -f dashAI-macos-arm64.dmg
create-dmg \
--volname "dashAI Installer" \
--window-pos 200 120 \
--window-size 800 400 \
--app-drop-link 600 185 \
--hide-extension "dashAI.app" \
--no-internet-enable \
"dashAI-macos-arm64.dmg" \
"dist/dashAI.app"
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: dashAI-dmg-arm64
path: dashAI-macos-arm64.dmg
retention-days: 1
# ============================================================
# 5. Build macOS x86_64 Executable
# ============================================================
build-macos-x86_64:
needs: react-build
runs-on: macos-15-intel
# PyTorch's last macOS Intel wheel is 2.2.2, so `uv sync --locked` can't
# resolve here. Kept non-blocking until we decide to drop Intel for good.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Download React build artifact
uses: actions/download-artifact@v4
with:
name: react-build
path: DashAI/front/build
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true
- name: Install dependencies (CPU-only)
run: |
uv sync --locked --extra cpu --no-dev
uv pip install pyinstaller
brew install create-dmg
- name: Build x86_64 App Bundle
run: |
uv run --no-sync pyinstaller --clean --noconfirm dashai.spec
- name: Sign App Bundle (ad-hoc)
run: |
codesign --force --deep --sign - dist/dashAI.app
- name: Create DMG
run: |
rm -f dashAI-macos-x86_64.dmg
create-dmg \
--volname "dashAI Installer" \
--window-pos 200 120 \
--window-size 800 400 \
--app-drop-link 600 185 \
--hide-extension "dashAI.app" \
--no-internet-enable \
"dashAI-macos-x86_64.dmg" \
"dist/dashAI.app"
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: dashAI-dmg-x86_64
path: dashAI-macos-x86_64.dmg
retention-days: 1
# ============================================================
# 6. Build Linux AppImage
# ============================================================
build-linux-appimage:
needs: react-build
# ubuntu-22.04 sets the minimum glibc (2.35) for the AppImage.
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download React build artifact
uses: actions/download-artifact@v4
with:
name: react-build
path: DashAI/front/build
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
# python-appimage drives its own embedded pip, so it stays pip-based
- name: Install build tooling
run: |
python -m pip install --upgrade pip
pip install python-appimage
sudo apt-get update
sudo apt-get install -y libfuse2 imagemagick librsvg2-bin
- name: Build wheel (frontend bundled)
run: uv build --wheel
- name: Verify frontend is included in wheel
run: |
if ! unzip -l dist/*.whl | grep -q 'DashAI/front/build'; then
echo "Frontend files not found in the wheel package!"
exit 1
fi
- name: Prepare AppImage recipe
run: |
# Icon referenced by dashai.desktop (Icon=dashai). Rasterize the
# scalable SVG isotype to a large square PNG so desktops have a
# high-resolution icon (the .ico only carried small frames).
rsvg-convert -h 512 DashAI/front/public/dashai-isotype.svg -o /tmp/dashai-isotype.png
convert /tmp/dashai-isotype.png -background none -gravity center -extent 512x512 appimage/dashai.png
# Append the freshly built wheel (with bundled frontend) to the recipe requirements
WHEEL=$(ls "$PWD"/dist/*.whl | head -n1)
echo "$WHEEL" >> appimage/requirements.txt
- name: Build AppImage
# CPU torch as the primary index; PyPI + the precompiled CPU llama-cpp
# wheel index as extras. python-appimage's pip honors these env vars.
env:
PIP_INDEX_URL: https://download.pytorch.org/whl/cpu
PIP_EXTRA_INDEX_URL: "https://pypi.org/simple https://abetlen.github.io/llama-cpp-python/whl/cpu"
run: |
# python-appimage names the output dashAI-x86_64.AppImage
# (.desktop Name + arch), which is the name uploaded below.
python-appimage build app -p 3.12 appimage/
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
name: dashAI-appimage
path: dashAI-x86_64.AppImage
retention-days: 1
# ============================================================
# 7. Publish installers to GitHub Release
# ============================================================
github-release:
needs:
- publish-pypi
- build-windows-executable
- build-macos-arm64
- build-linux-appimage
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Extract version from pyproject.toml
id: version
run: |
VERSION=$(grep -m 1 '^version = ' pyproject.toml | sed -E 's/version = "([^"]+)"/\1/')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Download Windows installer
uses: actions/download-artifact@v4
with:
name: dashAI-windows-installer
path: artifacts/windows
- name: Download macOS ARM64 DMG
uses: actions/download-artifact@v4
with:
name: dashAI-dmg-arm64
path: artifacts/macos-arm64
- name: Download Linux AppImage
uses: actions/download-artifact@v4
with:
name: dashAI-appimage
path: artifacts/linux
- name: Stage release files with OS/arch tags
run: |
V="${{ steps.version.outputs.version }}"
mkdir -p release
cp "artifacts/windows/dashAI-Installer.exe" "release/dashAI-${V}-x64-windows.exe"
cp "artifacts/macos-arm64/dashAI-macos-arm64.dmg" "release/dashAI-${V}-arm-osx.dmg"
cp "artifacts/linux/dashAI-x86_64.AppImage" "release/dashAI-${V}-x64-linux.AppImage"
- name: Create / update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
release/dashAI-${{ steps.version.outputs.version }}-x64-windows.exe
release/dashAI-${{ steps.version.outputs.version }}-arm-osx.dmg
release/dashAI-${{ steps.version.outputs.version }}-x64-linux.AppImage