@@ -33,15 +33,19 @@ jobs:
3333 arch : arm64
3434 python : python3.10
3535 asr : funasr-onnx
36- artifact_path : |
37- desktop/release/*.dmg
36+ python_env_exe : python-env/bin/python3
37+ build_script : build:mac
38+ debug : " "
39+ artifact_glob : desktop/release/*.dmg
3840 - os : windows-latest
3941 platform : win
4042 arch : x64
4143 python : python
4244 asr : funasr-onnx
43- artifact_path : |
44- desktop/release/*.exe
45+ python_env_exe : python-env/Scripts/python.exe
46+ build_script : build:win
47+ debug : electron-builder
48+ artifact_glob : desktop/release/*.exe
4549
4650 defaults :
4751 run :
@@ -115,21 +119,17 @@ jobs:
115119 }
116120
117121 - name : Prepare Python env for ASR backend
118- working-directory : desktop
119122 run : pnpm run prepare:python
120123
121124 # 验证 Python 环境和 PyInstaller
122125 - name : Verify Python environment
123- shell : bash
124126 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
127+ PYTHON_PATH="${{ format('{0}/desktop/{1}', github.workspace, matrix.python_env_exe) }}"
130128 echo "Python path: $PYTHON_PATH"
131129 "$PYTHON_PATH" --version
132- "$PYTHON_PATH" -m pip list | head -30
130+ # 注意:在 bash -o pipefail 下,`pip list | head -30` 会因为 head 提前关闭 stdout 触发 BrokenPipe(exit 120),从而让 CI 失败。
131+ # 这里用 sed 打印前 30 行但不提前关闭管道,避免 BrokenPipe。
132+ "$PYTHON_PATH" -m pip list | sed -n '1,30p'
133133 "$PYTHON_PATH" -c "import PyInstaller; print('PyInstaller OK')" || echo "PyInstaller import check failed"
134134 echo "Checking for PyInstaller module..."
135135 "$PYTHON_PATH" -m PyInstaller --version || true
@@ -144,38 +144,32 @@ jobs:
144144 env :
145145 PYTHON : ${{ matrix.python }}
146146 ASR_IMPL : ${{ matrix.asr }}
147- 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' || '' }}
147+ ASR_PYTHON_PATH : ${{ format('{0}/desktop/{1}', github.workspace, matrix.python_env_exe) }}
148+ DEBUG : ${{ matrix.debug }}
150149 run : |
151150 echo "=== Build Environment ==="
152151 echo "Platform: ${{ matrix.platform }}"
153152 echo "Arch: ${{ matrix.arch }}"
154153 echo "ASR_PYTHON_PATH: $ASR_PYTHON_PATH"
155154 echo "========================="
156155
157- if [ "${{ matrix.platform }}" = "mac" ]; then
158- pnpm run build:mac -- --${{ matrix.arch }}
159- else
160- pnpm run build:win -- --${{ matrix.arch }}
161- fi
156+ pnpm run ${{ matrix.build_script }} -- --${{ matrix.arch }}
162157
163158 # Windows: 列出构建产物帮助调试
164159 - name : List build artifacts
165160 if : always()
166- shell : bash
167161 run : |
168162 echo "=== Release directory contents ==="
169163 ls -la release/ || echo "release/ not found"
170164 echo "=== Backend dist contents ==="
171165 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"
166+ ls -la backend/dist/asr-backend/ 2>/dev/null | sed -n '1,20p' || echo "asr-backend dir not found"
173167
174168 - name : Upload artifacts
175169 uses : actions/upload-artifact@v4
176170 with :
177171 name : livegalgame-desktop-${{ matrix.platform }}-${{ matrix.arch }}-v${{ steps.meta.outputs.app_version }}
178- path : ${{ matrix.artifact_path }}
172+ path : ${{ matrix.artifact_glob }}
179173 if-no-files-found : error
180174 retention-days : 14
181175
0 commit comments