Agash.PipeWire: .NET bindings for PipeWire #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # OIDC for NuGet.org trusted publishing | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # MinVer needs full history | |
| - name: Install PipeWire runtime + dev headers + libclang | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends \ | |
| libpipewire-0.3-0 \ | |
| libpipewire-0.3-dev \ | |
| libclang-dev \ | |
| pkg-config | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| include-prerelease: true | |
| - name: Restore | |
| run: dotnet restore PipeWire.NET.slnx | |
| - name: Build | |
| run: dotnet build PipeWire.NET.slnx --no-restore -c Release | |
| - name: Test (non-integration on host runner) | |
| run: dotnet test PipeWire.NET.slnx --no-build -c Release | |
| --filter "TestCategory!=Integration" | |
| - name: Install ClangSharpPInvokeGenerator + native runtime packages | |
| run: | | |
| dotnet tool install --global ClangSharpPInvokeGenerator --version 21.1.8.3 | |
| # The dotnet tool packaging does not bundle libclang/libClangSharp; | |
| # pull matching native packages and let generate.sh point LD at them. | |
| mkdir -p /tmp/clangsharp-bootstrap | |
| cd /tmp/clangsharp-bootstrap | |
| dotnet new console -o dummy -n dummy --force | |
| cd dummy | |
| dotnet add package libclang.runtime.linux-x64 --version 21.1.8 | |
| dotnet add package libClangSharp.runtime.linux-x64 --version 21.1.8 | |
| - name: Verify generated bindings are up to date | |
| run: | | |
| bash generate/generate.sh | |
| if ! git diff --quiet -- src/Agash.PipeWire/generated/; then | |
| echo "::error::Generated bindings are out of date." | |
| echo "Run 'bash generate/generate.sh' locally and commit the result." | |
| git diff -- src/Agash.PipeWire/generated/ | |
| exit 1 | |
| fi | |
| - name: Run Linux integration tests (against installed runtime, no daemon required) | |
| run: dotnet test PipeWire.NET.slnx --no-build -c Release | |
| --filter "TestCategory=Integration&TestCategory!=RequiresDaemon" | |
| - name: Daemon end-to-end tests (headless PipeWire + GStreamer real sources) | |
| run: | | |
| sudo apt-get install -y --no-install-recommends \ | |
| pipewire wireplumber pipewire-bin \ | |
| gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pipewire | |
| export XDG_RUNTIME_DIR="$(mktemp -d)" | |
| # Headless daemon: no systemd/login session needed. | |
| pipewire & PW_PID=$! | |
| wireplumber & WP_PID=$! | |
| # Wait for the graph to answer. | |
| for i in $(seq 1 40); do pw-cli info 0 >/dev/null 2>&1 && break; sleep 0.25; done | |
| set +e | |
| # RequiresGpu tests need a render node + GStreamer GL/VA; excluded on GPU-less CI runners. | |
| dotnet test PipeWire.NET.slnx --no-build -c Release \ | |
| --filter "TestCategory=RequiresDaemon&TestCategory!=RequiresGpu" | |
| RC=$? | |
| set -e | |
| kill $WP_PID $PW_PID 2>/dev/null || true | |
| exit $RC | |
| - name: Pack | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: dotnet pack src/Agash.PipeWire/Agash.PipeWire.csproj --no-build -c Release -o dist | |
| - name: Login to NuGet.org via OIDC | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: ${{ vars.NUGET_USER }} | |
| - name: Push to NuGet.org | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| dotnet nuget push dist/*.nupkg \ | |
| --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate |