From 2277b5b76005a02ad41cf9d2bcb4f1b8f2a814e3 Mon Sep 17 00:00:00 2001 From: Damian Hickey <57436+damianh@users.noreply.github.com> Date: Sat, 5 Oct 2024 12:30:01 +0200 Subject: [PATCH] Add a test report to the build --- .github/workflows/access-token-management-ci.yml | 15 +++++++++++++-- access-token-management/build/Program.cs | 10 +++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/access-token-management-ci.yml b/.github/workflows/access-token-management-ci.yml index d8a6f654..bf311025 100644 --- a/.github/workflows/access-token-management-ci.yml +++ b/.github/workflows/access-token-management-ci.yml @@ -39,6 +39,17 @@ jobs: dotnet-version: | 8.0.x - - name: Build and test + - name: Build and Test shell: pwsh - run: ./build.ps1 \ No newline at end of file + run: ./build.ps1 + + - name: Test Report + id: test-report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: Test results + path: artifacts/test-results/*.trx + reporter: dotnet-trx + fail-on-error: true + fail-on-empty: true \ No newline at end of file diff --git a/access-token-management/build/Program.cs b/access-token-management/build/Program.cs index 943d6877..1df7f9ae 100644 --- a/access-token-management/build/Program.cs +++ b/access-token-management/build/Program.cs @@ -43,7 +43,11 @@ internal static async Task Main(string[] args) Target(Targets.Test, DependsOn(Targets.Build), () => { - Run("dotnet", "test -c Release --no-build --nologo"); + Run("dotnet", + $"test test/Tests -c Release --nologo " + + $"--blame-hang " + + $"--blame-hang-timeout=120sec " + + $"--logger \"console;verbosity=normal\" --logger \"trx;LogFileName=Test.trx\""); }); Target(Targets.CleanPackOutput, () => @@ -56,8 +60,8 @@ internal static async Task Main(string[] args) Target(Targets.Pack, DependsOn(Targets.Build, Targets.CleanPackOutput), () => { - Run("dotnet", $"pack ./src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo"); - Run("dotnet", $"pack ./src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo"); + Run("dotnet", $"pack src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo"); + Run("dotnet", $"pack src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo"); }); Target(Targets.SignPackage, DependsOn(Targets.Pack, Targets.RestoreTools), () =>