@@ -3,8 +3,7 @@ name: Build (Windows/macOS/Linux)
3
3
on :
4
4
push :
5
5
branches : [ main, master ]
6
- tags :
7
- - ' v*'
6
+ tags : [ 'v*' ]
8
7
paths :
9
8
- ' **/*.py'
10
9
- ' lang/**'
@@ -29,18 +28,22 @@ jobs:
29
28
- uses : actions/setup-python@v5
30
29
with :
31
30
python-version : ${{ matrix.python }}
31
+
32
32
- name : Install OS dependencies (Linux only)
33
33
if : startsWith(matrix.os, 'ubuntu')
34
34
run : |
35
35
sudo apt-get update
36
36
sudo apt-get install -y python3-tk
37
- - name : Install Python dependencies
37
+
38
+ - name : Install Python deps for tests
38
39
run : |
39
40
python -m pip install --upgrade pip
40
41
python -m pip install pytest
42
+
41
43
- name : Install project requirements (if requirements.txt exists)
42
44
if : hashFiles('requirements.txt') != ''
43
45
run : python -m pip install -r requirements.txt
46
+
44
47
- name : Run tests
45
48
env :
46
49
PYTHONPATH : ${{ github.workspace }}
@@ -59,32 +62,43 @@ jobs:
59
62
- uses : actions/setup-python@v5
60
63
with :
61
64
python-version : ' 3.11'
65
+
62
66
- name : Install OS dependencies (Linux only)
63
67
if : startsWith(matrix.os, 'ubuntu')
64
68
run : |
65
69
sudo apt-get update
66
- sudo apt-get install -y python3-tk
67
- - name : Install Python dependencies
70
+ sudo apt-get install -y python3-tk zip
71
+
72
+ - name : Install Python deps for build
68
73
run : |
69
74
python -m pip install --upgrade pip
70
75
python -m pip install pyinstaller
76
+
71
77
- name : Install project requirements (if requirements.txt exists)
72
78
if : hashFiles('requirements.txt') != ''
73
79
run : python -m pip install -r requirements.txt
80
+
74
81
- name : Build with PyInstaller
75
82
run : pyinstaller -y yt_audio_workbench.spec
83
+
84
+ - name : Show dist tree (debug)
85
+ shell : bash
86
+ run : |
87
+ echo "== dist/ contents =="
88
+ ls -la dist || true
89
+ echo "== one level deeper =="
90
+ find dist -maxdepth 2 -mindepth 1 -print || true
91
+
92
+ # ---------- Windows pack ----------
76
93
- name : Pack artifact (Windows)
77
- if : runner.os == 'Windows' # Or: if: startsWith(matrix.os, 'windows')
94
+ if : runner.os == 'Windows'
78
95
shell : pwsh
79
96
run : |
80
97
$ErrorActionPreference = 'Stop'
81
-
82
98
$dist = Join-Path $PWD 'dist'
83
- if (-not (Test-Path $dist)) {
84
- throw "dist/ not found. Did the build step run?"
85
- }
99
+ if (-not (Test-Path $dist)) { throw "dist/ not found. Did the build step run?" }
86
100
87
- # Prefer a product directory ( onedir). Fallback to files ( onefile).
101
+ # Prefer onedir folder; fallback to onefile(s)
88
102
$productDir = Get-ChildItem -Path $dist -Directory | Select-Object -First 1
89
103
if ($productDir) {
90
104
$zip = "$($productDir.Name)-Windows.zip"
@@ -103,22 +117,40 @@ jobs:
103
117
$zipPath = Join-Path $dist $zip
104
118
}
105
119
106
- # Expose name/path for the upload step
107
- "ZIP_NAME=$(Split-Path -Leaf $zipPath)" | Out-File -FilePath $env:GITHUB_ENV -Append
108
120
"ZIP_PATH=$zipPath" | Out-File -FilePath $env:GITHUB_ENV -Append
109
121
122
+ # ---------- macOS / Linux pack ----------
110
123
- name : Pack artifact (macOS/Linux)
111
- if : startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
124
+ if : runner.os != 'Windows'
125
+ shell : bash
112
126
run : |
113
- ZIP_FILENAME="YT-Audio-Workbench-${{ matrix.os }}.zip"
114
- cd dist
115
- zip -r ../"$ZIP_FILENAME" YT-Audio-Workbench
116
- echo "ZIP_PATH=$ZIP_FILENAME" >> $GITHUB_ENV
127
+ set -euo pipefail
128
+ dist="dist"
129
+ [[ -d "$dist" ]] || { echo "dist/ not found"; exit 1; }
130
+
131
+ # Prefer an app folder (onedir). If none, zip all files (onefile case).
132
+ first_dir="$(find "$dist" -mindepth 1 -maxdepth 1 -type d | head -n1 || true)"
133
+ if [[ -n "${first_dir:-}" ]]; then
134
+ base="$(basename "$first_dir")"
135
+ zip_path="$dist/${base}-${{ runner.os }}.zip"
136
+ (cd "$first_dir" && zip -r "../$(basename "$zip_path")" .)
137
+ else
138
+ if ! find "$dist" -mindepth 1 -maxdepth 1 -type f | grep -q .; then
139
+ echo "Nothing to pack in dist/"; exit 1
140
+ fi
141
+ zip_path="$dist/YT-Audio-Workbench-${{ runner.os }}.zip"
142
+ (cd "$dist" && zip -r "$(basename "$zip_path")" .)
143
+ fi
144
+ echo "ZIP_PATH=$zip_path" >> "$GITHUB_ENV"
145
+
117
146
- name : Upload artifact
118
147
uses : actions/upload-artifact@v4
119
148
with :
120
- name : YT-Audio-Workbench-${{ matrix.os }}
149
+ # unique name prevents 409 conflicts between matrix jobs
150
+ name : YT-Audio-Workbench-${{ runner.os }}-${{ github.run_number }}
121
151
path : ${{ env.ZIP_PATH }}
152
+ if-no-files-found : error
153
+ retention-days : 7
122
154
123
155
release :
124
156
name : Release on tag
0 commit comments