Files
PyTaiko/.github/workflows/python-app.yml
2025-09-15 19:20:46 -04:00

192 lines
5.9 KiB
YAML

name: PyTaiko
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: write
pull-requests: write
issues: write
repository-projects: write
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check-out repository
uses: actions/checkout@v4
- name: Install Audio Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install portaudio libsndfile libsamplerate pkg-config
# Use MSYS2 for Windows audio library build with all codec dependencies
- name: Set up MSYS2 (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
mingw-w64-x86_64-gcc
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-libsndfile
mingw-w64-x86_64-libsamplerate
mingw-w64-x86_64-flac
mingw-w64-x86_64-libvorbis
mingw-w64-x86_64-libogg
mingw-w64-x86_64-opus
mingw-w64-x86_64-mpg123
mingw-w64-x86_64-lame
mingw-w64-x86_64-speex
- name: Build static audio library (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
working-directory: libs/audio
run: |
# Clean previous builds
make clean
# Build with static linking
make static || make all
# Verify the build
make verify
# Show final library info
echo "=== Final library verification ==="
ls -la libaudio.dll
file libaudio.dll
# Check dependencies - should be minimal
echo "=== DLL Dependencies (should be minimal) ==="
objdump -p libaudio.dll | grep "DLL Name:" || echo "No external DLL dependencies found!"
- name: Copy static DLL (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p build/lib
cp libs/audio/libaudio.dll build/lib/
# No need to copy other DLLs since everything is statically linked!
echo "Static build complete - single DLL created"
ls -la build/lib/
shell: bash
# For Unix systems, also try static builds
- name: Install static development libraries (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libportaudio2 \
portaudio19-dev \
libsndfile1-dev \
libsamplerate0-dev \
libflac-dev \
libvorbis-dev \
libogg-dev \
ccache
- name: Build static audio library (Unix)
if: runner.os != 'Windows'
run: |
cd libs/audio
make clean
make static || make all # Fallback to regular build if static fails
make verify
shell: bash
- name: Install static audio library (Unix)
if: runner.os != 'Windows'
run: |
cd libs/audio
sudo make install
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Setup Python
run: uv python install
- name: Install Dependencies
run: |
uv sync
- name: Install Nuitka
run: |
uv add nuitka
- name: Build Executable
run: |
uv run nuitka --mode=app --noinclude-setuptools-mode=nofollow --noinclude-IPython-mode=nofollow --assume-yes-for-downloads PyTaiko.py
- name: Create Release Directory
run: |
mkdir -p release
cp -r Graphics Sounds Videos Songs config.toml shader model release/
# Copy the compiled audio library and dependencies to release
if [ "${{ runner.os }}" == "Windows" ]; then
# Copy all DLLs from libs/audio (includes our library and dependencies)
cp libs/audio/*.dll release/ 2>/dev/null || echo "No DLLs found in libs/audio/"
# Also try from build/lib as backup
cp build/lib/*.dll release/ 2>/dev/null || echo "No DLLs found in build/lib/"
# List what we copied
echo "DLLs in release directory:"
ls -la release/*.dll 2>/dev/null || echo "No DLLs found in release/"
elif [ "${{ runner.os }}" == "macOS" ]; then
cp libs/audio/libaudio.dylib release/ 2>/dev/null || true
else
cp libs/audio/libaudio.so release/ 2>/dev/null || true
fi
# Copy executable based on OS
if [ "${{ runner.os }}" == "Windows" ]; then
cp *.exe release/ 2>/dev/null || echo "No .exe files found"
elif [ "${{ runner.os }}" == "macOS" ]; then
cp -r *.app release/ 2>/dev/null || echo "No .app bundles found"
else
cp *.bin release/ 2>/dev/null || echo "No .bin files found"
fi
echo "Final release directory contents:"
ls -la release/
shell: bash
- name: Create Zip Archive
run: |
cd release
if [ "${{ runner.os }}" == "Windows" ]; then
7z a ../PyTaiko-${{ runner.os }}-${{ runner.arch }}.zip *
else
zip -r ../PyTaiko-${{ runner.os }}-${{ runner.arch }}.zip *
fi
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: PyTaiko-${{ runner.os }}-${{ runner.arch }}
path: release/
- name: Upload Release
uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
with:
files: PyTaiko-${{ runner.os }}-${{ runner.arch }}.zip
name: "PyTaiko [Rolling Release]"
tag_name: "latest"
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}