Skip to content

Merge pull request #6 from YimingZhanshen/copilot/add-screen-mirror-d… #59

Merge pull request #6 from YimingZhanshen/copilot/add-screen-mirror-d…

Merge pull request #6 from YimingZhanshen/copilot/add-screen-mirror-d… #59

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore AirPlay.sln
- name: Build
run: dotnet build AirPlay.sln --configuration Release --no-restore
- name: Publish
run: dotnet publish AirPlay/AirPlay.csproj --configuration Release --runtime win-x64 --self-contained true --output ./publish/win-x64
- name: Cache FFmpeg
id: cache-ffmpeg
uses: actions/cache@v4
with:
path: ffmpeg-cache
key: ffmpeg-win64-gpl-v1
- name: Download FFmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
shell: pwsh
run: |
$ffmpegUrl = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
Invoke-WebRequest -Uri $ffmpegUrl -OutFile ffmpeg.zip
Expand-Archive -Path ffmpeg.zip -DestinationPath ffmpeg-tmp
$binDir = Get-ChildItem -Path ffmpeg-tmp -Recurse -Directory -Filter "bin" | Select-Object -First 1
New-Item -ItemType Directory -Force -Path ffmpeg-cache
Copy-Item "$($binDir.FullName)\ffmpeg.exe" -Destination ffmpeg-cache/
Copy-Item "$($binDir.FullName)\ffplay.exe" -Destination ffmpeg-cache/
- name: Copy FFmpeg to publish
shell: pwsh
run: |
Copy-Item "ffmpeg-cache\ffmpeg.exe" -Destination ./publish/win-x64/
Copy-Item "ffmpeg-cache\ffplay.exe" -Destination ./publish/win-x64/
- name: Cache libfdk-aac
id: cache-fdkaac
uses: actions/cache@v4
with:
path: fdkaac-cache
key: fdkaac-win64-v1
- name: Build libfdk-aac from source
if: steps.cache-fdkaac.outputs.cache-hit != 'true'
shell: bash
run: |
# Build FDK-AAC from official source using MSYS2 (pre-installed on windows-latest)
export MSYSTEM=MINGW64
export PATH="/c/msys64/mingw64/bin:/c/msys64/usr/bin:$PATH"
# Install build dependencies
pacman -S --noconfirm --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake make
# Clone and build fdk-aac
git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git fdk-aac-src
cd fdk-aac-src
# Use CMake for a simpler build
mkdir build && cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
cmake --build . --config Release
# Find and copy the DLL to cache
echo "Built files:"
find . -name "*.dll" -type f
DLL_PATH=$(find . -name "fdk-aac*.dll" -o -name "libfdk-aac*.dll" | head -1)
if [ -z "$DLL_PATH" ]; then
echo "ERROR: No FDK-AAC DLL found after build"
exit 1
fi
mkdir -p ../../fdkaac-cache
cp -v "$DLL_PATH" ../../fdkaac-cache/libfdk-aac-2.dll
echo "Successfully built and cached libfdk-aac-2.dll"
- name: Copy libfdk-aac to publish
shell: bash
run: cp -v fdkaac-cache/libfdk-aac-2.dll publish/win-x64/libfdk-aac-2.dll
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: AirPlay-win-x64
path: ./publish/win-x64/