Skip to content

Commit 09c22a9

Browse files
authored
Merge pull request #54 from datalust/dev
4.0.0 Release
2 parents 20fa3e6 + 84cc215 commit 09c22a9

16 files changed

Lines changed: 149 additions & 67 deletions

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# If this file is renamed, the incrementing run attempt number will be reset.
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: [ "dev", "main" ]
8+
pull_request:
9+
branches: [ "dev", "main" ]
10+
11+
env:
12+
CI_BUILD_NUMBER_BASE: ${{ github.run_number }}
13+
CI_TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
14+
15+
jobs:
16+
build:
17+
18+
runs-on: windows-latest
19+
20+
permissions:
21+
contents: write
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Setup
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: 10.0.x
29+
- name: Compute build number
30+
shell: bash
31+
run: |
32+
echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+2300))" >> $GITHUB_ENV
33+
- name: Build and Publish
34+
env:
35+
DOTNET_CLI_TELEMETRY_OPTOUT: true
36+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
shell: pwsh
39+
run: |
40+
./Build.ps1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ Backup*/
111111
UpgradeLog*.XML
112112
*.orig
113113
/.vs
114+
115+
artifacts/
116+
*.nupkg
117+

Build.ps1

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,81 @@
1-
# This script originally (c) 2016 Serilog Contributors - license Apache 2.0
1+
Write-Output "build: Tool versions follow"
22

3-
echo "build: Build started"
3+
dotnet --version
4+
dotnet --list-sdks
5+
6+
Write-Output "build: Build started"
47

58
Push-Location $PSScriptRoot
9+
try {
10+
if(Test-Path .\artifacts) {
11+
Write-Output "build: Cleaning ./artifacts"
12+
Remove-Item ./artifacts -Force -Recurse
13+
}
614

7-
if(Test-Path .\artifacts) {
8-
echo "build: Cleaning .\artifacts"
9-
Remove-Item .\artifacts -Force -Recurse
10-
}
15+
& dotnet restore --no-cache
1116

12-
& dotnet restore --no-cache
17+
$dbp = [Xml] (Get-Content .\Directory.Version.props)
18+
$versionPrefix = $dbp.Project.PropertyGroup.VersionPrefix
1319

14-
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
15-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
16-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
20+
Write-Output "build: Package version prefix is $versionPrefix"
1721

18-
echo "build: Version suffix is $suffix"
22+
$branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH];
23+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER];
24+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "main" -and $revision -ne "local"]
25+
$commitHash = $(git rev-parse --short HEAD)
26+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
1927

20-
foreach ($src in ls src/*) {
21-
Push-Location $src
28+
Write-Output "build: Package version suffix is $suffix"
29+
Write-Output "build: Build version suffix is $buildSuffix"
2230

23-
echo "build: Packaging project in $src"
31+
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
32+
if($LASTEXITCODE -ne 0) { throw "Build failed" }
2433

25-
if ($suffix) {
26-
& dotnet pack -c Release -o ..\..\artifacts --include-source --version-suffix=$suffix
27-
} else {
28-
& dotnet pack -c Release -o ..\..\artifacts --include-source
29-
}
30-
if($LASTEXITCODE -ne 0) { exit 1 }
34+
foreach ($src in Get-ChildItem src/*) {
35+
Push-Location $src
3136

32-
Pop-Location
33-
}
37+
Write-Output "build: Packaging project in $src"
38+
39+
if ($suffix) {
40+
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts --version-suffix=$suffix
41+
} else {
42+
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts
43+
}
44+
if($LASTEXITCODE -ne 0) { throw "Packaging failed" }
3445

35-
foreach ($test in ls test/*.Tests) {
36-
Push-Location $test
46+
Pop-Location
47+
}
3748

38-
echo "build: Testing project in $test"
49+
if(Test-Path .\test) {
50+
foreach ($test in Get-ChildItem test/*.Tests) {
51+
Push-Location $test
52+
53+
Write-Output "build: Testing project in $test"
54+
55+
& dotnet test -c Release
56+
if($LASTEXITCODE -ne 0) { throw "Testing failed" }
57+
58+
Pop-Location
59+
}
60+
}
3961

40-
& dotnet test -c Release
41-
if($LASTEXITCODE -ne 0) { exit 3 }
62+
if ($env:NUGET_API_KEY) {
63+
# GitHub Actions will only supply this to branch builds and not PRs. We publish
64+
# builds from any branch this action targets (i.e. main and dev).
4265

66+
Write-Output "build: Publishing NuGet packages"
67+
68+
foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) {
69+
& dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg"
70+
if($LASTEXITCODE -ne 0) { throw "Publishing failed" }
71+
}
72+
73+
if (!($suffix)) {
74+
Write-Output "build: Creating release for version $versionPrefix"
75+
76+
iex "gh release create v$versionPrefix --title v$versionPrefix --generate-notes $(get-item ./artifacts/*.nupkg) $(get-item ./artifacts/*.snupkg)"
77+
}
78+
}
79+
} finally {
4380
Pop-Location
4481
}
45-
46-
Pop-Location

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="$(MSBuildThisFileDirectory)Directory.Version.props" />
3+
</Project>

Directory.Version.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<VersionPrefix>4.0.0</VersionPrefix>
4+
</PropertyGroup>
5+
</Project>

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# Seq.Client.Log4Net [![Build status](https://ci.appveyor.com/api/projects/status/sxw4n1a6v9o7db2i?svg=true)](https://ci.appveyor.com/project/datalust/seq-client-log4net)
1+
# Seq.Client.Log4Net
22

33
An Apache log4net appender that writes events to Seq.
44

5+
> [!IMPORTANT]
6+
>
7+
> Like much of the log4net ecosystem, Seq's support for log4net is in maintenance mode.
8+
>
9+
> Seq works best with richly-structured event data like that produced by [Serilog](https://serilog.net), [ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x) and [NLog](http://nlog-project.org). These libraries are actively developed and have up-to-date support for modern application requirements.
10+
511
### Getting started
612

7-
The Seq appender for log4net supports both .NET Framework 4.0+, and .NET Core via .NET Standard 2.0.
13+
The Seq appender for log4net supports .NET Framework 4.6.2+, and modern .NET via .NET Standard 2.0. For earlier .NET versions, use the 3.x series of _Seq.Client.Log4Net_ releases.
814

915
To install _Seq.Client.Log4Net_ from NuGet, at the Visual Studio Package Manager console, type:
1016

-24.6 KB
Binary file not shown.
-35.5 KB
Binary file not shown.

example/SeqLog4NetExample/SeqLog4NetExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net4.7</TargetFramework>
5+
<TargetFramework>net4.8</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

example/SeqLog4NetExampleNetCore/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Program
1010
{
1111
static void Main()
1212
{
13-
var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
13+
var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()!);
1414
XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));
1515

1616
var log = LogManager.GetLogger(typeof(Program));

0 commit comments

Comments
 (0)