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 # Install audio library dependencies - name: Install Audio Dependencies (Ubuntu) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y \ build-essential \ pkg-config \ portaudio19-dev \ libsndfile1-dev \ libsamplerate0-dev \ ccache - 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 - 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 - name: Build audio library (DLL) (Windows) if: runner.os == 'Windows' shell: msys2 {0} working-directory: libs/audio run: | make clean make all - name: List build outputs (Windows) if: runner.os == 'Windows' shell: msys2 {0} working-directory: libs/audio run: | ls -l - name: Copy DLL to build directory (Windows) if: runner.os == 'Windows' run: | mkdir -p build/lib cp libs/audio/libaudio.dll build/lib/ shell: bash - name: Copy DLL dependencies (Windows) if: runner.os == 'Windows' shell: msys2 {0} run: | # Get the actual workspace path WORKSPACE_PATH=$(cygpath -m "$GITHUB_WORKSPACE") echo "Workspace path: $WORKSPACE_PATH" # Create build directory mkdir -p "$WORKSPACE_PATH/build/lib" # Copy our built library first cp libs/audio/libaudio.dll "$WORKSPACE_PATH/build/lib/" # Copy MinGW runtime dependencies cp /mingw64/bin/libgcc_s_seh-1.dll "$WORKSPACE_PATH/build/lib/" cp /mingw64/bin/libwinpthread-1.dll "$WORKSPACE_PATH/build/lib/" cp /mingw64/bin/libstdc++-6.dll "$WORKSPACE_PATH/build/lib/" || echo "libstdc++-6.dll not found" # Copy audio library dependencies cp /mingw64/bin/libportaudio.dll "$WORKSPACE_PATH/build/lib/" cp /mingw64/bin/libsndfile-1.dll "$WORKSPACE_PATH/build/lib/" cp /mingw64/bin/libsamplerate-0.dll "$WORKSPACE_PATH/build/lib/" # Copy other potential dependencies (with error handling) cp /mingw64/bin/libFLAC.dll "$WORKSPACE_PATH/build/lib/" || echo "libFLAC.dll not found" cp /mingw64/bin/libvorbis-0.dll "$WORKSPACE_PATH/build/lib/" || echo "libvorbis-0.dll not found" cp /mingw64/bin/libvorbisenc-2.dll "$WORKSPACE_PATH/build/lib/" || echo "libvorbisenc-2.dll not found" cp /mingw64/bin/libogg-0.dll "$WORKSPACE_PATH/build/lib/" || echo "libogg-0.dll not found" # Also copy DLLs directly to libs/audio for the release step cp /mingw64/bin/libgcc_s_seh-1.dll libs/audio/ cp /mingw64/bin/libwinpthread-1.dll libs/audio/ cp /mingw64/bin/libstdc++-6.dll libs/audio/ || echo "libstdc++-6.dll not found" cp /mingw64/bin/libportaudio.dll libs/audio/ cp /mingw64/bin/libsndfile-1.dll libs/audio/ cp /mingw64/bin/libsamplerate-0.dll libs/audio/ cp /mingw64/bin/libFLAC.dll libs/audio/ || echo "libFLAC.dll not found" cp /mingw64/bin/libvorbis-0.dll libs/audio/ || echo "libvorbis-0.dll not found" cp /mingw64/bin/libvorbisenc-2.dll libs/audio/ || echo "libvorbisenc-2.dll not found" cp /mingw64/bin/libogg-0.dll libs/audio/ || echo "libogg-0.dll not found" # List what we have echo "Contents of build/lib/:" ls -la "$WORKSPACE_PATH/build/lib/" echo "Contents of libs/audio/:" ls -la libs/audio/ # Compile the audio library (Unix) - name: Check Audio Library Dependencies run: | cd libs/audio make check-deps shell: bash continue-on-error: true - name: Compile Audio Library (Unix) if: runner.os != 'Windows' run: | cd libs/audio make clean make all shell: bash - name: Install 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 }}