Skip to content

Commit ff49edf

Browse files
committed
Mers/menon/git/ffmpeg-gui-pyqt6' && git push origin master
rge branch 'fix/download-button-and-nonblocking'
2 parents 48b4a14 + f63ae76 commit ff49edf

22 files changed

Lines changed: 739 additions & 133 deletions

.DS_Store

6 KB
Binary file not shown.

.envrc.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# direnv example for ffmpeg-gui-pyqt6
2+
3+
# Use pyenv local version if present
4+
use python
5+
6+
# Create venv if missing and activate
7+
layout python
8+
9+
# Optional: set Qt environment tweaks
10+
# export QT_LOGGING_RULES="*.debug=false;qt.qpa.*=false"

.githooks/pre-commit

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
MAX=$((102760448)) # 98MB in bytes
5+
6+
echo "[pre-commit] Checking file sizes (max 98MB)..."
7+
# Check staged files
8+
while IFS= read -r -d '' f; do
9+
if [ -f "$f" ]; then
10+
sz=$(wc -c <"$f" | tr -d ' ')
11+
if [ "$sz" -ge "$MAX" ]; then
12+
echo "Error: staged file exceeds 98MB: $f ($sz bytes)" >&2
13+
exit 1
14+
fi
15+
fi
16+
done < <(git diff --cached --name-only -z)
17+
18+
# Check tracked files as extra safety
19+
while IFS= read -r -d '' f; do
20+
if [ -f "$f" ]; then
21+
sz=$(wc -c <"$f" | tr -d ' ')
22+
if [ "$sz" -ge "$MAX" ]; then
23+
echo "Error: tracked file exceeds 98MB: $f ($sz bytes)" >&2
24+
exit 1
25+
fi
26+
fi
27+
done < <(git ls-files -z)
28+
29+
echo "[pre-commit] Running pytest (if available)..."
30+
if command -v pytest >/dev/null 2>&1; then
31+
QT_QPA_PLATFORM=offscreen pytest -q
32+
elif [ -x ".venv/bin/pytest" ]; then
33+
QT_QPA_PLATFORM=offscreen .venv/bin/pytest -q
34+
else
35+
echo "pytest not found, skipping tests. Install with: python -m pip install -r requirements.txt" >&2
36+
fi
37+
38+
echo "[pre-commit] OK"

.github/workflows/build.yml

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
name: build-binaries
22

33
on:
4-
pull_request:
5-
branches: [ master ]
6-
paths:
7-
- '**/*.py'
8-
- '.github/workflows/**'
9-
- 'requirements.txt'
10-
push:
11-
branches:
12-
- master
13-
- ci-build-and-no-audio-asf
14-
paths:
15-
- '**/*.py'
16-
- '.github/workflows/**'
17-
- 'requirements.txt'
18-
workflow_dispatch: {}
4+
# Manual only; requires explicit cost confirmation
5+
workflow_dispatch:
6+
inputs:
7+
confirm_cost:
8+
description: "Type YES to confirm you understand this build consumes CI minutes and may incur costs."
9+
required: true
10+
default: "NO"
11+
profile:
12+
description: "Build profile (minimal = low-cost emergency, full = all OS/arch)"
13+
required: true
14+
type: choice
15+
options:
16+
- minimal
17+
- full
18+
default: minimal
1919

2020
jobs:
2121
build:
22+
# Hard gate: only proceed if user confirmed cost
23+
if: ${{ github.event.inputs.confirm_cost == 'YES' }}
2224
name: Build PyInstaller binaries
2325
runs-on: ${{ matrix.os }}
2426
strategy:
2527
fail-fast: false
2628
matrix:
27-
os: [windows-latest, windows-11-arm, macos-13, macos-14, ubuntu-latest, ubuntu-22.04-arm]
29+
os: ${{ fromJSON(github.event.inputs.profile == 'full' && '["windows-latest","windows-11-arm","macos-13","macos-14","ubuntu-latest","ubuntu-22.04-arm"]' || '["ubuntu-latest"]') }}
2830
python-version: ['3.11']
31+
env:
32+
PROFILE: ${{ github.event.inputs.profile }}
33+
BUILD_PYQT: ${{ github.event.inputs.profile == 'full' && 'true' || 'false' }}
2934
steps:
3035
- name: Checkout
3136
uses: actions/checkout@v4
@@ -35,8 +40,8 @@ jobs:
3540
with:
3641
python-version: ${{ matrix.python-version }}
3742

38-
- name: Install Qt dev tools (Linux only)
39-
if: runner.os == 'Linux'
43+
- name: Install Qt dev tools (Linux only, full profile)
44+
if: runner.os == 'Linux' && env.BUILD_PYQT == 'true'
4045
shell: bash
4146
run: |
4247
set -euo pipefail
@@ -53,8 +58,8 @@ jobs:
5358
sudo apt-get install -y --no-install-recommends libgl1 libglib2.0-0 || true
5459
fi
5560
56-
- name: Check qmake (Linux only)
57-
if: runner.os == 'Linux'
61+
- name: Check qmake (Linux only, full profile)
62+
if: runner.os == 'Linux' && env.BUILD_PYQT == 'true'
5863
shell: bash
5964
run: |
6065
set -euo pipefail
@@ -70,9 +75,14 @@ jobs:
7075
shell: bash
7176
run: |
7277
python -m pip install --upgrade pip
73-
if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install PyQt6; fi
74-
# Ensure common runtime deps are available for PyInstaller analysis
75-
pip install pyinstaller requests ffmpeg-python
78+
# Minimal deps for Tkinter build by default; full profile includes PyQt6
79+
if [ "$PROFILE" = "full" ]; then
80+
if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install PyQt6; fi
81+
else
82+
# Ensure no heavy GUI deps in minimal profile
83+
pip install ffmpeg-python requests || true
84+
fi
85+
pip install pyinstaller
7686
7787
- name: Install Linux extras (patchelf)
7888
if: runner.os == 'Linux'
@@ -82,34 +92,35 @@ jobs:
8292
sudo apt-get update && sudo apt-get install -y patchelf
8393
fi
8494
85-
- name: Build PyQt6 app
95+
- name: Build PyQt6 app (full profile only)
96+
if: env.BUILD_PYQT == 'true'
8697
shell: bash
8798
run: |
8899
pyinstaller --name ffmpeg-gui-pyqt6 --noconfirm --onefile --windowed GUI_pyqt6_WINFF.py
89100
90-
- name: Build Tkinter app
101+
- name: Build Tkinter app (always)
91102
shell: bash
92103
run: |
93104
pyinstaller --name ffmpeg-gui-tkinter --noconfirm --onefile --windowed GUI_tkinter_WINFF.py
94105
95-
- name: Collect artifacts
106+
- name: Collect artifacts (robust)
96107
shell: bash
97108
run: |
98109
mkdir -p artifacts
99110
arch_lc=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]')
100111
if [[ "$RUNNER_OS" == "Windows" ]]; then
101-
cp dist/ffmpeg-gui-pyqt6.exe "artifacts/ffmpeg-gui-pyqt6-win-${arch_lc}.exe"
102-
cp dist/ffmpeg-gui-tkinter.exe "artifacts/ffmpeg-gui-tkinter-win-${arch_lc}.exe"
112+
[ -f dist/ffmpeg-gui-pyqt6.exe ] && cp dist/ffmpeg-gui-pyqt6.exe "artifacts/ffmpeg-gui-pyqt6-win-${arch_lc}.exe" || true
113+
[ -f dist/ffmpeg-gui-tkinter.exe ] && cp dist/ffmpeg-gui-tkinter.exe "artifacts/ffmpeg-gui-tkinter-win-${arch_lc}.exe" || true
103114
elif [[ "$RUNNER_OS" == "macOS" ]]; then
104115
# Package .app bundles as zips, suffix with architecture
105116
cd dist
106-
zip -r "../artifacts/ffmpeg-gui-pyqt6-macos-${arch_lc}.app.zip" "ffmpeg-gui-pyqt6.app"
107-
zip -r "../artifacts/ffmpeg-gui-tkinter-macos-${arch_lc}.app.zip" "ffmpeg-gui-tkinter.app"
117+
[ -d "ffmpeg-gui-pyqt6.app" ] && zip -r "../artifacts/ffmpeg-gui-pyqt6-macos-${arch_lc}.app.zip" "ffmpeg-gui-pyqt6.app" || true
118+
[ -d "ffmpeg-gui-tkinter.app" ] && zip -r "../artifacts/ffmpeg-gui-tkinter-macos-${arch_lc}.app.zip" "ffmpeg-gui-tkinter.app" || true
108119
cd -
109120
else
110121
# Linux artifacts (ELF executables), suffix with architecture
111-
cp dist/ffmpeg-gui-pyqt6 "artifacts/ffmpeg-gui-pyqt6-linux-${arch_lc}"
112-
cp dist/ffmpeg-gui-tkinter "artifacts/ffmpeg-gui-tkinter-linux-${arch_lc}"
122+
[ -f dist/ffmpeg-gui-pyqt6 ] && cp dist/ffmpeg-gui-pyqt6 "artifacts/ffmpeg-gui-pyqt6-linux-${arch_lc}" || true
123+
[ -f dist/ffmpeg-gui-tkinter ] && cp dist/ffmpeg-gui-tkinter "artifacts/ffmpeg-gui-tkinter-linux-${arch_lc}" || true
113124
fi
114125
115126
- name: Upload artifacts

.github/workflows/build_and_release_template.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,8 @@ name: build-and-release-template
77
# 4) Push to default branch to build; create a tag vX.Y.Z to publish a Release with assets.
88

99
on:
10-
push:
11-
branches: [ master, main ]
12-
paths:
13-
- '**/*.py'
14-
- '.github/workflows/**'
15-
- 'requirements.txt'
16-
pull_request:
17-
branches: [ master, main ]
18-
paths:
19-
- '**/*.py'
20-
- '.github/workflows/**'
21-
- 'requirements.txt'
10+
# Template disabled by default to avoid unintentional runs/costs.
11+
# To use it, copy to a new workflow file and enable triggers explicitly.
2212
workflow_dispatch: {}
2313

2414
env:

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, fix/**, feature/** ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.11'
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
python -m pip install pytest
21+
- name: Enforce max file size
22+
run: |
23+
# Fail if any repo file exceeds 98MB (102,760,448 bytes)
24+
max=102760448
25+
while IFS= read -r -d '' f; do
26+
sz=$(stat -c%s "$f")
27+
if [ "$sz" -ge "$max" ]; then
28+
echo "File too large: $f ($sz bytes)"
29+
exit 1
30+
fi
31+
done < <(git ls-files -z)
32+
- name: Run tests
33+
env:
34+
QT_QPA_PLATFORM: offscreen
35+
PYTHONPATH: ${{ github.workspace }}
36+
run: |
37+
pytest -q

.github/workflows/release.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
name: release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
# Manual only; require explicit cost confirmation
5+
workflow_dispatch:
6+
inputs:
7+
confirm_cost:
8+
description: "Type YES to confirm you understand this release build consumes CI minutes and may incur costs."
9+
required: true
10+
default: "NO"
11+
profile:
12+
description: "Build profile (minimal = low-cost emergency, full = all OS/arch)"
13+
required: true
14+
type: choice
15+
options:
16+
- minimal
17+
- full
18+
default: minimal
719

820
permissions:
921
contents: write
1022

1123
jobs:
1224
build:
25+
if: ${{ github.event.inputs.confirm_cost == 'YES' }}
1326
name: Build release artifacts
1427
runs-on: ${{ matrix.os }}
1528
strategy:
1629
fail-fast: false
1730
matrix:
18-
os: [windows-latest, windows-11-arm, macos-13, macos-14, ubuntu-latest, ubuntu-22.04-arm]
31+
os: ${{ fromJSON(github.event.inputs.profile == 'full' && '["windows-latest","windows-11-arm","macos-13","macos-14","ubuntu-latest","ubuntu-22.04-arm"]' || '["ubuntu-latest"]') }}
1932
python-version: ['3.11']
33+
env:
34+
PROFILE: ${{ github.event.inputs.profile }}
35+
BUILD_PYQT: ${{ github.event.inputs.profile == 'full' && 'true' || 'false' }}
2036
steps:
2137
- name: Checkout
2238
uses: actions/checkout@v4
@@ -26,8 +42,8 @@ jobs:
2642
with:
2743
python-version: ${{ matrix.python-version }}
2844

29-
- name: Install Qt dev tools (Linux only)
30-
if: runner.os == 'Linux'
45+
- name: Install Qt dev tools (Linux only, full profile)
46+
if: runner.os == 'Linux' && env.BUILD_PYQT == 'true'
3147
shell: bash
3248
run: |
3349
set -euo pipefail
@@ -41,8 +57,8 @@ jobs:
4157
sudo apt-get install -y --no-install-recommends libgl1 libglib2.0-0 || true
4258
fi
4359
44-
- name: Check qmake (Linux only)
45-
if: runner.os == 'Linux'
60+
- name: Check qmake (Linux only, full profile)
61+
if: runner.os == 'Linux' && env.BUILD_PYQT == 'true'
4662
shell: bash
4763
run: |
4864
set -euo pipefail
@@ -57,8 +73,12 @@ jobs:
5773
shell: bash
5874
run: |
5975
python -m pip install --upgrade pip
60-
if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install PyQt6; fi
61-
pip install pyinstaller requests ffmpeg-python
76+
if [ "$PROFILE" = "full" ]; then
77+
if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install PyQt6; fi
78+
else
79+
pip install ffmpeg-python requests || true
80+
fi
81+
pip install pyinstaller
6282
6383
- name: Install Linux extras (patchelf)
6484
if: runner.os == 'Linux'
@@ -68,12 +88,13 @@ jobs:
6888
sudo apt-get update && sudo apt-get install -y patchelf
6989
fi
7090
71-
- name: Build PyQt6 app
91+
- name: Build PyQt6 app (full profile only)
92+
if: env.BUILD_PYQT == 'true'
7293
shell: bash
7394
run: |
7495
pyinstaller --name ffmpeg-gui-pyqt6 --noconfirm --onefile --windowed GUI_pyqt6_WINFF.py
7596
76-
- name: Build Tkinter app
97+
- name: Build Tkinter app (always)
7798
shell: bash
7899
run: |
79100
pyinstaller --name ffmpeg-gui-tkinter --noconfirm --onefile --windowed GUI_tkinter_WINFF.py

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.9

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"Codegeex.Chat.fontSize": 12,
3+
"Codegeex.CommitMessageStyle": "ConventionalCommits"
4+
}

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "setup venv",
6+
"type": "shell",
7+
"command": "python3 -m venv .venv && . .venv/bin/activate && python -m pip install --upgrade pip",
8+
"problemMatcher": []
9+
},
10+
{
11+
"label": "install deps",
12+
"type": "shell",
13+
"command": ". .venv/bin/activate && python -m pip install -r requirements.txt",
14+
"problemMatcher": []
15+
},
16+
{
17+
"label": "pytest",
18+
"type": "shell",
19+
"command": "QT_QPA_PLATFORM=offscreen . .venv/bin/activate && pytest -q",
20+
"problemMatcher": []
21+
},
22+
{
23+
"label": "run PyQt6 GUI",
24+
"type": "shell",
25+
"command": ". .venv/bin/activate && python GUI_pyqt6_WINFF.py",
26+
"problemMatcher": []
27+
},
28+
{
29+
"label": "run Tkinter GUI",
30+
"type": "shell",
31+
"command": ". .venv/bin/activate && python GUI_tkinter_WINFF.py",
32+
"problemMatcher": []
33+
},
34+
{
35+
"label": "install hooks",
36+
"type": "shell",
37+
"command": "git config core.hooksPath .githooks && chmod +x .githooks/pre-commit",
38+
"problemMatcher": []
39+
}
40+
]
41+
}

0 commit comments

Comments
 (0)