From 779be2bcca899a323dc8af2956c6e246e5011040 Mon Sep 17 00:00:00 2001 From: Alex Martossy Date: Thu, 22 Aug 2024 21:08:49 +0200 Subject: [PATCH] Add GitHubActionsTestLogger (#72) * Add GitHubActionsTestLogger * Fix #71 --- .changeset/long-brooms-look.md | 5 ++ .github/workflows/test-report.yml | 29 --------- .github/workflows/tests.yml | 63 ++++--------------- README.md | 3 - .../Serilog.Extensions.Formatting.Test.csproj | 4 ++ .../packages.lock.json | 9 +++ 6 files changed, 30 insertions(+), 83 deletions(-) create mode 100644 .changeset/long-brooms-look.md delete mode 100644 .github/workflows/test-report.yml diff --git a/.changeset/long-brooms-look.md b/.changeset/long-brooms-look.md new file mode 100644 index 0000000..7b5b2eb --- /dev/null +++ b/.changeset/long-brooms-look.md @@ -0,0 +1,5 @@ +--- +"alexaka1.serilog.extensions.formatting": patch +--- + +Fix incorrect readme statement on Renderings not being supported. It is supported since 0.2.0 diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml deleted file mode 100644 index 876b020..0000000 --- a/.github/workflows/test-report.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: 'Test Report' -on: - workflow_run: - workflows: [ 'CI' ] - types: - - completed -permissions: { } -jobs: - report: - runs-on: ubuntu-latest - permissions: - contents: read - actions: read - checks: write - steps: - - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 - with: - disable-sudo: true - egress-policy: block - allowed-endpoints: > - api.github.com:443 - - uses: dorny/test-reporter@9098107e2aa7ed7d1150f776ddea55f55c80016b # v1 - name: Upload dotnet test results summary - with: - artifact: /dotnet-(.*)-tests-on-(.*)/ - name: 'dotnet-$1-tests-on-$2' - path: '*.trx' - reporter: dotnet-trx diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50725b6..e386bfc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: CI +name: Tests on: pull_request: paths-ignore: @@ -9,15 +9,13 @@ permissions: { } jobs: test: name: Tests - continue-on-error: true strategy: + fail-fast: false matrix: os: - ubuntu-latest - windows-latest - macos-latest - dotnet: - - 8.0.x runs-on: ${{ matrix.os }} permissions: contents: read @@ -54,58 +52,21 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: persist-credentials: false - - name: Setup Dotnet ${{ matrix.dotnet }} + - name: Setup Dotnet id: dotnet-setup uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 with: - dotnet-version: ${{ matrix.dotnet }} + dotnet-version: | + 8.0.x - name: Dotnet restore run: dotnet restore - name: Dotnet build run: dotnet build --configuration Release --no-restore - name: Test with dotnet - continue-on-error: true - run: dotnet test --configuration Release --no-restore --logger "trx;LogFileName=test-results.trx" --results-directory "TestResults" - - name: Upload dotnet test results artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 - with: - name: dotnet-${{ steps.dotnet-setup.outputs.dotnet-version }}-tests-on-${{ matrix.os }} - path: TestResults - if: ${{ always() }} - test-check: - name: Fail if tests failed - runs-on: ubuntu-latest - needs: - - test - if: ${{ always() }} - steps: - - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 - with: - disable-sudo: true - egress-policy: block - allowed-endpoints: > - github.com:443 - results-receiver.actions.githubusercontent.com:443 - *.blob.core.windows.net:443 - api.github.com:443 - *.actions.githubusercontent.com:443 - codeload.github.com:443 - ghcr.io:443 - *.actions.githubusercontent.com:443 - objects.githubusercontent.com:443 - objects-origin.githubusercontent.com:443 - github-releases.githubusercontent.com:443 - github-registry-files.githubusercontent.com:443 - *.actions.githubusercontent.com:443 - - name: Check for failed tests - run: | - echo "::debug::Checking for failed tests..." - echo "::debug::Job result: ${{ needs.test.result }}" - for job in "${{ needs.test.result }}"; do - if [[ "$job" == "failure" ]]; then - echo "::error Some matrix jobs failed." - exit 1 - fi - done - echo "All tests succeeded." + run: > + dotnet test + --configuration Release + --no-restore + --logger "GitHubActions;summary.includeSkippedTests=true" + -- + RunConfiguration.CollectSourceInformation=true diff --git a/README.md b/README.md index 40d3e5b..daaf49f 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,6 @@ A simple JSON formatter for Serilog that uses the `System.Text.Json.Utf8JsonWriter` to write the log events to the output stream. -> [!IMPORTANT] -> This formatter currently does not support the `Renderings` property of Serilog. - ### Usage ```csharp diff --git a/test/Serilog.Extensions.Formatting.Test/Serilog.Extensions.Formatting.Test.csproj b/test/Serilog.Extensions.Formatting.Test/Serilog.Extensions.Formatting.Test.csproj index 499c908..94852ce 100644 --- a/test/Serilog.Extensions.Formatting.Test/Serilog.Extensions.Formatting.Test.csproj +++ b/test/Serilog.Extensions.Formatting.Test/Serilog.Extensions.Formatting.Test.csproj @@ -12,6 +12,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Serilog.Extensions.Formatting.Test/packages.lock.json b/test/Serilog.Extensions.Formatting.Test/packages.lock.json index c3c3cd8..f5f61b4 100644 --- a/test/Serilog.Extensions.Formatting.Test/packages.lock.json +++ b/test/Serilog.Extensions.Formatting.Test/packages.lock.json @@ -8,6 +8,15 @@ "resolved": "6.0.2", "contentHash": "bJShQ6uWRTQ100ZeyiMqcFlhP7WJ+bCuabUs885dJiBEzMsJMSFr7BOyeCw4rgvQokteGi5rKQTlkhfQPUXg2A==" }, + "GitHubActionsTestLogger": { + "type": "Direct", + "requested": "[2.4.1, )", + "resolved": "2.4.1", + "contentHash": "SH1ar/kg36CggzMqLUDRoUqR8SSjK/JiQ2JS8MYg8u0RCLDkkDEbPGIN91omOPx9f2GuDqsxxofSdgsQje3Xuw==", + "dependencies": { + "Microsoft.TestPlatform.ObjectModel": "17.10.0" + } + }, "Microsoft.NET.Test.Sdk": { "type": "Direct", "requested": "[17.11.0, )",