Skip to content

Commit

Permalink
Fix up.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Dec 20, 2024
1 parent e41846e commit b0ee65d
Show file tree
Hide file tree
Showing 29 changed files with 407 additions and 19 deletions.
227 changes: 227 additions & 0 deletions .github/workflows/Cogito.Serilog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
name: Cogito.Serilog

on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
release:
types:
- created

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: 5.x
- name: Execute GitVersion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
- name: Add NuGet Source (GitHub)
shell: pwsh
run: dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name alethic $env:GITHUB_REPOS
env:
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NuGet Restore
run: dotnet restore Cogito.Serilog.sln
- name: Build
shell: pwsh
run: |
dotnet msbuild /m /bl `
/p:Configuration="Release" `
/p:Platform="Any CPU" `
/p:Version=${env:GitVersion_FullSemVer} `
/p:AssemblyVersion=${env:GitVersion_AssemblySemVer} `
/p:InformationalVersion=${env:GitVersion_InformationalVersion} `
/p:FileVersion=${env:GitVersion_AssemblySemFileVer} `
/p:PackageVersion=${env:GitVersion_FullSemVer} `
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" `
/p:PackageProjectUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}" `
/p:BuildInParallel=true `
/p:ContinuousIntegrationBuild=true `
Cogito.Serilog.dist.msbuildproj
- name: Upload MSBuild Log
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: msbuild.binlog
path: msbuild.binlog
- name: Upload NuGet Packages
uses: actions/upload-artifact@v4
with:
name: nuget
path: dist/nuget/*.nupkg
- name: Package Tests
run: tar czvf tests.tar.gz tests
working-directory: dist
- name: Upload Tests
uses: actions/upload-artifact@v4
with:
name: tests
path: dist/tests.tar.gz
test:
strategy:
matrix:
run:
- Cogito.Serilog.Tests
sys:
- win-x64
- linux-x64
- osx-x64
- osx-arm64
tfm:
- net481
- net6.0
- net8.0
exclude:
- tfm: net48
sys: linux-x64
- tfm: net48
sys: osx-x64
- tfm: net48
sys: osx-arm64
name: Test (${{ matrix.run }}:${{ matrix.tfm }}:${{ matrix.sys }})
timeout-minutes: 240
needs:
- build
runs-on: ${{ fromJSON('{"win-x64":["windows-2022"],"linux-x64":["ubuntu-22.04"],"osx-x64":["macos-13"],"osx-arm64":["macos-14"]}')[matrix.sys] }}
steps:
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download Tests
uses: actions/download-artifact@v4
with:
name: tests
- name: Restore Tests
run: tar xzvf tests.tar.gz
- name: Execute Tests
timeout-minutes: 240
shell: pwsh
run: |
# assign powershell variables
$run = "${{ matrix.run }}"
$tfm = "${{ matrix.tfm }}"
$sys = "${{ matrix.sys }}"
# suite name can contain filter expression after ?
$split = $run.IndexOf("?")
if ($split -gt -1) {
$tst = $run.Substring(0, $split)
$qry = $run.Substring($split + 1)
} else {
$tst = $run
}
# scan and process test assemblies
$tests = $(gi .\tests\$tst\$tfm\*.Tests.dll)
if ($tests) {
$argl = @(
"-f", $tfm,
"-v:diag",
"--results-directory", "TestResults",
"--logger:console;verbosity=diag",
"--logger:trx"
)
$runsettings = $(gi .\tests\$tst\$tfm\*.runsettings)
if ($runsettings) {
$argl += "--settings:$runsettings"
}
if ($qry -ne "" -and $qry -ne $null) {
$argl += @("--filter", $qry)
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst-$qry--$tfm--$sys"
} else {
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst--$tfm--$sys"
}
dotnet test @argl $tests[0].FullName
}
- name: Archive Test Results
if: always() && startsWith(env.RET, 'TestResults--')
run: tar czvf TestResults.tar.gz TestResults
working-directory: ${{ env.WORKPATH }}
- name: Upload Test Results
if: always() && startsWith(env.RET, 'TestResults--')
uses: actions/upload-artifact@v4
with:
name: ${{ env.RET }}
path: TestResults.tar.gz
release:
name: Release
if: github.event_name != 'pull_request'
needs:
- test
runs-on: ubuntu-22.04
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: 5.x
- name: Execute GitVersion
id: GitVersion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
- name: Download NuGet Packages
uses: actions/download-artifact@v4
with:
name: nuget
path: dist/nuget
- name: Create Release
if: github.ref_type == 'tag'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.GitVersion.outputs.semVer }}
allowUpdates: true
omitBodyDuringUpdate: true
artifacts: dist/nuget/*.nupkg,dist/nuget/*.snupkg,dist/doc.zip
makeLatest: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push NuGet (GitHub)
if: github.event_name != 'pull_request'
shell: pwsh
run: dotnet nuget push dist/nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate
env:
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push NuGet
if: github.ref_type == 'tag'
shell: pwsh
run: dotnet nuget push dist/nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate
env:
NUGET_REPOS: https://api.nuget.org/v3/index.json
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,6 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

/dist
32 changes: 32 additions & 0 deletions Cogito.Serilog.dist.msbuildproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project DefaultTargets="Publish">
<PropertyGroup>
<DistDir Condition="'$(DistDir)' == ''">$(DISTDIR)</DistDir>
<DistDir Condition="'$(DistDir)' == ''">$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'dist'))</DistDir>
<DistDir>$([System.IO.Path]::GetFullPath('$(DistDir)'))</DistDir>
<SolutionFile>$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'Cogito.Serilog.sln'))</SolutionFile>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
</PropertyGroup>

<ItemGroup>
<TargetsForPublish Include="$(SolutionFile)">
<Targets>dist%5Cdist-nuget:Publish</Targets>
<Properties>PublishDir=$(DistDir)\nuget</Properties>
</TargetsForPublish>
<TargetsForPublish Include="$(SolutionFile)">
<Targets>dist%5Cdist-tests:Publish</Targets>
<Properties>PublishDir=$(DistDir)\tests</Properties>
</TargetsForPublish>
</ItemGroup>

<Target Name="Publish">
<ItemGroup>
<_TargetsForPublish Include="@(TargetsForPublish)">
<Properties>%(TargetsForPublish.Properties)</Properties>
</_TargetsForPublish>
</ItemGroup>

<MSBuild BuildInParallel="$(BuildInParallel)" ContinueOnError="false" Projects="@(_TargetsForPublish)" Targets="%(_TargetsForPublish.Targets)" />
</Target>

</Project>
39 changes: 34 additions & 5 deletions Cogito.Serilog.sln
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29721.120
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7271F8CF-C4EC-47FE-91F3-FF3331482C4F}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
Cogito.Serilog.dist.msbuildproj = Cogito.Serilog.dist.msbuildproj
.github\workflows\Cogito.Serilog.yml = .github\workflows\Cogito.Serilog.yml
Directory.Build.props = Directory.Build.props
GitVersion.yml = GitVersion.yml
global.json = global.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog", "Cogito.Serilog\Cogito.Serilog.csproj", "{CBA6505F-8781-4A5E-9A4A-6942EBD66ED4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog", "src\Cogito.Serilog\Cogito.Serilog.csproj", "{CBA6505F-8781-4A5E-9A4A-6942EBD66ED4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog.Autofac", "Cogito.Serilog.Autofac\Cogito.Serilog.Autofac.csproj", "{7B309A5F-E9BC-46D0-B776-0B13CB65AEDF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog.Autofac", "src\Cogito.Serilog.Autofac\Cogito.Serilog.Autofac.csproj", "{7B309A5F-E9BC-46D0-B776-0B13CB65AEDF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog.Tests", "Cogito.Serilog.Tests\Cogito.Serilog.Tests.csproj", "{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cogito.Serilog.Tests", "src\Cogito.Serilog.Tests\Cogito.Serilog.Tests.csproj", "{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dist", "dist", "{49376E09-31A8-43AE-9A22-9F34A3DEC6B7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{30CA5786-F236-40AD-96CD-1590BB7FC6AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dist-nuget", "src\dist-nuget\dist-nuget.csproj", "{E19E6FFF-84A5-4466-9DBA-442BD6D8E678}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dist-tests", "src\dist-tests\dist-tests.csproj", "{25FC413A-C3B9-4BF9-9DCC-001916066CE7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -33,10 +47,25 @@ Global
{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF}.Release|Any CPU.Build.0 = Release|Any CPU
{E19E6FFF-84A5-4466-9DBA-442BD6D8E678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E19E6FFF-84A5-4466-9DBA-442BD6D8E678}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E19E6FFF-84A5-4466-9DBA-442BD6D8E678}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E19E6FFF-84A5-4466-9DBA-442BD6D8E678}.Release|Any CPU.Build.0 = Release|Any CPU
{25FC413A-C3B9-4BF9-9DCC-001916066CE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25FC413A-C3B9-4BF9-9DCC-001916066CE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25FC413A-C3B9-4BF9-9DCC-001916066CE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25FC413A-C3B9-4BF9-9DCC-001916066CE7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CBA6505F-8781-4A5E-9A4A-6942EBD66ED4} = {30CA5786-F236-40AD-96CD-1590BB7FC6AC}
{7B309A5F-E9BC-46D0-B776-0B13CB65AEDF} = {30CA5786-F236-40AD-96CD-1590BB7FC6AC}
{1B6B5D05-9BA9-43BA-A4F2-35A85015FBBF} = {30CA5786-F236-40AD-96CD-1590BB7FC6AC}
{E19E6FFF-84A5-4466-9DBA-442BD6D8E678} = {49376E09-31A8-43AE-9A22-9F34A3DEC6B7}
{25FC413A-C3B9-4BF9-9DCC-001916066CE7} = {49376E09-31A8-43AE-9A22-9F34A3DEC6B7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF4B3820-4206-4316-82A5-DEA5792C6A71}
EndGlobalSection
Expand Down
42 changes: 33 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
<Project>
<PropertyGroup>
<Authors>Jerome Haltom</Authors>
<Company>Alethic Solutions</Company>
<RepositoryUrl>https://github.com/alethic/Cogito.Serilog</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/alethic/Cogito.Serilog</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<LangVersion>8.0</LangVersion>
<LangVersion Condition=" '$(LangVersion)' == '' ">12.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="" />
<Authors Include="Jerome Haltom" />
</ItemGroup>

<PropertyGroup Label="Copyright Info">
<ProductName>Cogito.Serilog</ProductName>
<Authors>@(Authors, ',')</Authors>
<CurrentYear Condition=" '$(CurrentYear)' == '' ">$([System.DateTime]::UtcNow.Year.ToString())</CurrentYear>
<Copyright>Copyright © $(CurrentYear) @(Authors, ', ')</Copyright>
</PropertyGroup>

<PropertyGroup Label="Version Info">
<DefaultMajorVersion>0</DefaultMajorVersion>
<Version Condition=" '$(Version)' == '' ">$(DefaultMajorVersion).0.0-dev</Version>
<AssemblyVersion Condition=" '$(AssemblyVersion)' == '' ">$(DefaultMajorVersion).0.0.0</AssemblyVersion>
<FileVersion Condition=" '$(FileVersion)' == '' ">$(DefaultMajorVersion).0.0.0</FileVersion>
<InformationalVersion Condition=" '$(InformationalVersion)' == '' ">$(DefaultMajorVersion).0.0.0</InformationalVersion>
</PropertyGroup>

<PropertyGroup Label="Package Info">
<RepositoryUrl Condition=" '$(RepositoryUrl)' == '' ">https://github.com/alethic/Cogito.Serilog.git</RepositoryUrl>
<RepositoryType Condition=" '$(RepositoryType)' == '' ">git</RepositoryType>
<PackageProjectUrl Condition=" '$(PackageProjectUrl)' == '' ">https://github.com/alethic/Cogito.Serilog</PackageProjectUrl>
<PackageVersion Condition=" '$(PackageVersion)' == '' ">$(Version)</PackageVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IKVM.Core.MSBuild" Version="0.1.106">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
Loading

0 comments on commit b0ee65d

Please sign in to comment.