Skip to content

Commit

Permalink
Merge pull request #596 from serilog-mssql/dev
Browse files Browse the repository at this point in the history
Release 8.0.0
  • Loading branch information
ckadluba authored Nov 5, 2024
2 parents bce0e59 + 73ef762 commit 2d9f79d
Show file tree
Hide file tree
Showing 21 changed files with 209 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/perftests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4

- name: Run build
run: ./Build.ps1 -SkipTests
run: ./Build.ps1 -SkipTests -SkipSamples
shell: pwsh

- name: Run performance tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-analysis-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build-and-codeql:
runs-on: ubuntu-latest
runs-on: windows-latest
permissions:
actions: read
contents: read
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# Run every biweekly to discover failures due to environment changes
schedule:
- cron: '0 0 1,15 * *'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -24,8 +24,8 @@ jobs:
- name: Upload binaries artifact for InferSharp job
uses: actions/upload-artifact@v4
with:
name: bin-net6
path: src\Serilog.Sinks.MSSqlServer\bin\Release\net6.0
name: bin
path: src\Serilog.Sinks.MSSqlServer\bin\Release\net8.0

- name: Upload testresults artifact with code coverage file
uses: actions/upload-artifact@v4
Expand All @@ -44,13 +44,13 @@ jobs:
- name: Download binaries artifact
uses: actions/download-artifact@v4
with:
name: bin-net6
path: bin-net6
name: bin
path: bin

- name: Run Infer#
uses: microsoft/[email protected]
with:
binary-path: bin-net6
binary-path: bin

- name: Upload SARIF output to GitHub Security Center
uses: github/codeql-action/upload-sarif@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
shell: pwsh

- name: Run build
run: ./Build.ps1 -SkipTests
run: ./Build.ps1 -SkipTests -SkipSamples
shell: pwsh

- name: Run performance tests
Expand Down
160 changes: 117 additions & 43 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,135 @@
param (
[Parameter(Mandatory = $false)]
[Switch]
$SkipTests
)

echo "build: Build started"

Push-Location "$PSScriptRoot"

if (Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}

& dotnet restore --no-cache
$SkipTests,

$branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL]
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL]
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10, $branch.Length)))-$revision" }[$branch -ne "dev" -and $revision -ne "local"]
[Parameter(Mandatory = $false)]
[Switch]
$SkipPerfTests,

echo "build: Version suffix is $suffix"
[Parameter(Mandatory = $false)]
[Switch]
$SkipSamples
)

foreach ($src in Get-ChildItem "$PSScriptRoot/src" -Directory) {
Push-Location $src.FullName
echo "build: Build started"

echo "build: Packaging project in $($src.FullName)"
try
{
Push-Location "$PSScriptRoot"

if ($suffix) {
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
} else {
& dotnet pack -c Release -o ..\..\artifacts
if (Test-Path .\artifacts)
{
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
if ($LASTEXITCODE -ne 0) { exit 1 }

Pop-Location
}

if ($SkipTests -eq $false) {
foreach ($test in Get-ChildItem "$PSScriptRoot/test" -Filter "*.Tests" -Directory) {
Push-Location $test.FullName

echo "build: Testing project in $($test.FullName)"

& dotnet test -c Release --collect "XPlat Code Coverage"
if ($LASTEXITCODE -ne 0) { exit 3 }
echo "build: Restoring packages for solution"
& dotnet restore --no-cache
if ($LASTEXITCODE -ne 0)
{
echo "Error returned by dotnet restore. Aborting build."
exit 1
}

$branch = @{ $true = $env:GITHUB_REF_NAME; $false = $( git symbolic-ref --short -q HEAD ) }[$env:GITHUB_REF_NAME -ne $NULL]
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL]
$suffix = @{ $true = ""; $false = "$($branch.Substring(0,[math]::Min(10, $branch.Length)) )-$revision" }[$branch -ne "dev" -and $revision -ne "local"]

echo "build: Version suffix is $suffix"

$sinkProjectPath = "$PSScriptRoot/src/Serilog.Sinks.MSSqlServer"
try
{
Push-Location "$sinkProjectPath"

echo "build: Packaging sink main project in $sinkProjectPath"
if ($suffix)
{
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
}
else
{
& dotnet pack -c Release -o ..\..\artifacts
}
if ($LASTEXITCODE -ne 0)
{
echo "Error returned by dotnet pack. Aborting build."
exit 1
}
}
finally
{
Pop-Location
}

# The performance benchmark tests should at least build without errors during PR validation
$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
Push-Location "$perfTestProjectPath"
if ($SkipTests -eq $false)
{
$testProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.Tests"
try
{
Push-Location "$testProjectPath"

echo "build: Testing project in $testProjectPath"
& dotnet test -c Release --collect "XPlat Code Coverage"
if ($LASTEXITCODE -ne 0)
{
exit 2
}

}
finally
{
Pop-Location
}
}

if ($SkipPerfTests -eq $false)
{
# The performance benchmark tests should at least build without errors during PR validation
$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
try
{
Push-Location "$perfTestProjectPath"

echo "build: Building performance test project in $perfTestProjectPath"
& dotnet build -c Release
if ($LASTEXITCODE -ne 0)
{
exit 3
}
}
finally
{
Pop-Location
}
}

echo "build: Building performance test project in $perfTestProjectPath"
& dotnet build -c Release
if ($SkipSamples -eq $false)
{
foreach ($src in Get-ChildItem "$PSScriptRoot/sample/*.csproj" -File -Recurse)
{
try
{
Push-Location $src.DirectoryName

echo "build: Building sample project $( $src.FullName )"
& dotnet build -c Release -o ..\..\artifacts
if ($LASTEXITCODE -ne 0)
{
echo "Error returned by dotnet build. Aborting build."
exit 4
}
}
finally
{
Pop-Location
}
}
}

}
finally
{
Pop-Location
}

Pop-Location
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 8.0.0
* Updated to .NET 8
* Updated nearly all dependencies
* Improved build script (build samples, fail on vulns, ...)
* Removed some obsolete vulnerability fix dependencies
* Fixed missing dependency in AppConfigDemo sample

# 7.0.2
* Fixed issue #580: Removed deprecated transitive dependency on Microsoft.NETCore.Targets by removing runtime identifier (thanks to @david-brink-talogy)
* Fixed issues #540 and #541 in README
Expand Down
30 changes: 14 additions & 16 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.6" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="FluentAssertions" Version="6.7.0" />
<PackageVersion Include="Dapper.StrongName" Version="2.0.123" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="Dapper.StrongName" Version="2.1.35" />
<PackageVersion Include="Moq" Version="4.18.2" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Serilog" Version="4.0.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="8.0.4" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ Because of the way external configuration has been implemented in various .NET f
| .NET Framework 4.6.2+ | `net462` | app or library | _System.Configuration_ |
| .NET Framework 4.6.2+ | `net462` | app or library | _Microsoft.Extensions.Configuration_ |
| .NET Standard 2.0 | `netstandard2.0` | library only | _Microsoft.Extensions.Configuration_ |
| .NET 6.0+ | `net6.0` | app or library | _System.Configuration_ |
| .NET 6.0+ | `net6.0` | app or library | _Microsoft.Extensions.Configuration_ |
| .NET 8.0+ | `net8.0` | app or library | _System.Configuration_ |
| .NET 8.0+ | `net8.0` | app or library | _Microsoft.Extensions.Configuration_ |

Although it's possible to use both XML and _M.E.C_ configuration with certain frameworks, this is not supported, unintended consequences are possible, and a warning will be emitted to `SelfLog`. If you actually require multiple configuration sources, the _M.E.C_ builder-pattern is designed to support this, and your syntax will be consistent across configuration sources.

Expand Down
41 changes: 27 additions & 14 deletions RunPerfTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,37 @@ param (

echo "perf: Performance tests started with Filter = $Filter"

Push-Location $PSScriptRoot
try
{
Push-Location $PSScriptRoot

$artifactsPath = "$PSScriptRoot\artifacts\perftests"
$artifactsPath = "$PSScriptRoot\artifacts\perftests"

if (Test-Path "$artifactsPath") {
echo "perf: Cleaning $artifactsPath"
Remove-Item "$artifactsPath" -Force -Recurse
}
if (Test-Path "$artifactsPath")
{
echo "perf: Cleaning $artifactsPath"
Remove-Item "$artifactsPath" -Force -Recurse
}

New-Item -Path "$artifactsPath" -ItemType Directory
New-Item -Path "$artifactsPath" -ItemType Directory

$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
Push-Location "$perfTestProjectPath"
$perfTestProjectPath = "$PSScriptRoot/test/Serilog.Sinks.MSSqlServer.PerformanceTests"
try
{
Push-Location "$perfTestProjectPath"

echo "perf: Running performance test project in $perfTestProjectPath"
& dotnet run -c Release -- -f $Filter
echo "perf: Running performance test project in $perfTestProjectPath"
& dotnet run -c Release -- -f $Filter

cp ".\BenchmarkDotNet.Artifacts\results\*.*" "$artifactsPath\"
Pop-Location
cp ".\BenchmarkDotNet.Artifacts\results\*.*" "$artifactsPath\"
}
finally
{
Pop-Location
}

Pop-Location
}
finally
{
Pop-Location
}
5 changes: 4 additions & 1 deletion sample/AppConfigDemo/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<BatchPostingLimit Value="13" />
<BatchPeriod Value="00:00:15" />
<EagerlyEmitFirstEvent Value="true" />


<AutoCreateSqlDatabase Value="true" />
<AutoCreateSqlTable Value="true" />

<AddStandardColumns>
<add Name="LogEvent" />
</AddStandardColumns>
Expand Down
Loading

0 comments on commit 2d9f79d

Please sign in to comment.