Skip to content

Commit

Permalink
Add Windows CI and fix up Linux and macOS (Taiko2k#1354)
Browse files Browse the repository at this point in the history
* Add Windows CI

* Try fixing Windows spec to work in CI too

* Windows.spec: Prefer temp msys

* Use pathlib

* Install zip

* docs + rename from linux to windows

* pack assets, locale, theme, templates and sdl2dll

* run.sh: Switch to using spec file for win_build

* Fix up changelog

* Fix up changelog some more

* add missing comma

* Fix up exception logging for imports

* Use pathlib for pyinstaller

* Fix debug message

* Fix pychromecast

* Try fixing a resource leak in Phazor

* Migrate to lynxtray

* Fix up deps and hiddenimports

* lynxtray does not need to be in hiddenimports

* Stop removing _internal from path on Windows pyinstaller builds

* Sort array

* Document picard being commented out better

* Fix jxlpy on macOS

* Also export libs on macOS

* run.sh: Compile both phazor and phazor-pw when compiling phazor-pw

* Try adding gir1.2-rsvg-2.0 for Linux

* Try adding libayatana-appindicator3-dev

* try installing SDL2 for Linux - should not be needed but see if it fixes the GTK warnings (doubt)

* Try adding kde-config-gtk-style to get rid of GTK warnings

* Linux: Try adding GTK 3.0 modules to get rid of warns

* Fix commas

* Comment out the GTK modules since they don't work anyway at the moment, from the spec file only

* Try shipping Plasma GTK libs to get rid of warns

* Fix up .so path

* Crash if user attempts to load new DB on old Tauon (starting with 7.9.0 and onwards)

* Add a helpful message for resolving the error
  • Loading branch information
C0rn3j authored Dec 24, 2024
1 parent ebb619d commit 50a07bf
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 108 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
sudo apt-get install -y \
gettext \
gobject-introspection \
gir1.2-rsvg-2.0 \
kde-config-gtk-style \
libgirepository1.0-dev \
python3-gi-cairo \
libayatana-appindicator3-dev \
libcairo2-dev \
libpipewire-0.3-dev \
libdbus-1-dev \
Expand All @@ -36,6 +39,7 @@ jobs:
libopenmpt-dev \
libopusfile-dev \
libsamplerate0-dev \
libsdl2-image-dev \
libvorbis-dev \
libwavpack-dev
# JPEG-XL hack since 24.04 is too old
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/build_Windows_MINGW64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build Windows (MINGW64) app
on:
push:
pull_request:

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

# TODO(Martin): This is duped from the file in extra, install from said file somehow instead
- name: Set up MSYS2 MinGW-W64
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
install: >-
base-devel
ca-certificates
cmake
ninja
zip
mingw-w64-x86_64-flac
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gobject-introspection
mingw-w64-x86_64-gtk3
mingw-w64-x86_64-libgme
mingw-w64-x86_64-libopenmpt
mingw-w64-x86_64-libsamplerate
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-python3
mingw-w64-x86_64-python3-gobject
mingw-w64-x86_64-python3-pillow
mingw-w64-x86_64-python3-pip
mingw-w64-x86_64-python-websocket-client
mingw-w64-x86_64-python-zeroconf
mingw-w64-x86_64-rust
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_image
mingw-w64-x86_64-wavpack
mingw-w64-x86_64-zlib
- name: Update CA trust and hack opusfile
shell: msys2 {0}
run: |
update-ca-trust
# https://github.com/xiph/opusfile/pull/47
sed -i 's,<opus_multistream.h>,<opus/opus_multistream.h>,' /mingw64/include/opus/opusfile.h
- name: Install Python dependencies and setup venv
shell: msys2 {0}
run: |
python -m pip install --upgrade pip
python -m venv .venv
source .venv/bin/activate
export CFLAGS="-I/mingw64/include"
pip install \
-r requirements.txt \
build \
pyinstaller
- name: Build the project using python-build
shell: msys2 {0}
run: |
source .venv/bin/activate
python -m compile_translations
python -m build --wheel
- name: Install the project into a venv
shell: msys2 {0}
run: |
source .venv/bin/activate
pip install --prefix ".venv" dist/*.whl
- name: "[DEBUG] List all files"
shell: msys2 {0}
run: find .

- name: Build Windows App with PyInstaller
shell: msys2 {0}
run: |
source .venv/bin/activate
pyinstaller --log-level=DEBUG windows.spec
- name: Create ZIP
shell: msys2 {0}
run: |
mkdir -p dist/zip
APP_NAME="TauonMusicBox"
APP_PATH="dist/${APP_NAME}"
ZIP_PATH="dist/zip/${APP_NAME}.zip"
zip -r "${ZIP_PATH}" "${APP_PATH}"
- name: Upload ZIP artifact
uses: actions/upload-artifact@v4
with:
name: TauonMusicBox-windows
path: dist/zip/TauonMusicBox.zip
5 changes: 2 additions & 3 deletions .github/workflows/build_macOS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ jobs:
python -m pip install --upgrade pip
python -m venv .venv
source .venv/bin/activate
export CXXFLAGS="-I/opt/homebrew/include"
export LDFLAGS="-L/opt/homebrew/lib"
pip install \
-r requirements.txt \
build
# Hack until pyinstaller has a release newer than 6.11.1 - https://github.com/pyinstaller/pyinstaller/releases
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
# \
# pyinstaller
# pip uninstall pyinstaller
# CFLAGS: "-I/opt/homebrew/include"
# LDFLAGS: "-L/opt/homebrew/lib"

- name: Build the project using python-build
run: |
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Changelog
### v7.9.0

- **Added** TIDAL support
- **Added** macOS (experimental) and Linux automated CI builds
- **Added** Linux/macOS/Windows CI builds, restoring Windows and macOS build support
- **Changed** portable installations now save `cache` and `user-data` directiories in `src/tauon/`, move existing directories there if necessary
- **Fixed** Windows support
- **Fixed** crashes related to PipeWire [#1250](https://github.com/Taiko2k/Tauon/issues/1250)
- **Fixed** audio cutting out on the PipeWire backend with specific custom quantum settings [#1245](https://github.com/Taiko2k/Tauon/issues/1245)
- **Fixed** wrong encoding used for some tags in XSPF exports [#1331](https://github.com/Taiko2k/Tauon/issues/1331)
Expand Down
1 change: 1 addition & 0 deletions extra/requirements_linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PlexAPI
PyGObject
pylast>=3.1.0
PySDL2
pysdl2-dll
requests
Send2Trash
unidecode
2 changes: 1 addition & 1 deletion extra/requirements_macos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Pillow
PlexAPI
PyGObject
pylast>=3.1.0
pysdl2-dll
PySDL2
pysdl2-dll
requests
Send2Trash
unidecode
2 changes: 1 addition & 1 deletion extra/requirements_optional.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
colored_traceback
jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563
jxlpy
#librespot - https://github.com/kokarare1212/librespot-python/pull/286
natsort
opencc; sys_platform != 'win32'
Expand Down
11 changes: 4 additions & 7 deletions extra/requirements_windows.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
beautifulsoup4
comtypes # Windows dep
infi.systray
keyboard # Windows dep
comtypes
lynxtray
keyboard
musicbrainzngs
mutagen
natsort # optdep
opencc-python-reimplemented # Windows version of openCC optdep
Pillow
PlexAPI
PyGObject
pyinstaller
pylast>=3.1.0
pypresence # optdep
PySDL2
pysdl2-dll
requests
Send2Trash
tekore # optdep
unidecode
2 changes: 2 additions & 0 deletions linux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ a = Analysis(
pathex=[],
binaries=[],
datas=[
("/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcolorreload-gtk-module.so", "lib/gtk-3.0/modules"),
("/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libwindow-decorations-gtk-module.so", "lib/gtk-3.0/modules"),
("src/tauon/assets", "assets"),
("src/tauon/locale", "locale"),
("src/tauon/theme", "theme"),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# "dbus-python; sys_platform == 'linux'",
# "pysdl2-dll; sys_platform == 'darwin'", # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements
# "comtypes; sys_platform == 'win32'",
# "infi.systray; sys_platform == 'win32'",
# "lynxtray; sys_platform == 'win32'",
# "keyboard; sys_platform == 'win32'",
# "Pillow; sys_platform != 'win32'",
# "opencc; sys_platform != 'win32'", # OPTDEP
Expand Down
35 changes: 18 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
beautifulsoup4
musicbrainzngs
mutagen
Pillow
PlexAPI
PyGObject
pylast>=3.1.0
PySDL2
pysdl2-dll # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements
requests
Send2Trash
unidecode
dbus-python; sys_platform == 'linux'
pysdl2-dll # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements
comtypes; sys_platform == 'win32'
infi.systray; sys_platform == 'win32'
dbus-python; sys_platform == 'linux'
jxlpy
keyboard; sys_platform == 'win32'
Pillow
opencc; sys_platform != 'win32' # OPTDEP
opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP
#pyinstaller # ; sys_platform != 'linux' # for macOS at least
pypresence # optdep
tekore # optdep,
natsort # optdep
jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563
lynxtray; sys_platform == 'win32'
opencc; sys_platform != 'win32' # optional
opencc-python-reimplemented; sys_platform == 'win32' # optional
pypresence # optional
tekore # optional
natsort # optional
PyChromecast # optional
setproctitle # optional
tidalapi # optional
colored_traceback # very optional
#pyinstaller
#librespot - https://github.com/kokarare1212/librespot-python/pull/286
#picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible.
PyChromecast # OPTDEP
setproctitle # OPTDEP
tidalapi # OPTDEP
colored_traceback # very opt
zeroconf # pychromecast dependency, TODO(Martin): This is a test, remove me
#picard - Waiting for release newer than 2.12.3 which has a fix for this: picard
# 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible.
# https://github.com/metabrainz/picard/releases
32 changes: 2 additions & 30 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,13 @@ win_build() {
rm -rf dist/tauon
# Had to do Windows Security -> Virus & thread protection*2 -> Manage settings -> Windows Real-time protection: off

# TODO(Martin): pkg_resources is deprecated, does it still need to be there?
# https://setuptools.pypa.io/en/latest/pkg_resources.html
pyinstaller \
--name TauonMusicBox \
--noconfirm \
--additional-hooks-dir='extra\pyinstaller-hooks' \
--hidden-import 'infi.systray' \
--hidden-import 'pylast' \
--hidden-import 'tekore' \
--hidden-import 'phazor' \
--add-binary 'C:\msys64\mingw64\bin\libFLAC.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libmpg123-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libogg-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libopenmpt-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libopus-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libopusfile-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libsamplerate-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libvorbis-0.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libvorbisfile-3.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libwavpack-1.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\SDL2.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\SDL2_image.dll;.' \
--add-binary 'C:\msys64\mingw64\bin\libgme.dll;.' \
--hidden-import 'pip' \
--hidden-import 'packaging.requirements' \
--hidden-import 'pkg_resources.py2_warn' \
--hidden-import 'requests' \
src/tauon/__main__.py \
-w -i src/tauon/assets/icon.ico
pyinstaller --log-level=DEBUG windows.spec

mkdir -p dist/TauonMusicBox/tekore
mkdir -p dist/TauonMusicBox/etc

#cp C:/msys64/mingw64/lib/python3.13/site-packages/tekore/VERSION dist/tauon/tekore/VERSION

cp -r src/tauon/{theme,assets,locale,templates} dist/TauonMusicBox/
rm -rf dist/tauon/share/{icons,locale,tcl/tzdata} dist/TauonMusicBox/tcl/tzdata
cp -r fonts dist/tauon/ || echo 'fonts directory is not present!'
cp -r /mingw64/etc/fonts dist/TauonMusicBox/etc
Expand Down Expand Up @@ -116,6 +87,7 @@ compile_phazor() {
}

compile_phazor_pipewire() {
compile_phazor
outFile="build/libphazor-pw.so"
mkdir -p build
gcc \
Expand Down
4 changes: 2 additions & 2 deletions src/tauon/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def transfer_args_and_exit() -> None:
pyinstaller_mode = False
if hasattr(sys, "_MEIPASS"):
pyinstaller_mode = True
if str(install_directory).endswith("\\_internal"):
if install_directory.name.endswith("_internal"):
pyinstaller_mode = True
install_directory = install_directory.parent
# install_directory = install_directory.parent

if pyinstaller_mode:
os.environ["PATH"] += ":" + sys._MEIPASS
Expand Down
Loading

0 comments on commit 50a07bf

Please sign in to comment.