mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
202 lines
6.3 KiB
YAML
202 lines
6.3 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
|
|
|
|
# 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
|
|
|
|
- name: Install Audio Dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew update
|
|
brew install portaudio libsndfile libsamplerate pkg-config
|
|
|
|
- name: Install Audio Dependencies (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
# Install vcpkg dependencies
|
|
vcpkg integrate install
|
|
vcpkg install portaudio:x64-windows libsndfile:x64-windows libsamplerate:x64-windows
|
|
|
|
# Set up environment variables for the build system
|
|
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
|
|
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
|
|
|
|
# Set up include and library paths
|
|
$vcpkgPath = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows"
|
|
echo "CPPFLAGS=-I$vcpkgPath/include" >> $env:GITHUB_ENV
|
|
echo "LDFLAGS=-L$vcpkgPath/lib" >> $env:GITHUB_ENV
|
|
echo "PKG_CONFIG_PATH=$vcpkgPath/lib/pkgconfig" >> $env:GITHUB_ENV
|
|
|
|
# Add bin directory to PATH for runtime DLLs
|
|
echo "$vcpkgPath/bin" >> $env:GITHUB_PATH
|
|
shell: powershell
|
|
|
|
# Set up build tools for Windows
|
|
- name: Setup MSVC (Windows)
|
|
if: runner.os == 'Windows'
|
|
uses: microsoft/setup-msbuild@v2
|
|
|
|
- name: Setup MSVC Environment (Windows)
|
|
if: runner.os == 'Windows'
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
with:
|
|
arch: x64
|
|
|
|
# Compile the audio library
|
|
- name: Check Audio Library Dependencies
|
|
run: |
|
|
cd libs/audio
|
|
make check-deps
|
|
shell: bash
|
|
continue-on-error: true
|
|
|
|
- name: Compile Audio Library (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
cd libs/audio
|
|
make clean
|
|
# Use environment variables set above
|
|
make all CC=cl CFLAGS="/I%VCPKG_INSTALLATION_ROOT%/installed/x64-windows/include" LDFLAGS="/LIBPATH:%VCPKG_INSTALLATION_ROOT%/installed/x64-windows/lib"
|
|
shell: cmd
|
|
env:
|
|
VCPKG_INSTALLATION_ROOT: ${{ env.VCPKG_ROOT }}
|
|
|
|
- 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: Setup Audio Library (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
cd libs/audio
|
|
# Create build directory and copy library files
|
|
mkdir -p ../../build/lib
|
|
|
|
# Copy the compiled library
|
|
if (Test-Path "libaudio.dll") {
|
|
Copy-Item "libaudio.dll" "../../build/lib/"
|
|
echo "Copied libaudio.dll"
|
|
}
|
|
|
|
# Copy vcpkg DLLs that are needed at runtime
|
|
$vcpkgBin = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
|
|
if (Test-Path $vcpkgBin) {
|
|
echo "Copying runtime DLLs from vcpkg..."
|
|
Get-ChildItem "$vcpkgBin/*.dll" | ForEach-Object {
|
|
Copy-Item $_.FullName "../../build/lib/" -ErrorAction SilentlyContinue
|
|
echo "Copied $($_.Name)"
|
|
}
|
|
}
|
|
|
|
# Add to PATH
|
|
echo "${{ github.workspace }}/build/lib" >> $env:GITHUB_PATH
|
|
shell: powershell
|
|
|
|
- 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 to release
|
|
if [ "${{ runner.os }}" == "Windows" ]; then
|
|
cp libs/audio/*.dll release/ 2>/dev/null || true
|
|
cp build/lib/*.dll release/ 2>/dev/null || true
|
|
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 || true
|
|
elif [ "${{ runner.os }}" == "macOS" ]; then
|
|
cp -r *.app release/ 2>/dev/null || true
|
|
else
|
|
cp *.bin release/ 2>/dev/null || true
|
|
fi
|
|
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 }}
|