依 R5 五輪決策把 visionA-local 從「Wails 內嵌 Next.js」重構為「Wails
本機伺服器控制台 + 瀏覽器 Web UI」模式(類比 Docker Desktop / Ollama)。
程式碼變動
- M8-1 砍 yt-dlp 全套(後端 resolver / URL handler / 前端 URL tab /
Makefile vendor / installer / bootstrap / CI workflow,-555 行)
- M8-2 砍 Mock 模式全套(driver/mock、mock_camera、Settings runtimeMode、
VISIONA_MOCK 環境變數,-528 行)
- M8-3 ffmpeg 從 GPL 切換到 LGPL 混合方案:Windows/Linux 用 BtbN 現成
LGPL binary,macOS 自 build minimal decoder-only 進 git
(vendor/ffmpeg/macos/ffmpeg 5.7MB + ffprobe 5.6MB,比 GPL 版省 85% 空間)
- M8-4 Wails Server Controller:state machine、log ring buffer 2000 行、
preferences.json atomic write、boot-id、Gin SkipPaths、shutdown 7+1 秒、
notify_*.go 三平台 OS 通知、watchServer 改 Error state 不 os.Exit
- M8-4b 啟動階段管線 R5-E:6 階段進度 event、20s soft / 60s hard timeout、
stage 5/6 skip 規則、sentinel file、RestartStartupSequence 5 步驟
- M8-5 Wails 控制台 vanilla HTML/JS/CSS(9 檔 ~2012 行)取代 M7-B splash:
state 視覺、log panel、startup progress panel、Stage 6 manual CTA
pulse、shutdown modal、Settings、Dark Mode、i18n 中英雙語
- M8-6 上傳影片副檔名擴充(mp4/avi/mov/mpeg/mpg)
- M8-7 Web UI Server Offline Overlay(role=alertdialog + focus trap +
wsEverConnected 容錯 + Page Visibility)
- M8-8 CORS middleware(127.0.0.1/localhost only + suffix attack 防護)+
ws/origin.go 獨立 WebSocket CheckOrigin 避 package cycle
- MAJ-4 server:shutdown-imminent WebSocket broadcast 機制
(/ws/system endpoint + notifyShutdownImminent helper)
- M8-9 Boot-ID + 瀏覽器 tab 自動重連(sessionStorage loop guard)
品質
- ~105+ 新 unit test + race detector (-count=2) 全綠
- 10 個 milestone 全部通過 Reviewer 審查
- 三方 v2 + v2.1 文件(PRD / Design Spec / TDD)+ 交叉互審紀錄
收錄在 .autoflow/
交付前待處理(M8-10)
- 重跑 make payload-macos 把舊 GPL 77MB binary 換成新 LGPL
- 三平台 end-to-end build 驗證
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
259 lines
8.0 KiB
YAML
259 lines
8.0 KiB
YAML
name: Build
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
tags: ['v*']
|
||
pull_request:
|
||
branches: [main]
|
||
workflow_dispatch:
|
||
|
||
env:
|
||
GO_VERSION: '1.26'
|
||
NODE_VERSION: '22'
|
||
PNPM_VERSION: '9'
|
||
|
||
jobs:
|
||
# ────────────────────────────────────────────────────────────────
|
||
# macOS (Intel / x86_64)
|
||
# 使用 macos-13:目前最後的 Intel Mac runner,避免 macos-latest 被
|
||
# 切到 Apple Silicon 後產出 ARM binary。
|
||
# ────────────────────────────────────────────────────────────────
|
||
build-macos:
|
||
name: Build macOS (x86_64)
|
||
runs-on: macos-13
|
||
timeout-minutes: 60
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Go
|
||
uses: actions/setup-go@v5
|
||
with:
|
||
go-version: ${{ env.GO_VERSION }}
|
||
|
||
- name: Setup Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: ${{ env.NODE_VERSION }}
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v4
|
||
with:
|
||
version: ${{ env.PNPM_VERSION }}
|
||
|
||
- name: Install Wails CLI
|
||
run: |
|
||
go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||
echo "$HOME/go/bin" >> "$GITHUB_PATH"
|
||
|
||
- name: Cache vendor/
|
||
uses: actions/cache@v4
|
||
with:
|
||
path: vendor/
|
||
key: vendor-darwin-${{ hashFiles('Makefile') }}-${{ hashFiles('visiona-local/wheels/macos/**') }}
|
||
restore-keys: |
|
||
vendor-darwin-${{ hashFiles('Makefile') }}-
|
||
vendor-darwin-
|
||
|
||
- name: vendor-sync (macOS deps)
|
||
run: make vendor-sync
|
||
|
||
- name: Build .dmg
|
||
run: make dmg
|
||
|
||
- name: Verify .dmg
|
||
run: |
|
||
ls -lh dist/visiona-local.dmg
|
||
file dist/visiona-local.dmg
|
||
hdiutil imageinfo dist/visiona-local.dmg | head -20
|
||
|
||
- name: Upload .dmg artifact
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: visiona-local-macos-x64
|
||
path: dist/visiona-local.dmg
|
||
retention-days: 30
|
||
if-no-files-found: error
|
||
|
||
# ────────────────────────────────────────────────────────────────
|
||
# Windows (x86_64)
|
||
# 使用 windows-2022。vendor-sync 的 macOS/Linux 部分會失敗,
|
||
# 因此只跑 *-windows 的 vendor targets。
|
||
# ────────────────────────────────────────────────────────────────
|
||
build-windows:
|
||
name: Build Windows (x86_64)
|
||
runs-on: windows-2022
|
||
timeout-minutes: 60
|
||
defaults:
|
||
run:
|
||
shell: bash
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Go
|
||
uses: actions/setup-go@v5
|
||
with:
|
||
go-version: ${{ env.GO_VERSION }}
|
||
|
||
- name: Setup Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: ${{ env.NODE_VERSION }}
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v4
|
||
with:
|
||
version: ${{ env.PNPM_VERSION }}
|
||
|
||
- name: Install Wails CLI
|
||
run: |
|
||
go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
|
||
|
||
- name: Install Inno Setup
|
||
run: choco install innosetup -y --no-progress
|
||
shell: pwsh
|
||
|
||
- name: Add Inno Setup to PATH
|
||
run: echo "/c/Program Files (x86)/Inno Setup 6" >> "$GITHUB_PATH"
|
||
|
||
- name: Cache vendor/
|
||
uses: actions/cache@v4
|
||
with:
|
||
path: vendor/
|
||
key: vendor-windows-${{ hashFiles('Makefile') }}-${{ hashFiles('visiona-local/wheels/windows/**') }}
|
||
restore-keys: |
|
||
vendor-windows-${{ hashFiles('Makefile') }}-
|
||
vendor-windows-
|
||
|
||
- name: vendor-sync (Windows-only deps)
|
||
run: |
|
||
make vendor-python-windows \
|
||
vendor-wheels-windows \
|
||
vendor-ffmpeg-windows
|
||
|
||
- name: Build server.exe
|
||
env:
|
||
GOOS: windows
|
||
GOARCH: amd64
|
||
run: |
|
||
mkdir -p payload/windows/bin
|
||
cd server
|
||
go build -o ../payload/windows/bin/visiona-local-server.exe .
|
||
ls -lh ../payload/windows/bin/visiona-local-server.exe
|
||
|
||
- name: Build frontend (for go:embed)
|
||
run: make build-embed
|
||
|
||
- name: Build .exe installer
|
||
run: make exe
|
||
|
||
- name: Verify .exe
|
||
run: |
|
||
ls -lh dist/visiona-local-*.exe || ls -lh dist/*.exe
|
||
file dist/visiona-local-*.exe 2>/dev/null || true
|
||
|
||
- name: Upload .exe artifact
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: visiona-local-windows-x64
|
||
path: dist/visiona-local-*.exe
|
||
retention-days: 30
|
||
if-no-files-found: error
|
||
|
||
# ────────────────────────────────────────────────────────────────
|
||
# Linux (x86_64)
|
||
# 使用 ubuntu-22.04(glibc 2.35,相容性比 24.04 更好)。
|
||
# ────────────────────────────────────────────────────────────────
|
||
build-linux:
|
||
name: Build Linux (x86_64)
|
||
runs-on: ubuntu-22.04
|
||
timeout-minutes: 60
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Go
|
||
uses: actions/setup-go@v5
|
||
with:
|
||
go-version: ${{ env.GO_VERSION }}
|
||
|
||
- name: Setup Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: ${{ env.NODE_VERSION }}
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v4
|
||
with:
|
||
version: ${{ env.PNPM_VERSION }}
|
||
|
||
- name: Install system deps
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install -y --no-install-recommends \
|
||
build-essential \
|
||
pkg-config \
|
||
libgtk-3-dev \
|
||
libwebkit2gtk-4.1-dev \
|
||
libusb-1.0-0-dev \
|
||
fuse \
|
||
libfuse2 \
|
||
desktop-file-utils
|
||
|
||
- name: Install Wails CLI
|
||
run: |
|
||
go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||
echo "$HOME/go/bin" >> "$GITHUB_PATH"
|
||
|
||
- name: Install appimagetool
|
||
run: |
|
||
curl -fL -o /tmp/appimagetool \
|
||
"https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage"
|
||
chmod +x /tmp/appimagetool
|
||
sudo mv /tmp/appimagetool /usr/local/bin/appimagetool
|
||
appimagetool --version || true
|
||
|
||
- name: Cache vendor/
|
||
uses: actions/cache@v4
|
||
with:
|
||
path: vendor/
|
||
key: vendor-linux-${{ hashFiles('Makefile') }}-${{ hashFiles('visiona-local/wheels/linux/**') }}
|
||
restore-keys: |
|
||
vendor-linux-${{ hashFiles('Makefile') }}-
|
||
vendor-linux-
|
||
|
||
- name: vendor-sync (Linux-only deps)
|
||
run: |
|
||
make vendor-python-linux \
|
||
vendor-wheels-linux \
|
||
vendor-ffmpeg-linux
|
||
|
||
- name: Build server (Linux)
|
||
run: |
|
||
mkdir -p payload/linux/bin
|
||
cd server
|
||
GOOS=linux GOARCH=amd64 go build -o ../payload/linux/bin/visiona-local-server .
|
||
ls -lh ../payload/linux/bin/visiona-local-server
|
||
|
||
- name: Build frontend (for go:embed)
|
||
run: make build-embed
|
||
|
||
- name: Build AppImage
|
||
run: make appimage
|
||
|
||
- name: Verify AppImage
|
||
run: |
|
||
ls -lh dist/visiona-local-*.AppImage
|
||
file dist/visiona-local-*.AppImage
|
||
|
||
- name: Upload AppImage artifact
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: visiona-local-linux-x64
|
||
path: dist/visiona-local-*.AppImage
|
||
retention-days: 30
|
||
if-no-files-found: error
|