This commit is contained in:
Anthony Samms
2025-09-15 11:52:41 -04:00
parent 09f8f30c43
commit c7f3aeb4fc
2 changed files with 148 additions and 1 deletions

147
.github/workflows/build_audio.yml vendored Normal file
View File

@@ -0,0 +1,147 @@
# GitHub Actions workflow for building audio library
name: Build Audio Library
on:
push:
branches: [main, develop]
paths:
- "libs/audio/**"
- ".github/workflows/build-audio.yml"
pull_request:
branches: [main, develop]
paths:
- "libs/audio/**"
- ".github/workflows/build-audio.yml"
workflow_dispatch: # Allow manual triggering
jobs:
build-linux:
name: Build on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libportaudio19-dev \
libsndfile1-dev \
libsamplerate0-dev \
libasound2-dev
- name: Check dependencies
run: make -C libs/audio check-deps
- name: Build library
run: make -C libs/audio all
- name: Build debug version
run: make -C libs/audio debug
- name: Test library exists
run: |
ls -la libs/audio/
test -f libs/audio/libaudio.so
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: libaudio-linux
path: libs/audio/libaudio.so
retention-days: 30
build-windows:
name: Build on Windows
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
- name: Install dependencies with vcpkg
run: |
vcpkg install portaudio:x64-windows
vcpkg install libsndfile:x64-windows
vcpkg install libsamplerate:x64-windows
- name: Setup MSVC
uses: microsoft/setup-msbuild@v2
- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Set vcpkg environment variables
shell: cmd
run: |
echo VCPKG_INSTALLATION_ROOT=%VCPKG_ROOT% >> %GITHUB_ENV%
echo VCPKG_INCLUDE_PATH=%VCPKG_ROOT%\installed\x64-windows\include >> %GITHUB_ENV%
echo VCPKG_LIB_PATH=%VCPKG_ROOT%\installed\x64-windows\lib >> %GITHUB_ENV%
- name: Check dependencies
shell: cmd
run: make -C libs/audio check-deps
- name: Build library
shell: cmd
run: make -C libs/audio all
- name: Build debug version
shell: cmd
run: make -C libs/audio debug
- name: Test library exists
shell: cmd
run: |
dir libs\audio\
if not exist "libs\audio\libaudio.dll" exit /b 1
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: libaudio-windows
path: libs/audio/libaudio.dll
retention-days: 30
build-summary:
name: Build Summary
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Display build results
run: |
echo "## Build Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f libaudio-linux/libaudio.so ]; then
echo "✅ Linux build: SUCCESS" >> $GITHUB_STEP_SUMMARY
ls -lh libaudio-linux/libaudio.so >> $GITHUB_STEP_SUMMARY
else
echo "❌ Linux build: FAILED" >> $GITHUB_STEP_SUMMARY
fi
if [ -f libaudio-windows/libaudio.dll ]; then
echo "✅ Windows build: SUCCESS" >> $GITHUB_STEP_SUMMARY
ls -lh libaudio-windows/libaudio.dll >> $GITHUB_STEP_SUMMARY
else
echo "❌ Windows build: FAILED" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "Artifacts are available for download from the Actions page." >> $GITHUB_STEP_SUMMARY

View File

@@ -8,7 +8,7 @@ LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
# Detect OS and set appropriate flags # Detect OS and set appropriate flags
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows) UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
# Windows detection (including GitHub Actions Windows runners) # Windows detection
ifneq (,$(findstring Windows,$(UNAME_S))) ifneq (,$(findstring Windows,$(UNAME_S)))
# Windows with MSVC # Windows with MSVC
CC = cl CC = cl