1+ name : Build with UV Dependencies
2+
3+ on :
4+ workflow_dispatch : # 手动触发
5+
6+ jobs :
7+ build-windows :
8+ runs-on : windows-latest
9+
10+ steps :
11+ - uses : actions/checkout@v4
12+
13+ - name : Set up Python
14+ uses : actions/setup-python@v4
15+ with :
16+ python-version : ' 3.8'
17+
18+ - name : Install UV
19+ run : |
20+ python -m pip install --upgrade pip
21+ pip install uv
22+
23+ - name : Install dependencies using UV (from pyproject.toml)
24+ run : |
25+ uv sync --frozen
26+
27+ - name : Verify installations
28+ run : |
29+ uv run python -c "import sys; print('Python version:', sys.version)"
30+ uv run python -c "import PyQt5; print('PyQt5 imported successfully')"
31+ uv run python -c "from PyQt5 import QtCore, QtGui, QtWidgets; print('PyQt5 modules OK')"
32+ uv run python -c "import numpy; print('NumPy version:', numpy.__version__)"
33+ uv run python -c "import PIL; print('Pillow version:', PIL.__version__)"
34+
35+ - name : Test compile main_qt5.py
36+ run : |
37+ cd video_clips
38+ uv run python -m py_compile main_qt5.py
39+ echo "main_qt5.py syntax OK"
40+
41+ - name : Build with PyInstaller using UV environment
42+ run : |
43+ cd video_clips
44+ uv run python -m PyInstaller --clean --noconfirm --onefile --name "VideoClipsApp" --hidden-import "PyQt5.QtCore" --hidden-import "PyQt5.QtGui" --hidden-import "PyQt5.QtWidgets" --hidden-import "PyQt5.sip" --hidden-import "numpy" --hidden-import "PIL.Image" --collect-submodules "PyQt5" main_qt5.py
45+
46+ - name : Verify build output
47+ run : |
48+ cd video_clips
49+ dir dist
50+ if exist dist\VideoClipsApp.exe (echo "SUCCESS: VideoClipsApp.exe created" && dir dist\VideoClipsApp.exe) else (echo "ERROR: VideoClipsApp.exe not found")
51+
52+ - name : Create Release Package
53+ run : |
54+ cd video_clips
55+ mkdir release
56+ copy dist\VideoClipsApp.exe release\
57+ echo @echo off > release\run_app.bat
58+ echo echo Starting VideoClipsApp... >> release\run_app.bat
59+ echo VideoClipsApp.exe >> release\run_app.bat
60+ echo pause >> release\run_app.bat
61+ echo UV Dependencies Build - VideoClipsApp Windows Executable > release\README.txt
62+ echo Double-click VideoClipsApp.exe to run the application >> release\README.txt
63+
64+ - name : Upload Release Artifact
65+ uses : actions/upload-artifact@v3
66+ with :
67+ name : VideoClipsApp-Windows-UV
68+ path : video_clips/release/
69+ retention-days : 30
70+
71+ build-linux :
72+ runs-on : ubuntu-latest
73+
74+ steps :
75+ - uses : actions/checkout@v4
76+
77+ - name : Set up Python
78+ uses : actions/setup-python@v4
79+ with :
80+ python-version : ' 3.8'
81+
82+ - name : Install system dependencies
83+ run : |
84+ sudo apt-get update
85+ sudo apt-get install -y python3-pyqt5
86+
87+ - name : Install UV
88+ run : |
89+ python -m pip install --upgrade pip
90+ pip install uv
91+
92+ - name : Install dependencies using UV (from pyproject.toml)
93+ run : |
94+ uv sync --frozen
95+
96+ - name : Build with PyInstaller using UV environment
97+ run : |
98+ cd video_clips
99+ uv run python -m PyInstaller --clean --noconfirm --onefile --name "VideoClipsApp" --hidden-import "PyQt5.QtCore" --hidden-import "PyQt5.QtGui" --hidden-import "PyQt5.QtWidgets" --hidden-import "PyQt5.sip" --hidden-import "numpy" --hidden-import "PIL.Image" --collect-submodules "PyQt5" main_qt5.py
100+
101+ - name : Create Release Package
102+ run : |
103+ cd video_clips
104+ mkdir -p release
105+ cp dist/VideoClipsApp release/
106+ cat > release/run_app.sh << 'EOF'
107+ #!/bin/bash
108+ cd "$(dirname "$0")"
109+ echo "Starting VideoClipsApp..."
110+ ./VideoClipsApp
111+ EOF
112+ chmod +x release/run_app.sh
113+ echo "UV Dependencies Build - VideoClipsApp Linux Executable" > release/README.txt
114+ echo "Run ./VideoClipsApp or use ./run_app.sh" >> release/README.txt
115+
116+ - name : Upload Release Artifact
117+ uses : actions/upload-artifact@v3
118+ with :
119+ name : VideoClipsApp-Linux-UV
120+ path : video_clips/release/
121+ retention-days : 30
0 commit comments