Skip to content

Commit

Permalink
Switch macOS CI partially away from venv and more towards brew (Taiko…
Browse files Browse the repository at this point in the history
…2k#1378)

* Install Pillow from brew

* Add debug step to list Cellar files

* Brew install Python

* Try like so

* Forgot to undo req change

* Install harfbuzz

* Try enabling system packages for venv

* Yeet pillow again

* Try launching the app to see what happens

* Juggle juggle

* Build hack test

* gdk yolo test

* Break pip

* sigh

* Heeeere?

* test

* macOS runner now uses 14.0

* Comment out sdl2dll

* try adding libSDL2-2.0.0.dylib

* pack sdl2dll

* Cleanup

* More cleanup

* Fix up hardcoding
  • Loading branch information
C0rn3j authored Jan 7, 2025
1 parent 398f045 commit 2cdc4cb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
42 changes: 27 additions & 15 deletions .github/workflows/build_macOS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.13'

- name: brew update and upgrade
run: brew update && brew upgrade
Expand All @@ -28,6 +28,7 @@ jobs:
gobject-introspection \
gtk+3 \
pango \
pillow \
sdl2 \
sdl2_image \
jpeg-xl \
Expand All @@ -38,39 +39,45 @@ jobs:
wavpack \
game-music-emu
# This generates 30MB of logs, enable it only when actively debugging something
# - name: "[DEBUG] List all Cellar files"
# run: find /opt/homebrew/Cellar

- name: Install Python dependencies and setup venv
run: |
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 \
$(brew --prefix python)/libexec/bin/python -m pip install --break-system-packages --upgrade pip
$(brew --prefix python)/libexec/bin/pip install --break-system-packages \
-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
$(brew --prefix python)/libexec/bin/pip install --break-system-packages https://github.com/pyinstaller/pyinstaller/archive/develop.zip
# $(brew --prefix python)/libexec/bin/python -m venv --system-site-packages .venv
# source .venv/bin/activate
# pyinstaller
# CFLAGS: "-I/opt/homebrew/include"

- name: Build the project using python-build
run: |
source .venv/bin/activate
python -m compile_translations
python -m build --wheel
$(brew --prefix python)/libexec/bin/python -m compile_translations
$(brew --prefix python)/libexec/bin/python -m build --wheel
# source .venv/bin/activate

- name: Install the project into a venv
run: |
source .venv/bin/activate
pip install --prefix ".venv" dist/*.whl
$(brew --prefix python)/libexec/bin/pip install --prefix ".venv" dist/*.whl
# $(brew --prefix python)/libexec/bin/pip install --break-system-packages dist/*.whl
# source .venv/bin/activate

- name: "[DEBUG] List all files"
run: find .

- name: Build macOS app with PyInstaller
run: |
source .venv/bin/activate
pyinstaller --log-level=DEBUG mac.spec
# source .venv/bin/activate
env:
DYLD_LIBRARY_PATH: "/opt/homebrew/lib"

Expand All @@ -92,3 +99,8 @@ jobs:
with:
name: TauonMusicBox-dmg
path: dist/dmg/TauonMusicBox.dmg

# - name: Run Tauon for testing
# run: |
# hdiutil attach dist/dmg/TauonMusicBox.dmg
# /Volumes/TauonMusicBox/TauonMusicBox.app/Contents/MacOS/Tauon\ Music\ Box
5 changes: 3 additions & 2 deletions mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ libs = [
]

lib_paths = [(f"{prefix}/lib/{lib}", ".") for lib in libs]
phazor_path = f"build/lib.macosx-10.13-universal2-cpython-{python_ver_dotless}/phazor.cpython-{python_ver_dotless}-darwin.so"
phazor_path = f"build/lib.macosx-14.0-arm64-cpython-{python_ver_dotless}/phazor.cpython-{python_ver_dotless}-darwin.so"

a = Analysis(
["src/tauon/__main__.py"],
Expand All @@ -36,7 +36,8 @@ a = Analysis(
("src/tauon/theme", "theme"),
("src/tauon/templates", "templates"),
# This could only have SDL2.framework and SDL2_image.framework to save space...
(f".venv/lib/python{python_ver}/site-packages/sdl2dll/dll", "sdl2dll/dll"),
(f"{prefix}/lib/python{python_ver}/site-packages/sdl2dll/dll", "sdl2dll/dll"),
# (f".venv/lib/python{python_ver}/site-packages/sdl2dll/dll", "sdl2dll/dll"),
# (f".venv/lib/python{python_ver}/site-packages/sdl2dll/dll/SDL2.framework", "sdl2dll/dll/SDL2.framework"),
# (f".venv/lib/python{python_ver}/site-packages/sdl2dll/dll/SDL2_image.framework", "sdl2dll/dll/SDL2_image.framework"),
],
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
beautifulsoup4
musicbrainzngs
mutagen
Pillow
Pillow # ; sys_platform != 'darwin' # Install Pillow from brew on macOS
PlexAPI
PyGObject
pylast>=3.1.0
Expand Down

0 comments on commit 2cdc4cb

Please sign in to comment.