@@ -72,13 +72,68 @@ jobs:
7272 with :
7373 python-version : ' 3.10'
7474
75+ # Windows: 安装 Visual Studio Build Tools(用于编译 native 模块)
76+ - name : Setup MSVC Build Tools (Windows only)
77+ if : matrix.platform == 'win'
78+ uses : microsoft/setup-msbuild@v2
79+
7580 - name : Install dependencies
7681 run : pnpm install --frozen-lockfile
7782
83+ # Windows: 确保 app-builder.exe 存在且可执行
84+ - name : Verify and fix app-builder (Windows only)
85+ if : matrix.platform == 'win'
86+ shell : pwsh
87+ run : |
88+ # 查找 app-builder.exe
89+ $appBuilder = Get-ChildItem -Path "node_modules" -Recurse -Filter "app-builder.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
90+
91+ if ($appBuilder) {
92+ Write-Host "Found app-builder.exe at: $($appBuilder.FullName)"
93+ Write-Host "File size: $($appBuilder.Length) bytes"
94+
95+ # 验证文件是否为有效的 PE 文件
96+ $bytes = [System.IO.File]::ReadAllBytes($appBuilder.FullName)
97+ if ($bytes[0] -eq 0x4D -and $bytes[1] -eq 0x5A) {
98+ Write-Host "✓ Valid PE executable"
99+ } else {
100+ Write-Warning "File may be corrupted, reinstalling..."
101+ Remove-Item -Recurse -Force "node_modules/app-builder-bin" -ErrorAction SilentlyContinue
102+ Remove-Item -Recurse -Force "node_modules/.pnpm/app-builder-bin*" -ErrorAction SilentlyContinue
103+ pnpm install --frozen-lockfile
104+ }
105+ } else {
106+ Write-Warning "app-builder.exe not found, attempting reinstall..."
107+ pnpm install --frozen-lockfile
108+ }
109+
110+ # 再次验证
111+ $appBuilder = Get-ChildItem -Path "node_modules" -Recurse -Filter "app-builder.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
112+ if (-not $appBuilder) {
113+ Write-Error "app-builder.exe still not found after reinstall!"
114+ exit 1
115+ }
116+
78117 - name : Prepare Python env for ASR backend
79118 working-directory : desktop
80119 run : pnpm run prepare:python
81120
121+ # 验证 Python 环境和 PyInstaller
122+ - name : Verify Python environment
123+ shell : bash
124+ run : |
125+ if [ "${{ matrix.platform }}" = "win" ]; then
126+ PYTHON_PATH="${{ github.workspace }}/desktop/python-env/Scripts/python.exe"
127+ else
128+ PYTHON_PATH="${{ github.workspace }}/desktop/python-env/bin/python3"
129+ fi
130+ echo "Python path: $PYTHON_PATH"
131+ "$PYTHON_PATH" --version
132+ "$PYTHON_PATH" -m pip list | head -30
133+ "$PYTHON_PATH" -c "import PyInstaller; print('PyInstaller OK')" || echo "PyInstaller import check failed"
134+ echo "Checking for PyInstaller module..."
135+ "$PYTHON_PATH" -m PyInstaller --version || true
136+
82137 - name : Print app version
83138 id : meta
84139 run : |
@@ -90,13 +145,32 @@ jobs:
90145 PYTHON : ${{ matrix.python }}
91146 ASR_IMPL : ${{ matrix.asr }}
92147 ASR_PYTHON_PATH : ${{ matrix.platform == 'win' && format('{0}/desktop/python-env/Scripts/python.exe', github.workspace) || format('{0}/desktop/python-env/bin/python3', github.workspace) }}
148+ # Windows: 增加调试日志级别
149+ DEBUG : ${{ matrix.platform == 'win' && 'electron-builder' || '' }}
93150 run : |
151+ echo "=== Build Environment ==="
152+ echo "Platform: ${{ matrix.platform }}"
153+ echo "Arch: ${{ matrix.arch }}"
154+ echo "ASR_PYTHON_PATH: $ASR_PYTHON_PATH"
155+ echo "========================="
156+
94157 if [ "${{ matrix.platform }}" = "mac" ]; then
95158 pnpm run build:mac -- --${{ matrix.arch }}
96159 else
97160 pnpm run build:win -- --${{ matrix.arch }}
98161 fi
99162
163+ # Windows: 列出构建产物帮助调试
164+ - name : List build artifacts
165+ if : always()
166+ shell : bash
167+ run : |
168+ echo "=== Release directory contents ==="
169+ ls -la release/ || echo "release/ not found"
170+ echo "=== Backend dist contents ==="
171+ ls -la backend/dist/ || echo "backend/dist/ not found"
172+ ls -la backend/dist/asr-backend/ 2>/dev/null | head -20 || echo "asr-backend dir not found"
173+
100174 - name : Upload artifacts
101175 uses : actions/upload-artifact@v4
102176 with :
0 commit comments