Skip to content

Commit 67a3fc8

Browse files
authored
Merge pull request #448 from serilog/dev
9.0.0 Release
2 parents 71ba0e3 + dfb4df4 commit 67a3fc8

38 files changed

+366
-403
lines changed

Diff for: .editorconfig

-7
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77
indent_size = 4
8-
end_of_line = lf
98

109
[*.{csproj,json,config,yml,props}]
1110
indent_size = 2
1211

13-
[*.sh]
14-
end_of_line = lf
15-
16-
[*.{cmd, bat}]
17-
end_of_line = crlf
18-
1912
csharp_style_namespace_declarations = file_scoped:suggestion

Diff for: .github/workflows/ci.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
# The build must run on Windows so that .NET Framework targets can be built and tested.
19+
runs-on: windows-latest
20+
21+
permissions:
22+
contents: write
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Setup
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: 9.0.x
30+
- name: Compute build number
31+
shell: bash
32+
run: |
33+
echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+2300))" >> $GITHUB_ENV
34+
- name: Build and Publish
35+
env:
36+
DOTNET_CLI_TELEMETRY_OPTOUT: true
37+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
shell: pwsh
40+
run: |
41+
./Build.ps1

Diff for: .gitignore

+5-200
Original file line numberDiff line numberDiff line change
@@ -1,203 +1,8 @@
1-
## Ignore Visual Studio temporary files, build results, and
2-
## files generated by popular Visual Studio add-ons.
3-
4-
# User-specific files
5-
*.suo
6-
*.user
7-
*.userosscache
8-
*.sln.docstates
9-
10-
# User-specific files (MonoDevelop/Xamarin Studio)
11-
*.userprefs
12-
13-
# Build results
14-
[Dd]ebug/
15-
[Dd]ebugPublic/
16-
[Rr]elease/
17-
[Rr]eleases/
18-
x64/
19-
x86/
20-
build/
21-
bld/
22-
[Bb]in/
23-
[Oo]bj/
24-
25-
# Visual Studo 2015 cache/options directory
261
.vs/
27-
28-
# JetBrains project files
292
.idea/
30-
31-
# MSTest test Results
32-
[Tt]est[Rr]esult*/
33-
[Bb]uild[Ll]og.*
34-
35-
# NUNIT
36-
*.VisualState.xml
37-
TestResult.xml
38-
39-
# Build Results of an ATL Project
40-
[Dd]ebugPS/
41-
[Rr]eleasePS/
42-
dlldata.c
43-
44-
*_i.c
45-
*_p.c
46-
*_i.h
47-
*.ilk
48-
*.meta
49-
*.obj
50-
*.pch
51-
*.pdb
52-
*.pgc
53-
*.pgd
54-
*.rsp
55-
*.sbr
56-
*.tlb
57-
*.tli
58-
*.tlh
59-
*.tmp
60-
*.tmp_proj
61-
*.log
62-
*.vspscc
63-
*.vssscc
64-
.builds
65-
*.pidb
66-
*.svclog
67-
*.scc
68-
69-
# Chutzpah Test files
70-
_Chutzpah*
71-
72-
# Visual C++ cache files
73-
ipch/
74-
*.aps
75-
*.ncb
76-
*.opensdf
77-
*.sdf
78-
*.cachefile
79-
80-
# Visual Studio profiler
81-
*.psess
82-
*.vsp
83-
*.vspx
84-
85-
# TFS 2012 Local Workspace
86-
$tf/
87-
88-
# Guidance Automation Toolkit
89-
*.gpState
90-
91-
# ReSharper is a .NET coding add-in
92-
_ReSharper*/
93-
*.[Rr]e[Ss]harper
94-
*.DotSettings.user
95-
96-
# JustCode is a .NET coding addin-in
97-
.JustCode
98-
99-
# TeamCity is a build add-in
100-
_TeamCity*
101-
102-
# DotCover is a Code Coverage Tool
103-
*.dotCover
104-
105-
# NCrunch
106-
_NCrunch_*
107-
.*crunch*.local.xml
108-
109-
# MightyMoose
110-
*.mm.*
111-
AutoTest.Net/
112-
113-
# Web workbench (sass)
114-
.sass-cache/
115-
116-
# Installshield output folder
117-
[Ee]xpress/
118-
119-
# DocProject is a documentation generator add-in
120-
DocProject/buildhelp/
121-
DocProject/Help/*.HxT
122-
DocProject/Help/*.HxC
123-
DocProject/Help/*.hhc
124-
DocProject/Help/*.hhk
125-
DocProject/Help/*.hhp
126-
DocProject/Help/Html2
127-
DocProject/Help/html
128-
129-
# Click-Once directory
130-
publish/
131-
132-
# Publish Web Output
133-
*.[Pp]ublish.xml
134-
*.azurePubxml
135-
# TODO: Comment the next line if you want to checkin your web deploy settings
136-
# but database connection strings (with potential passwords) will be unencrypted
137-
*.pubxml
138-
*.publishproj
139-
140-
# NuGet Packages
141-
*.nupkg
142-
# The packages folder can be ignored because of Package Restore
143-
**/packages/*
144-
# except build/, which is used as an MSBuild target.
145-
!**/packages/build/
146-
# Uncomment if necessary however generally it will be regenerated when needed
147-
#!**/packages/repositories.config
148-
149-
# Windows Azure Build Output
150-
csx/
151-
*.build.csdef
152-
153-
# Windows Store app package directory
154-
AppPackages/
155-
156-
# Others
157-
*.[Cc]ache
158-
ClientBin/
159-
[Ss]tyle[Cc]op.*
160-
~$*
161-
*~
162-
*.dbmdl
163-
*.dbproj.schemaview
164-
*.pfx
165-
*.publishsettings
166-
node_modules/
167-
bower_components/
168-
169-
# RIA/Silverlight projects
170-
Generated_Code/
171-
172-
# Backup & report files from converting an old project file
173-
# to a newer Visual Studio version. Backup files are not needed,
174-
# because we have git ;-)
175-
_UpgradeReport_Files/
176-
Backup*/
177-
UpgradeLog*.XML
178-
UpgradeLog*.htm
179-
180-
# SQL Server files
181-
*.mdf
182-
*.ldf
183-
184-
# Business Intelligence projects
185-
*.rdl.data
186-
*.bim.layout
187-
*.bim_*.settings
188-
189-
# Microsoft Fakes
190-
FakesAssemblies/
191-
192-
# Node.js Tools for Visual Studio
193-
.ntvs_analysis.dat
194-
195-
# Visual Studio 6 build log
196-
*.plg
197-
198-
# Visual Studio 6 workspace options file
199-
*.opt
200-
201-
project.lock.json
202-
3+
bin/
4+
obj/
5+
test/
2036
artifacts/
7+
8+
.DS_Store

Diff for: Build.ps1

+67-25
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,80 @@
1+
Write-Output "build: Tool versions follow"
2+
3+
dotnet --version
4+
dotnet --list-sdks
5+
16
Write-Output "build: Build started"
27

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

5-
if(Test-Path .\artifacts) {
6-
Write-Output "build: Cleaning .\artifacts"
7-
Remove-Item .\artifacts -Force -Recurse
8-
}
15+
& dotnet restore --no-cache
916

10-
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
11-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
12-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
13-
$commitHash = $(git rev-parse --short HEAD)
14-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
17+
$dbp = [Xml] (Get-Content .\Directory.Version.props)
18+
$versionPrefix = $dbp.Project.PropertyGroup.VersionPrefix
1519

16-
Write-Output "build: Package version suffix is $suffix"
17-
Write-Output "build: Build version suffix is $buildSuffix"
20+
Write-Output "build: Package version prefix is $versionPrefix"
1821

19-
& dotnet build --configuration Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
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 ""]
2027

21-
if($LASTEXITCODE -ne 0) { throw 'build failed' }
28+
Write-Output "build: Package version suffix is $suffix"
29+
Write-Output "build: Build version suffix is $buildSuffix"
2230

23-
if($suffix) {
24-
& dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts --version-suffix=$suffix
25-
} else {
26-
& dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts
27-
}
31+
& dotnet format --no-restore --verify-no-changes --severity error
32+
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
33+
if ($LASTEXITCODE -ne 0) { throw "Build failed" }
34+
35+
foreach ($src in Get-ChildItem src/*) {
36+
Push-Location $src
37+
38+
Write-Output "build: Packaging project in $src"
39+
40+
if ($suffix) {
41+
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts --version-suffix=$suffix
42+
} else {
43+
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts
44+
}
45+
if ($LASTEXITCODE -ne 0) { throw "Packaging failed" }
2846

29-
if($LASTEXITCODE -ne 0) { throw 'pack failed' }
47+
Pop-Location
48+
}
3049

31-
Write-Output "build: Testing"
50+
foreach ($test in Get-ChildItem test/*.Tests) {
51+
Push-Location $test
3252

33-
# Dotnet test doesn't run separate TargetFrameworks in parallel: https://github.com/dotnet/sdk/issues/19147
34-
# Workaround: use `dotnet test` on dlls directly in order to pass the `--parallel` option to vstest.
35-
# The _reported_ runtime is wrong but the _actual_ used runtime is correct, see https://github.com/microsoft/vstest/issues/2037#issuecomment-720549173
36-
& dotnet test test\Serilog.Settings.Configuration.Tests\bin\Release\*\Serilog.Settings.Configuration.Tests.dll --parallel
53+
Write-Output "build: Testing project in $test"
3754

38-
if($LASTEXITCODE -ne 0) { throw 'unit tests failed' }
55+
& dotnet test -c Release --no-build --no-restore
56+
if ($LASTEXITCODE -ne 0) { throw "Testing failed" }
57+
58+
Pop-Location
59+
}
60+
61+
if ($env:NUGET_API_KEY) {
62+
# GitHub Actions will only supply this to branch builds and not PRs. We publish
63+
# builds from any branch this action targets (i.e. main and dev).
64+
65+
Write-Output "build: Publishing NuGet packages"
66+
67+
foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) {
68+
& dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg"
69+
if ($LASTEXITCODE -ne 0) { throw "Publishing failed" }
70+
}
71+
72+
if (!($suffix)) {
73+
Write-Output "build: Creating release for version $versionPrefix"
74+
75+
iex "gh release create v$versionPrefix --title v$versionPrefix --generate-notes $(get-item ./artifacts/*.nupkg) $(get-item ./artifacts/*.snupkg)"
76+
}
77+
}
78+
} finally {
79+
Pop-Location
80+
}

0 commit comments

Comments
 (0)