Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Commit e9649e3

Browse files
committed
updated packages
1 parent dc2d734 commit e9649e3

File tree

4 files changed

+123
-4
lines changed

4 files changed

+123
-4
lines changed

.github/workflows/cicd.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Continuous Integration
2+
3+
on: push
4+
5+
env:
6+
Configuration: Release
7+
ContinuousIntegrationBuild: true
8+
DOTNET_CLI_TELEMETRY_OPTOUT: true
9+
DOTNET_NOLOGO: true
10+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
11+
12+
jobs:
13+
package:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
checks: write
17+
name: Run tests and create NuGet package
18+
outputs:
19+
coverage-reports: ${{ steps.dotnet-test.outputs.coverage-reports }}
20+
version: ${{ steps.dotnet-pack.outputs.version }}
21+
nupkg-filename: ${{ steps.dotnet-pack.outputs.nupkg-filename }}
22+
release-body: ${{ steps.tag-message.outputs.release-notes }}
23+
steps:
24+
- name: Checkout git repository
25+
uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install .NET SDK
30+
uses: actions/setup-dotnet@v1
31+
32+
- name: Retrieve cached NuGet packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ~/.nuget/packages
36+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
37+
38+
- name: Restore NuGet packages
39+
run: dotnet restore
40+
41+
- name: Build solution
42+
run: dotnet build
43+
44+
- name: Run tests
45+
run: dotnet test --no-build --logger "html;LogFileName=../../TestResults-${{ runner.os }}.html" --logger "trx;LogFileName=../../TestResults-${{ runner.os }}.trx" --logger GitHubActions
46+
id: dotnet-test
47+
48+
- name: Upload received files from failing tests
49+
uses: actions/upload-artifact@v2
50+
if: failure()
51+
with:
52+
name: Received-${{ runner.os }}
53+
path: "**/*.received.*"
54+
55+
- name: Upload test results
56+
uses: actions/upload-artifact@v2
57+
if: always()
58+
with:
59+
name: TestResults-${{ runner.os }}
60+
path: TestResults-${{ runner.os }}.html
61+
62+
- name: Test Report
63+
uses: dorny/test-reporter@v1
64+
if: always()
65+
with:
66+
name: Test Results (${{ runner.os }})
67+
path: TestResults-${{ runner.os }}.trx
68+
reporter: dotnet-trx
69+
70+
- name: Create NuGet package
71+
run: dotnet pack --no-build --output .
72+
id: dotnet-pack
73+
74+
# - name: Upload NuGet package artifact
75+
# if: matrix.os == 'macos-latest'
76+
# uses: actions/upload-artifact@v2
77+
# with:
78+
# name: ${{ steps.dotnet-pack.outputs.nupkg-filename }}
79+
# path: ${{ steps.dotnet-pack.outputs.nupkg-filename }}
80+
81+
- name: Retrieve tag message
82+
if: matrix.os == 'macos-latest'
83+
run: |
84+
git fetch --tags --force
85+
RELEASE_NOTES=$(git tag --list ${{ steps.dotnet-pack.outputs.version }} --format='%(contents)')
86+
RELEASE_NOTES="${RELEASE_NOTES//'%'/%25}"
87+
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/%0A}"
88+
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/%0D}"
89+
echo "::set-output name=release-notes::$RELEASE_NOTES"
90+
id: tag-message
91+
92+
publish:
93+
runs-on: ubuntu-latest
94+
needs: package
95+
if: startsWith(github.ref, 'refs/tags/')
96+
name: Publish NuGet package and create GitHub release
97+
steps:
98+
- name: Download NuGet package artifact
99+
uses: actions/download-artifact@v2
100+
with:
101+
name: ${{ needs.package.outputs.nupkg-filename }}
102+
103+
- name: Create GitHub Release
104+
uses: actions/create-release@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
tag_name: ${{ needs.package.outputs.version }}
109+
release_name: Version ${{ needs.package.outputs.version }}
110+
body: ${{ needs.package.outputs.release-body }}
111+
draft: false
112+
prerelease: ${{ contains(needs.package.outputs.version, '-') }}
113+
114+
- name: Publish NuGet package on nuget.org
115+
run: dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source https://api.nuget.org/v3/index.json --api-key "${{ secrets.NUGET_API_KEY }}"

test/Serilog.Sinks.Elasticsearch.IntegrationTests/Serilog.Sinks.Elasticsearch.IntegrationTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="xunit" Version="2.3.1" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
2020
<PackageReference Include="xunit.extensibility.execution" Version="2.3.1" />
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
2222
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.2.4" />
2323
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.2.4" />
2424
<PackageReference Include="FluentAssertions" Version="5.7.0" />

test/Serilog.Sinks.Elasticsearch.Tests/ElasticsearchPayloadReaderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void ElasticsearchPayloadReader_CannotUseRollingIntervalLessFrequentThanD
8080
rollingInterval);
8181

8282
// Assert
83-
act.ShouldThrow<ArgumentException>()
83+
act.Should().Throw<ArgumentException>()
8484
.WithMessage("Rolling intervals less frequent than RollingInterval.Day are not supported");
8585
}
8686
}

test/Serilog.Sinks.Elasticsearch.Tests/Serilog.Sinks.Elasticsearch.Tests.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@
5656

5757
<ItemGroup>
5858
<DotNetCliToolReference Include="dotnet-version" Version="1.1.2" />
59+
<PackageReference Include="GitHubActionsTestLogger" Version="1.4.1">
60+
<PrivateAssets>all</PrivateAssets>
61+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
62+
</PackageReference>
5963

60-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
64+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
6165
<PackageReference Include="Serilog.Sinks.ColoredConsole" Version="3.0.1" />
6266
<PackageReference Include="dotnet-test-nunit" Version="3.4.0-beta-3" />
6367
<PackageReference Include="xunit" Version="2.3.1" />
@@ -66,7 +70,7 @@
6670
<PackageReference Include="NEST" Version="7.8.1" />
6771
<PackageReference Include="NEST.JsonNetSerializer" Version="7.8.1" />
6872
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.2" />
69-
<PackageReference Include="FluentAssertions" Version="4.19.4" />
73+
<PackageReference Include="FluentAssertions" Version="5.7.0" />
7074
</ItemGroup>
7175

7276

0 commit comments

Comments
 (0)