From af89ee3516f6d0bd8bae938262f8ff4014640f28 Mon Sep 17 00:00:00 2001 From: martincostello Date: Fri, 18 Apr 2025 14:59:53 +0100 Subject: [PATCH] Add test analytics Use Codecov's test analytics feature. --- .github/workflows/build.yml | 13 ++++++++++--- .gitignore | 1 + Directory.Packages.props | 1 + build.ps1 | 6 +++--- .../MartinCostello.Logging.XUnit.Tests.csproj | 1 + .../MartinCostello.Logging.XUnit.v3.Tests.csproj | 1 + 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6390822d..7d4f4050 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: false - matrix: + matrix: include: - os-name: macos runner: macos-latest @@ -67,8 +67,15 @@ jobs: shell: pwsh run: ./build.ps1 - - uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2 - name: Upload coverage to Codecov + - name: Upload coverage to Codecov + uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2 + with: + flags: ${{ matrix.os-name }} + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload test results to Codecov + uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 # v1.1.0 + if: ${{ !cancelled() }} with: flags: ${{ matrix.os-name }} token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index ee3b5eed..b308157a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ bin Bin coverage coverage.* +junit.xml MSBuild_Logs/ obj packages diff --git a/Directory.Packages.props b/Directory.Packages.props index 238962bd..a947299e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,6 +7,7 @@ + diff --git a/build.ps1 b/build.ps1 index 93031c12..3e80cfc1 100755 --- a/build.ps1 +++ b/build.ps1 @@ -89,9 +89,9 @@ function DotNetTest { $additionalArgs = @() - if (![string]::IsNullOrEmpty($env:GITHUB_SHA)) { - $additionalArgs += "--logger" - $additionalArgs += "GitHubActions;report-warnings=false" + if (-Not [string]::IsNullOrEmpty($env:GITHUB_SHA)) { + $additionalArgs += "--logger:GitHubActions;report-warnings=false" + $additionalArgs += "--logger:junit;LogFilePath=junit.xml" } & $dotnet test --configuration "Release" $additionalArgs diff --git a/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj b/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj index 7d0626d1..e77f31c6 100644 --- a/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj +++ b/tests/Logging.XUnit.Tests/MartinCostello.Logging.XUnit.Tests.csproj @@ -18,6 +18,7 @@ + diff --git a/tests/Logging.XUnit.v3.Tests/MartinCostello.Logging.XUnit.v3.Tests.csproj b/tests/Logging.XUnit.v3.Tests/MartinCostello.Logging.XUnit.v3.Tests.csproj index c2aa5684..fc3ae2c8 100644 --- a/tests/Logging.XUnit.v3.Tests/MartinCostello.Logging.XUnit.v3.Tests.csproj +++ b/tests/Logging.XUnit.v3.Tests/MartinCostello.Logging.XUnit.v3.Tests.csproj @@ -20,6 +20,7 @@ +