Skip to content

Commit bf6e747

Browse files
authored
ci: add cross-platform GitHub Actions builds (Win/macOS/Linux) + tests & release on tags
- Adds .github/workflows/build.yml - Runs pytest on ubuntu-latest, windows-latest, macos-13 (x64) and macos-14 (arm64) - Builds unsigned binaries with PyInstaller from yt_audio_workbench.spec - Uploads zips as artifacts per OS - On tags v*, creates a GitHub Release and attaches artifacts - Installs python3-tk on Ubuntu runners for Tkinter
1 parent 33b0bd9 commit bf6e747

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

.github/workflows/build.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Build (Windows/macOS/Linux)
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths:
7+
- '**/*.py'
8+
- 'lang/**'
9+
- 'HELP.md'
10+
- 'yt_audio_workbench.spec'
11+
- '.github/workflows/build.yml'
12+
pull_request:
13+
branches: [ main, master ]
14+
workflow_dispatch:
15+
tags:
16+
- 'v*'
17+
18+
jobs:
19+
test:
20+
name: Tests (${{ matrix.os }} | py${{ matrix.python }})
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
26+
python: ['3.11']
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python }}
32+
- name: Install OS dependencies (Linux only)
33+
if: startsWith(matrix.os, 'ubuntu')
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y python3-tk
37+
- name: Install Python deps
38+
run: |
39+
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
40+
python -m pip install --upgrade pip
41+
python -m pip install pytest
42+
- name: Run tests
43+
run: pytest -q
44+
45+
build:
46+
name: Build (${{ matrix.os }})
47+
needs: test
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: '3.11'
58+
- name: Install OS dependencies (Linux only)
59+
if: startsWith(matrix.os, 'ubuntu')
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install -y python3-tk
63+
- name: Install Python deps
64+
run: |
65+
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
66+
python -m pip install --upgrade pip
67+
python -m pip install pyinstaller
68+
- name: Build with PyInstaller
69+
run: |
70+
pyinstaller -y yt_audio_workbench.spec
71+
- name: Pack artifact (Windows)
72+
if: startsWith(matrix.os, 'windows')
73+
shell: pwsh
74+
run: |
75+
$ErrorActionPreference = 'Stop'
76+
$zip = "YT-Audio-Workbench-Windows.zip"
77+
Compress-Archive -Path "dist\YT-Audio-Workbench\*" -DestinationPath $zip
78+
echo "ZIP_NAME=$zip" >> $env:GITHUB_ENV
79+
- name: Pack artifact (macOS/Linux)
80+
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
81+
run: |
82+
cd dist
83+
zip -r ../YT-Audio-Workbench-${{ runner.os }}.zip YT-Audio-Workbench
84+
echo "ZIP_NAME=YT-Audio-Workbench-${{ runner.os }}.zip" >> $GITHUB_ENV
85+
- name: Upload artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: YT-Audio-Workbench-${{ matrix.os }}
89+
path: ${{ env.ZIP_NAME }}
90+
91+
release:
92+
name: Release on tag
93+
if: startsWith(github.ref, 'refs/tags/v')
94+
needs: build
95+
runs-on: ubuntu-latest
96+
steps:
97+
- uses: actions/download-artifact@v4
98+
with:
99+
path: artifacts
100+
- name: List artifacts
101+
run: ls -R artifacts
102+
- name: Create GitHub Release
103+
uses: softprops/action-gh-release@v2
104+
with:
105+
draft: false
106+
prerelease: false
107+
files: |
108+
artifacts/**/YT-Audio-Workbench-*.zip
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)