Skip to content

use cmake

use cmake #10

Workflow file for this run

name: Build AudioChain
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: '3.22.x'
- name: Configure CMake build
run: |
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
- name: Build Release
run: |
cd build
cmake --build . --config Release --parallel $(sysctl -n hw.ncpu)
- name: Verify microphone permissions in built app
run: |
# Find the built app in the CMake build directory
APP_PATH=$(find build -name "*.app" -type d | head -1)
if [ -n "$APP_PATH" ]; then
echo "Checking Info.plist in: $APP_PATH"
INFO_PLIST_PATH="$APP_PATH/Contents/Info.plist"
if [ -f "$INFO_PLIST_PATH" ]; then
echo "=== Info.plist contents ==="
plutil -p "$INFO_PLIST_PATH"
echo ""
# Check specifically for microphone permission
if plutil -p "$INFO_PLIST_PATH" | grep -q "NSMicrophoneUsageDescription"; then
echo "✓ Microphone permission successfully included in final app"
echo "Permission text:"
plutil -p "$INFO_PLIST_PATH" | grep -A1 "NSMicrophoneUsageDescription"
else
echo "⚠️ Warning: NSMicrophoneUsageDescription not found in final Info.plist"
echo "This may cause the app to crash when requesting microphone access on macOS"
fi
else
echo "⚠️ Warning: Info.plist not found at expected location"
fi
else
echo "⚠️ Warning: Built app not found, cannot verify permissions"
echo "Listing build directory contents:"
find build -type f -name "*.app" || find build -type d
fi
- name: Create DMG
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
# Install create-dmg for creating the DMG
brew install create-dmg
# Find the built app in the CMake build directory
APP_PATH=$(find build -name "*.app" -type d | head -1)
if [ -n "$APP_PATH" ]; then
echo "Found app at: $APP_PATH"
# Create DMG
create-dmg \
--volname "AudioChain" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "AudioChain.app" 200 190 \
--hide-extension "AudioChain.app" \
--app-drop-link 600 185 \
"AudioChain-macOS.dmg" \
"$APP_PATH"
else
echo "App not found, listing build directory contents..."
find build -type f -name "*.app" || find build -type d
fi
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: AudioChain-macOS
path: |
AudioChain-macOS.dmg
build/**/*.app
if-no-files-found: ignore
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Visual Studio
uses: microsoft/setup-msbuild@v2
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: '3.22.x'
- name: Configure CMake build
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -A x64
- name: Build Release
run: |
cd build
cmake --build . --config Release --parallel
- name: Verify build output
shell: powershell
run: |
# Find and verify the built executable
$exePath = Get-ChildItem -Path "build" -Recurse -Filter "AudioChain.exe" | Select-Object -First 1
if ($exePath) {
Write-Host "✓ Build successful! Executable found at: $($exePath.FullName)"
Write-Host "File size: $('{0:N0}' -f $exePath.Length) bytes"
# Check if it's a valid PE file
$fileHeader = Get-Content $exePath.FullName -Encoding Byte -TotalCount 2
if ($fileHeader[0] -eq 77 -and $fileHeader[1] -eq 90) {
Write-Host "✓ Valid Windows executable (PE format)"
} else {
Write-Host "⚠️ Warning: Executable may not be valid PE format"
}
} else {
Write-Host "❌ Build failed - executable not found"
Write-Host "Build directory contents:"
Get-ChildItem -Path "build" -Recurse | ForEach-Object { Write-Host " $($_.FullName)" }
exit 1
}
- name: Package Windows build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
shell: powershell
run: |
# Find the built executable in the CMake build directory
$exePath = Get-ChildItem -Path "build" -Recurse -Filter "AudioChain.exe" | Select-Object -First 1
if ($exePath) {
Write-Host "Found executable at: $($exePath.FullName)"
$releaseDir = $exePath.Directory.FullName
# Create distribution folder
New-Item -ItemType Directory -Force -Path "AudioChain-Windows-Release"
Copy-Item -Path "$releaseDir\*" -Destination "AudioChain-Windows-Release" -Recurse -Force
# Create ZIP
Compress-Archive -Path "AudioChain-Windows-Release\*" -DestinationPath "AudioChain-Windows.zip"
} else {
Write-Host "Executable not found, listing build directory contents..."
Get-ChildItem -Path "build" -Recurse -Include "*.exe" | ForEach-Object { Write-Host $_.FullName }
fi
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: AudioChain-Windows
path: |
build/**/*.exe
AudioChain-Windows.zip
if-no-files-found: ignore
release:
needs: [build-macos, build-windows]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.run_number }}
name: AudioChain v${{ github.run_number }}
body: |
## AudioChain Release v${{ github.run_number }}
Cross-platform audio processing application with VST plugin chain support.
### Downloads
- **macOS**: AudioChain-macOS.dmg
- **Windows**: AudioChain-Windows.zip
### Features
- Real-time audio processing through VST plugin chains
- Support for VST2, VST3, and Audio Unit (macOS) plugins
- Cross-platform compatibility (macOS and Windows)
- Modern JUCE-based GUI
Built from commit: ${{ github.sha }}
files: |
AudioChain-macOS/AudioChain-macOS.dmg
AudioChain-Windows/AudioChain-Windows.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}