name: Device tests
on:
push:
branches:
- master
paths-ignore: &paths
- "**.md"
- LICENSE.txt
pull_request:
paths-ignore: *paths
schedule:
- cron: "27 4 * * *"
workflow_dispatch:
inputs:
filter:
description: Only run tests whose name contains this
required: false
default: ""
log:
description: Library log level (off, error, warn, info, debug, trace)
required: false
default: "off"
concurrency:
group: device-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
device:
runs-on: windows-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: windows-stable
- name: Build the device tests
run: cargo test --features device-tests --test device --no-run
- name: Start the audio service
run: |
Set-Service audiosrv -StartupType Automatic
Start-Service audiosrv
Get-Service audiosrv, AudioEndpointBuilder | Format-Table -AutoSize
- name: Allow microphone access
run: |
$key = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy'
New-Item -Path $key -Force | Out-Null
Set-ItemProperty -Path $key -Name LetAppsAccessMicrophone -Type DWord -Value 1
- name: Install VB-Cable
run: .github\scripts\install_vbcable.ps1
- name: List audio endpoints
run: Get-PnpDevice -Class AudioEndpoint | Format-Table -AutoSize Status, FriendlyName
- name: Run the device tests
env:
WASAPI_REQUIRE_DEVICE: 1
WASAPI_TEST_LOG: ${{ github.event.inputs.log || 'off' }}
run: >
cargo test --features device-tests --test device --
--test-threads=1 --nocapture ${{ github.event.inputs.filter }}
- name: Diagnostics
if: ${{ failure() }}
run: |
Get-Service audiosrv, AudioEndpointBuilder | Format-List
Get-PnpDevice -Class AudioEndpoint, MEDIA | Format-List Status, Class, FriendlyName, InstanceId
pnputil /enum-drivers