-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from datalust/dev
9.0.0 Release
- Loading branch information
Showing
45 changed files
with
335 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# If this file is renamed, the incrementing run attempt number will be reset. | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "dev", "main" ] | ||
pull_request: | ||
branches: [ "dev", "main" ] | ||
|
||
env: | ||
CI_BUILD_NUMBER_BASE: ${{ github.run_number }} | ||
CI_TARGET_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
|
||
jobs: | ||
build: | ||
|
||
# The build must run on Windows so that .NET Framework targets can be built and tested. | ||
runs-on: windows-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 9.0.x | ||
- name: Compute build number | ||
shell: bash | ||
run: | | ||
echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+2300))" >> $GITHUB_ENV | ||
- name: Build and Publish | ||
env: | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
shell: pwsh | ||
run: | | ||
./Build.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,79 @@ | ||
Write-Output "build: Tool versions follow" | ||
|
||
dotnet --version | ||
dotnet --list-sdks | ||
|
||
Write-Output "build: Build started" | ||
|
||
Push-Location $PSScriptRoot | ||
try { | ||
if(Test-Path .\artifacts) { | ||
Write-Output "build: Cleaning ./artifacts" | ||
Remove-Item ./artifacts -Force -Recurse | ||
} | ||
|
||
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } | ||
& dotnet restore --no-cache | ||
|
||
& dotnet restore --no-cache | ||
$dbp = [Xml] (Get-Content .\Directory.Version.props) | ||
$versionPrefix = $dbp.Project.PropertyGroup.VersionPrefix | ||
|
||
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; | ||
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; | ||
$suffix = @{ $true = ""; $false = "$branch-$revision"}[$branch -eq "main" -and $revision -ne "local"] | ||
Write-Output "build: Package version prefix is $versionPrefix" | ||
|
||
foreach ($src in gci src/Serilog.*) { | ||
Push-Location $src | ||
$branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH]; | ||
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER]; | ||
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "main" -and $revision -ne "local"] | ||
$commitHash = $(git rev-parse --short HEAD) | ||
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] | ||
|
||
if ($suffix) { | ||
& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$suffix --include-source | ||
} else { | ||
& dotnet pack -c Release -o ..\..\.\artifacts --include-source | ||
} | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
Write-Output "build: Package version suffix is $suffix" | ||
Write-Output "build: Build version suffix is $buildSuffix" | ||
|
||
Pop-Location | ||
} | ||
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true | ||
if($LASTEXITCODE -ne 0) { throw "Build failed" } | ||
|
||
foreach ($src in Get-ChildItem src/*) { | ||
Push-Location $src | ||
|
||
Write-Output "build: Packaging project in $src" | ||
|
||
if ($suffix) { | ||
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts --version-suffix=$suffix | ||
} else { | ||
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts | ||
} | ||
if($LASTEXITCODE -ne 0) { throw "Packaging failed" } | ||
|
||
foreach ($test in gci test/Serilog.*.Tests) { | ||
Push-Location $test | ||
Pop-Location | ||
} | ||
|
||
& dotnet test -c Release | ||
if($LASTEXITCODE -ne 0) { exit 2 } | ||
foreach ($test in Get-ChildItem test/*.Tests) { | ||
Push-Location $test | ||
|
||
Write-Output "build: Testing project in $test" | ||
|
||
& dotnet test -c Release --no-build --no-restore | ||
if($LASTEXITCODE -ne 0) { throw "Testing failed" } | ||
|
||
Pop-Location | ||
} | ||
|
||
if ($env:NUGET_API_KEY) { | ||
# GitHub Actions will only supply this to branch builds and not PRs. We publish | ||
# builds from any branch this action targets (i.e. main and dev). | ||
|
||
Write-Output "build: Publishing NuGet packages" | ||
|
||
foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) { | ||
& dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg" | ||
if($LASTEXITCODE -ne 0) { throw "Publishing failed" } | ||
} | ||
|
||
if (!($suffix)) { | ||
Write-Output "build: Creating release for version $versionPrefix" | ||
|
||
iex "gh release create v$versionPrefix --title v$versionPrefix --generate-notes $(get-item ./artifacts/*.nupkg) $(get-item ./artifacts/*.snupkg)" | ||
} | ||
} | ||
} finally { | ||
Pop-Location | ||
} | ||
|
||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project> | ||
<Import Project="$(MSBuildThisFileDirectory)Directory.Version.props" /> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)assets/Serilog.snk</AssemblyOriginatorKeyFile> | ||
<CheckEolTargetFramework>false</CheckEolTargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>9.0.0</VersionPrefix> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"version": "8.0.201", | ||
"version": "9.0.100", | ||
"allowPrerelease": false, | ||
"rollForward": "latestFeature" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.