Mulberry/.github/workflows/build.yml
BeamStarTech ad87037ee3
Mulberry 1.2.2: crossfade; Android app download
- Crossfade (Settings › Playback, 1–12 s) with equal-power fades on both the mpv and Qt engines;
  replaces gapless while on, ends instantly on skip/seek/pause/stop
- Release now also ships Mulberry-Android.apk (Android 1.2.1)
- README: Android download and section

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
2026-10-10 07:48:04 -05:00

186 lines
9.6 KiB
YAML

name: Build
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller
- name: Version
shell: bash
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
- name: Icons
run: python packaging/make_icons.py
- name: Fetch libmpv (gapless, EQ, CD playback & ripping)
continue-on-error: true
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$rel = Invoke-RestMethod "https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest" -Headers @{ Authorization = "Bearer $env:GH_TOKEN" }
$asset = $rel.assets | Where-Object { $_.name -match '^mpv-dev-x86_64-\d{8}-git-[0-9a-f]+\.7z$' } | Select-Object -First 1
if (-not $asset) { throw "libmpv asset not found" }
Invoke-WebRequest $asset.browser_download_url -OutFile mpv-dev.7z
7z x mpv-dev.7z -ompv-dev -y | Out-Null
New-Item -ItemType Directory -Force packaging/windows/mpv | Out-Null
Copy-Item mpv-dev/libmpv-2.dll packaging/windows/mpv/
Get-ChildItem packaging/windows/mpv
- name: PyInstaller
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
- name: Self-test (launch the built app, screenshot, quit)
shell: pwsh
run: |
python packaging/make_test_audio.py selftest.wav
$env:MULBERRY_SELFTEST = "$PWD\selftest-windows"
$env:MULBERRY_SELFTEST_PLAY = "$PWD\selftest.wav"
$p = Start-Process build/dist/Mulberry/Mulberry.exe -PassThru
if (-not $p.WaitForExit(90000)) { Stop-Process $p.Id; throw "Mulberry did not finish the self-test" }
if (-not (Test-Path selftest-windows.png)) { Write-Output "::error title=Windows self-test::no screenshot"; throw "no screenshot - the app failed to start" }
$r = @{}; Get-Content selftest-windows.txt | ForEach-Object { $k, $v = $_ -split '=', 2; $r[$k] = $v }
Get-Content selftest-windows.txt
if ([double]$r['visualizer_decoded_s'] -lt 5) { Write-Output "::error title=Windows self-test::audio decoding failed ($($r['visualizer_decoded_s']) s)"; exit 1 }
if ([double]$r['visualizer_peak'] -lt 0.05) { Write-Output "::error title=Windows self-test::visualizer silent"; exit 1 }
if ($r['mpv_available'] -ne 'True') { Write-Output "::error title=Windows self-test::bundled libmpv did not load (CD playback would fail)"; exit 1 }
if ($r['ytdlp'] -ne 'True') { Write-Output "::error title=Windows self-test::yt-dlp missing from the build"; exit 1 }
if ([int]$r['ssl_ca'] -lt 1) { Write-Output "::error title=Windows self-test::no TLS certificates"; exit 1 }
if ([double]$r['position'] -lt 1) { Write-Output "::warning title=Windows self-test::playback position did not advance (runner has no audio device?) state=$($r['state'])" }
- uses: actions/upload-artifact@v4
with:
name: selftest-windows
path: selftest-windows.*
- name: Portable zip
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
Compress-Archive -Path build/dist/Mulberry -DestinationPath "dist/Mulberry-Windows-Portable.zip"
- name: Installer (Inno Setup)
shell: pwsh
run: |
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) { choco install innosetup -y --no-progress; $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" }
& $iscc "/DAppVersion=$env:VERSION" packaging\windows\mulberry.iss
- uses: actions/upload-artifact@v4
with:
name: windows
path: dist/*
linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: System packages
run: sudo apt-get update && sudo apt-get install -y libegl1 libxkbcommon0 libxcb-cursor0 libpulse0 desktop-file-utils file
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller
- name: Version
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
- name: Icons
run: python packaging/make_icons.py
- name: PyInstaller
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
- name: Self-test (launch the built app, screenshot, quit)
run: |
set +e
python packaging/make_test_audio.py selftest.wav
QT_QPA_PLATFORM=offscreen MULBERRY_SELFTEST=$PWD/selftest-linux MULBERRY_SELFTEST_PLAY=$PWD/selftest.wav \
timeout 90 dbus-run-session -- build/dist/Mulberry/mulberry > selftest-linux.log 2>&1
rc=$?
if [ ! -f selftest-linux.png ]; then
echo "::error title=Linux self-test failed (rc=$rc)::$(tail -c 3000 selftest-linux.log | tr '\n' '|')"
exit 1
fi
cat selftest-linux.txt
get() { grep "^$1=" selftest-linux.txt | cut -d= -f2; }
awk "BEGIN{exit !($(get visualizer_decoded_s) >= 5)}" || { echo "::error title=Linux self-test::audio decoding failed::$(grep -i 'multimedia\|ffmpeg\|Failed' selftest-linux.log | head -5 | tr '\n' '|')"; exit 1; }
awk "BEGIN{exit !($(get visualizer_peak) >= 0.05)}" || { echo "::error title=Linux self-test::visualizer silent"; exit 1; }
[ "$(get ytdlp)" = "True" ] || { echo "::error title=Linux self-test::yt-dlp missing from the build"; exit 1; }
[ "$(get ssl_ca)" -ge 1 ] || { echo "::error title=Linux self-test::no TLS certificates"; exit 1; }
awk "BEGIN{exit !($(get position) >= 1)}" || echo "::warning title=Linux self-test::playback position did not advance (state=$(get state))"
- uses: actions/upload-artifact@v4
with:
name: selftest-linux
path: selftest-linux.*
- name: Tarball
run: |
mkdir -p dist
cp mulberry.desktop mulberry/assets/mulberry.svg build/dist/Mulberry/
tar -C build/dist -czf "dist/Mulberry-Linux-x86_64.tar.gz" Mulberry
- name: AppImage
run: |
APPDIR=build/AppDir
mkdir -p $APPDIR/usr/lib $APPDIR/usr/share/icons/hicolor/256x256/apps $APPDIR/usr/share/applications
cp -r build/dist/Mulberry $APPDIR/usr/lib/mulberry
cp packaging/linux/AppRun $APPDIR/AppRun && chmod +x $APPDIR/AppRun
grep -v '^Actions=\|^\[Desktop Action\|^Name=Play\|^Name=Next\|^Name=Previous\|^Exec=dbus' mulberry.desktop > $APPDIR/mulberry.desktop
cp $APPDIR/mulberry.desktop $APPDIR/usr/share/applications/
cp packaging/build-icons/mulberry-256.png $APPDIR/mulberry.png
cp packaging/build-icons/mulberry-256.png $APPDIR/usr/share/icons/hicolor/256x256/apps/mulberry.png
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
chmod +x appimagetool
ARCH=x86_64 ./appimagetool --appimage-extract-and-run $APPDIR "dist/Mulberry-x86_64.AppImage"
- uses: actions/upload-artifact@v4
with:
name: linux
path: dist/*
release:
# Publishes on every push to main (tag v<VERSION> is created by the action),
# or when a v* tag is pushed. Same-named assets are replaced on re-runs.
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
needs: [windows, linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Version
run: echo "VERSION=$(python3 -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: artifacts
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}
target_commitish: ${{ github.sha }}
name: Mulberry ${{ env.VERSION }}
make_latest: true
overwrite_files: true
files: |
artifacts/windows/*
artifacts/linux/*
android/Mulberry-Android.apk
body: |
## Downloads
| Platform | File |
|---|---|
| Windows 10/11 installer | **Mulberry-Windows-Setup.exe** |
| Windows portable | **Mulberry-Windows-Portable.zip** (unzip, run `Mulberry.exe`) |
| Linux, any distro | **Mulberry-x86_64.AppImage** (`chmod +x`, then run) |
| Linux tarball | **Mulberry-Linux-x86_64.tar.gz** (run `Mulberry/mulberry`) |
| Android 7.0+ | **Mulberry-Android.apk** (open it on the phone; allow installing unknown apps) |
On Linux, install `mpv` for gapless playback, the EQ and CD support. The Windows build includes it.
Windows SmartScreen may warn because the installer is unsigned: choose *More info → Run anyway*.
See the [README](https://github.com/${{ github.repository }}#readme) for features and setup.
*Coded by Claude (Anthropic) with @BeamStarTech.*