This commit is contained in:
Anthony Samms
2025-09-15 12:11:54 -04:00
parent 4db9c8f393
commit bf850644cb
2 changed files with 85 additions and 110 deletions

View File

@@ -1,148 +1,123 @@
# GitHub Actions workflow for building audio library name: Build Audio Library (Windows)
name: Build Audio Library
on: on:
push: push:
branches: [main, develop] branches: [main, develop]
paths:
- "libs/audio/**"
- ".github/workflows/build-audio.yml"
pull_request: pull_request:
branches: [main, develop] branches: [main, develop]
paths:
- "libs/audio/**"
- ".github/workflows/build-audio.yml"
workflow_dispatch: # Allow manual triggering workflow_dispatch: # Allow manual triggering
jobs: 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 \
portaudio19-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: build-windows:
name: Build on Windows
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout code - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup vcpkg - name: Setup vcpkg
uses: lukka/run-vcpkg@v11 uses: microsoft/setup-msbuild@v2
with:
vcpkgGitCommitId: "a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
- name: Install dependencies with vcpkg - name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: |
${{ env.VCPKG_INSTALLATION_ROOT }}\installed
${{ env.VCPKG_INSTALLATION_ROOT }}\packages
key: vcpkg-${{ runner.os }}-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
vcpkg-${{ runner.os }}-
- name: Install vcpkg dependencies
run: | run: |
vcpkg update
vcpkg install portaudio:x64-windows vcpkg install portaudio:x64-windows
vcpkg install libsndfile:x64-windows vcpkg install libsndfile:x64-windows
vcpkg install libsamplerate:x64-windows vcpkg install libsamplerate:x64-windows
vcpkg integrate install
- name: Setup MSVC - name: Setup MSVC environment
uses: microsoft/setup-msbuild@v2 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 - name: Check dependencies
run: make check-deps
shell: cmd shell: cmd
run: make -C libs/audio check-deps env:
VCPKG_INSTALLATION_ROOT: ${{ env.VCPKG_ROOT }}
- name: Build library - name: Build audio library
run: make all
shell: cmd shell: cmd
run: make -C libs/audio all env:
VCPKG_INSTALLATION_ROOT: ${{ env.VCPKG_ROOT }}
- name: Build debug version - name: Upload build artifacts
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 uses: actions/upload-artifact@v4
with: with:
name: libaudio-windows name: libaudio-windows-x64
path: libs/audio/libaudio.dll path: |
libaudio.dll
*.lib
retention-days: 30 retention-days: 30
build-summary: - name: Run tests (if available)
name: Build Summary run: |
runs-on: ubuntu-latest if exist tests.exe (
needs: [build-linux, build-windows] echo Running tests...
if: always() tests.exe
) else (
echo No tests found, skipping...
)
shell: cmd
continue-on-error: true
build-matrix:
runs-on: windows-latest
strategy:
matrix:
architecture: [x64, x86]
configuration: [Release, Debug]
steps: steps:
- name: Download all artifacts - name: Checkout repository
uses: actions/download-artifact@v4 uses: actions/checkout@v4
- name: Display build results - name: Setup vcpkg
uses: microsoft/setup-msbuild@v2
- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: |
${{ env.VCPKG_INSTALLATION_ROOT }}\installed
${{ env.VCPKG_INSTALLATION_ROOT }}\packages
key: vcpkg-${{ matrix.architecture }}-${{ matrix.configuration }}-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
vcpkg-${{ matrix.architecture }}-${{ matrix.configuration }}-
- name: Install vcpkg dependencies
run: | run: |
echo "## Build Results" >> $GITHUB_STEP_SUMMARY vcpkg install portaudio:${{ matrix.architecture }}-windows
echo "" >> $GITHUB_STEP_SUMMARY vcpkg install libsndfile:${{ matrix.architecture }}-windows
vcpkg install libsamplerate:${{ matrix.architecture }}-windows
vcpkg integrate install
if [ -f libaudio-linux/libaudio.so ]; then - name: Build library (${{ matrix.architecture }}, ${{ matrix.configuration }})
echo "✅ Linux build: SUCCESS" >> $GITHUB_STEP_SUMMARY run: |
ls -lh libaudio-linux/libaudio.so >> $GITHUB_STEP_SUMMARY if ("${{ matrix.configuration }}" -eq "Debug") {
else make debug
echo "❌ Linux build: FAILED" >> $GITHUB_STEP_SUMMARY } else {
fi make all
}
shell: powershell
env:
VCPKG_INSTALLATION_ROOT: ${{ env.VCPKG_ROOT }}
if [ -f libaudio-windows/libaudio.dll ]; then - name: Upload artifacts (${{ matrix.architecture }}, ${{ matrix.configuration }})
echo "✅ Windows build: SUCCESS" >> $GITHUB_STEP_SUMMARY uses: actions/upload-artifact@v4
ls -lh libaudio-windows/libaudio.dll >> $GITHUB_STEP_SUMMARY with:
else name: libaudio-windows-${{ matrix.architecture }}-${{ matrix.configuration }}
echo "❌ Windows build: FAILED" >> $GITHUB_STEP_SUMMARY path: |
fi libaudio.dll
*.lib
echo "" >> $GITHUB_STEP_SUMMARY *.pdb
echo "Artifacts are available for download from the Actions page." >> $GITHUB_STEP_SUMMARY retention-days: 30

View File

@@ -26,7 +26,6 @@ ifneq (,$(findstring Windows,$(UNAME_S)))
LDFLAGS += $(LIB_PATH) LDFLAGS += $(LIB_PATH)
endif endif
# Check for environment variables set by GitHub Actions
ifdef VCPKG_INCLUDE_PATH ifdef VCPKG_INCLUDE_PATH
CFLAGS += /I"$(VCPKG_INCLUDE_PATH)" CFLAGS += /I"$(VCPKG_INCLUDE_PATH)"
endif endif
@@ -85,6 +84,7 @@ check-deps:
@echo "Assuming vcpkg dependencies are installed..." @echo "Assuming vcpkg dependencies are installed..."
@if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\portaudio.h" (echo PortAudio found!) else (echo PortAudio not found! && exit 1) @if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\portaudio.h" (echo PortAudio found!) else (echo PortAudio not found! && exit 1)
@if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\sndfile.h" (echo libsndfile found!) else (echo libsndfile not found! && exit 1) @if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\sndfile.h" (echo libsndfile found!) else (echo libsndfile not found! && exit 1)
@if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\samplerate.h" (echo libsamplerate found!) else (echo libsamplerate not found! && exit 1)
@echo "All dependencies found!" @echo "All dependencies found!"
else else