Skip to content

Commit

Permalink
Attempt to enable tests that use audio devices on CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
tombogle committed Nov 19, 2024
1 parent 4901250 commit 20e6220
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,39 @@ jobs:

- name: Get Path to Tests
run: echo "TEST_PATH=$(dotnet msbuild SIL.Core.Tests/ --getProperty:OutputPath -p:TargetFramework=${{ matrix.framework }} -p:Configuration=Release)" >> $GITHUB_ENV


# Several steps to set up FFmpeg and Scream and start Audio Service so that audio tests can run
- name: Install FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
with:
ffmpeg-version: release
- run: echo ffmpeg path ${{ steps.setup-ffmpeg.outputs.ffmpeg-path }}

- name: Install Scream on Windows
shell: powershell
run: |
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/4.0/Scream4.0.zip -OutFile Scream4.0.zip
Expand-Archive -Path Scream4.0.zip -DestinationPath Scream
openssl req -batch -verbose -x509 -newkey rsa -keyout ScreamCertificate.pvk -out ScreamCertificate.cer -nodes -extensions v3_req
openssl pkcs12 -export -nodes -in ScreamCertificate.cer -inkey ScreamCertificate.pvk -out ScreamCertificate.pfx -passout pass:
- name: Setup MSVC Dev Cmd
uses: ilammy/msvc-dev-cmd@v1

- name: Sign and Install Scream Driver on Windows
if: matrix.os == 'windows-latest'
shell: powershell
run: |
signtool sign /v /fd SHA256 /f ScreamCertificate.pfx Scream\Install\driver\x64\Scream.cat
Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\root
Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream
timeout-minutes: 5

- name: Start Windows Audio Service
run: net start audiosrv
shell: powershell

# there are cases where this will fail and we want to know about it
# so we don't use continue-on-error, but we still want to publish the results
Expand Down
1 change: 0 additions & 1 deletion SIL.Media.Tests/AudioFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace SIL.Media.Tests
{
// These will not work if a speaker is not available.
[TestFixture]
[Category("SkipOnTeamCity")]
[Category("AudioTests")]
public class AudioFactoryTests
{
Expand Down
1 change: 0 additions & 1 deletion SIL.Media.Tests/AudioRecorderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace SIL.Media.Tests
// Some of these tests require a speaker. Others require a microphone.
// None of them will work if neither a speaker nor a microphone is available.
[TestFixture]
[Category("SkipOnTeamCity")]
[Category("AudioTests")]
public class AudioRecorderTests
{
Expand Down
1 change: 0 additions & 1 deletion SIL.Media.Tests/AudioSessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace SIL.Media.Tests
// Some of these tests require a speaker. Others require a microphone.
// None of them will work if neither a speaker nor a microphone is available.
[TestFixture]
[NUnit.Framework.Category("SkipOnTeamCity")]
[NUnit.Framework.Category("AudioTests")]
public class AudioSessionTests
{
Expand Down

0 comments on commit 20e6220

Please sign in to comment.