CI: launch self-tests on Windows and Linux; publish release from main

Tags can't be pushed from the authoring environment, so the release job
creates tag v<VERSION> itself on pushes to main (and still honours v* tags).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
This commit is contained in:
Claude 2026-10-09 23:13:54 -05:00
commit 393fb22621
No known key found for this signature in database
2 changed files with 61 additions and 6 deletions

View file

@ -43,6 +43,18 @@ jobs:
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: |
$env:MULBERRY_SELFTEST = "$PWD\selftest-windows"
$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)) { throw "no screenshot - the app failed to start" }
Get-Content selftest-windows.txt
- uses: actions/upload-artifact@v4
with:
name: selftest-windows
path: selftest-windows.*
- name: Portable zip
shell: pwsh
run: |
@ -78,6 +90,15 @@ jobs:
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: |
sudo apt-get install -y xvfb libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 >/dev/null
MULBERRY_SELFTEST=$PWD/selftest-linux timeout 90 xvfb-run -a build/dist/Mulberry/mulberry
test -f selftest-linux.png && cat selftest-linux.txt
- uses: actions/upload-artifact@v4
with:
name: selftest-linux
path: selftest-linux.*
- name: Tarball
run: |
mkdir -p dist
@ -102,17 +123,28 @@ jobs:
path: dist/*
release:
if: startsWith(github.ref, 'refs/tags/v')
# 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:
files: artifacts/**/*
name: Mulberry ${{ github.ref_name }}
tag_name: v${{ env.VERSION }}
target_commitish: ${{ github.sha }}
name: Mulberry ${{ env.VERSION }}
make_latest: true
overwrite_files: true
files: |
artifacts/windows/*
artifacts/linux/*
body: |
## Downloads
| Platform | File |
@ -122,6 +154,9 @@ jobs:
| Linux, any distro | **Mulberry-x86_64.AppImage** (`chmod +x`, then run) |
| Linux tarball | **Mulberry-Linux-x86_64.tar.gz** (run `Mulberry/mulberry`) |
On Linux, install `mpv` from your package manager for gapless playback, the EQ and CD support.
See the [README](https://github.com/${{ github.repository }}#readme) for everything else.
generate_release_notes: true
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.*

View file

@ -87,6 +87,26 @@ def main():
c.readyRead.connect(read)
server.newConnection.connect(incoming)
selftest = os.environ.get("MULBERRY_SELFTEST")
if selftest:
# CI smoke test: start, render, write a screenshot + report, quit
from PyQt6.QtCore import QTimer
def _report():
from .player import Player, mpv_available
from . import theme as Th
try:
win.resize(1400, 860)
win.grab().save(selftest + ".png")
with open(selftest + ".txt", "w", encoding="utf-8") as fh:
fh.write(f"engine={Player.instance.backend.name}\nmpv_available={mpv_available()}\n"
f"dark={Th.theme.dark}\nprimary={Th.theme['primary'].name()}\n"
f"font={Th.theme.font_family}\nmedia_keys={getattr(win.media_keys, 'ok', None)}\n"
f"mpris={win.mpris.ok}\n")
finally:
win.quit_app()
QTimer.singleShot(int(os.environ.get("MULBERRY_SELFTEST_DELAY", "8000")), _report)
if args:
win.handle_args([os.path.abspath(a) if os.path.exists(a) else a for a in args])
rc = app.exec()