Skip to content

Commit

Permalink
Added test reporter (#303)
Browse files Browse the repository at this point in the history
* Added test reporter

* try again, yaml sucks

* wip

* Experiment

* Added task to upload trx results
  • Loading branch information
sandrohanea authored Dec 20, 2024
1 parent dca380d commit b456f6e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
description: 'Enable GPU libraries build and publish'
required: true
default: 'false'
permissions:
contents: read
checks: write

jobs:
android:
uses: ./.github/workflows/android-native-build.yml
Expand Down
56 changes: 53 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ name: Dotnet Build and Test

on:
workflow_call:

permissions:
contents: read
checks: write

jobs:
dotnet-macos:
Expand Down Expand Up @@ -35,7 +39,22 @@ jobs:

- name: Test
run: |
dotnet test ./Whisper.net.sln --no-build
dotnet test ./Whisper.net.sln --no-build --logger "trx"
- name: Test Reporter
uses: dorny/test-reporter@v1.9.1
if: success() || failure() # run this step even if previous step failed
with:
name: Whisper.net MacOs Test Results
path: ./**/*.trx
reporter: dotnet-trx

- name: Upload trx files
uses: actions/upload-artifact@v4
with:
name: test-results-macos
path: ./**/*.trx
retention-days: 7

dotnet-windows:
runs-on: windows-latest
Expand Down Expand Up @@ -65,8 +84,23 @@ jobs:

- name: Test
run: |
dotnet test ./Whisper.net.sln --no-build
dotnet test ./Whisper.net.sln --no-build --logger "trx"
- name: Test Reporter
uses: dorny/test-reporter@v1.9.1
if: success() || failure() # run this step even if previous step failed
with:
name: Whisper.net Windows Test Results
path: ./**/*.trx
reporter: dotnet-trx

- name: Upload trx files
uses: actions/upload-artifact@v4
with:
name: test-results-windows
path: ./**/*.trx
retention-days: 7

dotnet-linux:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -95,4 +129,20 @@ jobs:

- name: Test
run: |
dotnet test ./Whisper.net.sln --no-build
dotnet test ./Whisper.net.sln --no-build --logger "trx"
- name: Test Reporter
uses: dorny/test-reporter@v1.9.1
if: success() || failure() # run this step even if previous step failed
with:
name: Whisper.net Linux Test Results
path: ./**/*.trx
reporter: dotnet-trx

- name: Upload trx files
uses: actions/upload-artifact@v4
with:
name: test-results-linux
path: ./**/*.trx
retention-days: 7

18 changes: 16 additions & 2 deletions tests/Whisper.net.Tests/FactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@
using FluentAssertions;
using Whisper.net.Logger;
using Xunit;
using Xunit.Abstractions;

namespace Whisper.net.Tests;

public class FactoryTests : IClassFixture<TinyModelFixture>
public class FactoryTests : IClassFixture<TinyModelFixture>, IDisposable
{
private readonly TinyModelFixture model;
private readonly ITestOutputHelper output;

public FactoryTests(TinyModelFixture model)
public FactoryTests(TinyModelFixture model, ITestOutputHelper output)
{
LogProvider.AddConsoleLogging(minLevel: WhisperLogLevel.Debug);
LogProvider.Instance.OnLog += Instance_OnLog;
this.model = model;
this.output = output;
}

public void Dispose()
{
LogProvider.Instance.OnLog -= Instance_OnLog;
}

private void Instance_OnLog(WhisperLogLevel arg1, string? arg2)
{
output.WriteLine($"[Whisper.net] {arg1}: {arg2}");

Check failure on line 29 in tests/Whisper.net.Tests/FactoryTests.cs

View workflow job for this annotation

GitHub Actions / Whisper.net Windows Test Results

Whisper.net.Tests.ProcessQuantizedTests ► TestHappyFlowQuantized

Failed test found in: tests/Whisper.net.Tests/TestResults/runneradmin_fv-az1489-151_2024-12-20_22_17_49.trx Error: System.InvalidOperationException : There is no currently active test.
Raw output
System.InvalidOperationException : There is no currently active test.
   at Whisper.net.Tests.FactoryTests.Instance_OnLog(WhisperLogLevel arg1, String arg2) in D:\a\whisper.net\whisper.net\tests\Whisper.net.Tests\FactoryTests.cs:line 29
   at Whisper.net.Logger.LogProvider.Log(WhisperLogLevel level, String message) in D:\a\whisper.net\whisper.net\Whisper.net\Logger\LogProvider.cs:line 75
   at Whisper.net.Logger.LogProvider.LogUnmanaged(GgmlLogLevel level, IntPtr message, IntPtr user_data) in D:\a\whisper.net\whisper.net\Whisper.net\Logger\LogProvider.cs:line 70
   at Whisper.net.WhisperProcessor.GetWhisperState() in D:\a\whisper.net\whisper.net\Whisper.net\WhisperProcessor.cs:line 343
   at Whisper.net.WhisperProcessor.Process(ReadOnlySpan`1 samples) in D:\a\whisper.net\whisper.net\Whisper.net\WhisperProcessor.cs:line 172
   at Whisper.net.WhisperProcessor.Process(Single[] samples) in D:\a\whisper.net\whisper.net\Whisper.net\WhisperProcessor.cs:line 154
   at Whisper.net.WhisperProcessor.Process(Stream waveStream) in D:\a\whisper.net\whisper.net\Whisper.net\WhisperProcessor.cs:line 145
   at Whisper.net.Tests.ProcessQuantizedTests.TestHappyFlowQuantized() in D:\a\whisper.net\whisper.net\tests\Whisper.net.Tests\ProcessQuantizedTests.cs:line 29
--- End of stack trace from previous location ---
}

[Fact]
Expand Down

0 comments on commit b456f6e

Please sign in to comment.