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