Skip to content

Commit

Permalink
Add GitHubActionsTestLogger (#72)
Browse files Browse the repository at this point in the history
* Add GitHubActionsTestLogger

* Fix #71
  • Loading branch information
alexaka1 authored Aug 22, 2024
1 parent 7864277 commit 779be2b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 83 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-brooms-look.md
Original file line number Diff line number Diff line change
@@ -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
29 changes: 0 additions & 29 deletions .github/workflows/test-report.yml

This file was deleted.

63 changes: 12 additions & 51 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Tests
on:
pull_request:
paths-ignore:
Expand All @@ -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
Expand Down Expand Up @@ -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
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0"/>
<PackageReference Include="Moq" Version="4.20.70"/>
<PackageReference Include="Serilog.Expressions" Version="5.0.0"/>
Expand Down
9 changes: 9 additions & 0 deletions test/Serilog.Extensions.Formatting.Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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, )",
Expand Down

0 comments on commit 779be2b

Please sign in to comment.