Skip to content

Commit fc69a0a

Browse files
committed
add pyinstaller ci for ui
1 parent 64818c1 commit fc69a0a

1 file changed

Lines changed: 80 additions & 61 deletions

File tree

.github/workflows/pyinstaller-release.yml

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
discussions: write
1212

1313
env:
14-
APP_NAME: "HwCodecDetect"
14+
BASE_APP_NAME: "HwCodecDetect"
1515
ENTRY_POINT_SCRIPT: "launcher.py"
1616

1717
jobs:
@@ -22,57 +22,109 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
include:
25-
# --- Windows ---
25+
# ======================== MAIN BRANCH (CLI) ========================
2626
- os: windows-latest
2727
python_arch: 'x64'
28-
artifact_name: HwCodecDetect-Windows-x64.exe
2928
asset_name: HwCodecDetect-Windows-x64.exe
3029
job_type: native
30+
branch_mode: main
3131

3232
- os: windows-latest
33-
python_arch: 'x86' # 32bit Windows
34-
artifact_name: HwCodecDetect-Windows-x86.exe
33+
python_arch: 'x86'
3534
asset_name: HwCodecDetect-Windows-x86.exe
3635
job_type: native
36+
branch_mode: main
3737

38-
# --- macOS ---
39-
- os: macos-15-intel # Intel Macs (runs on x86_64)
38+
- os: macos-15-intel
4039
python_arch: 'x64'
41-
artifact_name: HwCodecDetect-macOS-Intel
4240
asset_name: HwCodecDetect-macOS-Intel
4341
job_type: native
42+
branch_mode: main
4443

45-
- os: macos-latest # Apple Silicon (runs on arm64/M1/M2)
44+
- os: macos-latest
4645
python_arch: 'arm64'
47-
artifact_name: HwCodecDetect-macOS-ARM64
4846
asset_name: HwCodecDetect-macOS-ARM64
4947
job_type: native
48+
branch_mode: main
5049

51-
# --- Linux Native (x64) ---
5250
- os: ubuntu-22.04
5351
python_arch: 'x64'
54-
artifact_name: HwCodecDetect-Linux-x64
5552
asset_name: HwCodecDetect-Linux-x64
5653
job_type: native
54+
branch_mode: main
5755

58-
# --- Linux Emulated (ARM64 / aarch64) ---
5956
- os: ubuntu-22.04
6057
job_type: emulated
6158
qemu_arch: aarch64
6259
docker_img: python:3.10-bullseye
63-
artifact_name: HwCodecDetect-Linux-arm64
6460
asset_name: HwCodecDetect-Linux-arm64
61+
branch_mode: main
6562

66-
# --- Linux Emulated (x86 / i386) ---
6763
- os: ubuntu-22.04
6864
job_type: emulated
6965
qemu_arch: i386
7066
docker_img: i386/python:3.10-slim-bullseye
71-
artifact_name: HwCodecDetect-Linux-x86
7267
asset_name: HwCodecDetect-Linux-x86
68+
branch_mode: main
69+
70+
# ======================== UI BRANCH (GUI) ========================
71+
- os: windows-latest
72+
python_arch: 'x64'
73+
asset_name: HwCodecDetect-GUI-Windows-x64.exe
74+
job_type: native
75+
branch_mode: ui
76+
77+
- os: windows-latest
78+
python_arch: 'x86'
79+
asset_name: HwCodecDetect-GUI-Windows-x86.exe
80+
job_type: native
81+
branch_mode: ui
82+
83+
- os: macos-15-intel
84+
python_arch: 'x64'
85+
asset_name: HwCodecDetect-GUI-macOS-Intel
86+
job_type: native
87+
branch_mode: ui
88+
89+
- os: macos-latest
90+
python_arch: 'arm64'
91+
asset_name: HwCodecDetect-GUI-macOS-ARM64
92+
job_type: native
93+
branch_mode: ui
94+
95+
- os: ubuntu-22.04
96+
python_arch: 'x64'
97+
asset_name: HwCodecDetect-GUI-Linux-x64
98+
job_type: native
99+
branch_mode: ui
100+
101+
- os: ubuntu-22.04
102+
job_type: emulated
103+
qemu_arch: aarch64
104+
docker_img: python:3.10-bullseye
105+
asset_name: HwCodecDetect-GUI-Linux-arm64
106+
branch_mode: ui
107+
108+
- os: ubuntu-22.04
109+
job_type: emulated
110+
qemu_arch: i386
111+
docker_img: i386/python:3.10-slim-bullseye
112+
asset_name: HwCodecDetect-GUI-Linux-x86
113+
branch_mode: ui
73114

74115
steps:
75116
- uses: actions/checkout@v4
117+
with:
118+
ref: ${{ matrix.branch_mode }}
119+
120+
- name: Set App Name
121+
shell: bash
122+
run: |
123+
if [ "${{ matrix.branch_mode }}" == "ui" ]; then
124+
echo "APP_NAME_INTERNAL=${{ env.BASE_APP_NAME }}-GUI" >> $GITHUB_ENV
125+
else
126+
echo "APP_NAME_INTERNAL=${{ env.BASE_APP_NAME }}" >> $GITHUB_ENV
127+
fi
76128
77129
- name: Create Entry Point Script
78130
shell: bash
@@ -106,7 +158,7 @@ jobs:
106158
107159
if [ "$RUNNER_OS" == "Windows" ]; then SEP=";"; else SEP=":"; fi
108160
109-
pyinstaller --clean --onefile --name ${{ env.APP_NAME }} \
161+
pyinstaller --clean --onefile --name ${{ env.APP_NAME_INTERNAL }} \
110162
--add-data "VERSION${SEP}." \
111163
--paths ".$SEP" \
112164
--distpath dist \
@@ -126,53 +178,35 @@ jobs:
126178

127179
run: |
128180
cd /work
129-
130-
apt-get update && apt-get install -y --no-install-recommends \
131-
build-essential gcc zlib1g-dev git
132-
181+
apt-get update && apt-get install -y --no-install-recommends build-essential gcc zlib1g-dev git
133182
python3 -m pip install --upgrade pip
134183
pip install build wheel setuptools pyinstaller
135184
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
136185
pip install .
137186
138-
pyinstaller --clean --onefile --name ${{ env.APP_NAME }} \
187+
pyinstaller --clean --onefile --name ${{ env.APP_NAME_INTERNAL }} \
139188
--add-data "VERSION:." \
140189
--paths . \
141190
--distpath dist \
142191
--workpath build \
143192
"${{ env.ENTRY_POINT_SCRIPT }}"
144-
145193
chmod -R 777 dist/
146194
147195
- name: Rename Artifacts (Standardize)
148196
shell: bash
149197
run: |
150198
cd dist || exit 1
151-
152-
if [ -f "${{ env.APP_NAME }}.exe" ]; then
153-
mv "${{ env.APP_NAME }}.exe" "${{ matrix.artifact_name }}"
154-
elif [ -f "${{ env.APP_NAME }}" ]; then
155-
mv "${{ env.APP_NAME }}" "${{ matrix.artifact_name }}"
156-
else
157-
echo "Error: Could not find build artifact!"
158-
ls -la
159-
exit 1
199+
if [ -f "${{ env.APP_NAME_INTERNAL }}.exe" ]; then
200+
mv "${{ env.APP_NAME_INTERNAL }}.exe" "${{ matrix.asset_name }}"
201+
elif [ -f "${{ env.APP_NAME_INTERNAL }}" ]; then
202+
mv "${{ env.APP_NAME_INTERNAL }}" "${{ matrix.asset_name }}"
160203
fi
161204
162-
- name: Test Binary (Smoke Test)
163-
shell: bash
164-
if: matrix.job_type == 'native'
165-
run: |
166-
echo "Testing binary execution..."
167-
chmod +x ./dist/${{ matrix.artifact_name }}
168-
./dist/${{ matrix.artifact_name }} --help || echo "Binary ran with exit code $?"
169-
./dist/${{ matrix.artifact_name }} --version || echo "Binary ran with exit code $?"
170-
171205
- name: Upload Artifacts
172206
uses: actions/upload-artifact@v4
173207
with:
174208
name: ${{ matrix.asset_name }}
175-
path: dist/${{ matrix.artifact_name }}
209+
path: dist/${{ matrix.asset_name }}
176210
if-no-files-found: error
177211

178212
create-release:
@@ -186,33 +220,18 @@ jobs:
186220
path: artifacts
187221
merge-multiple: true
188222

189-
- name: Display structure
190-
run: ls -R artifacts
191-
192-
- name: Get Meta Data
193-
id: vars
194-
run: |
195-
echo "date=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
196-
echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
197-
198223
- name: Create Release (Draft)
199224
uses: softprops/action-gh-release@v2
200225
with:
201226
tag_name: ${{ github.ref_name }}
202227
name: "${{ github.ref_name }}"
203228
body: |
204-
Automated multi-platform build.
205-
Commit: ${{ github.sha }}
206-
207-
### Supported Platforms:
208-
- **Windows**: x64, x86 (32-bit)
209-
- **macOS**: Apple Silicon (ARM64), Intel
210-
- **Linux**: x64, ARM64, x86
211-
212-
*Note: Windows ARM users should use the Windows x86 or x64 binary.*
229+
Automated multi-platform build for CLI and GUI.
230+
- **CLI Version**: main branch
231+
- **GUI Version**: ui branch
213232
draft: true
214233
prerelease: true
215234
files: |
216235
artifacts/*
217236
env:
218-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
237+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)