Skip to content

Commit 37cd7ba

Browse files
Add net5.0 target, remove netcoreapp2.0, add build scripts
1 parent 81970f3 commit 37cd7ba

File tree

15 files changed

+209
-28
lines changed

15 files changed

+209
-28
lines changed

.editorconfig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ insert_final_newline = true
1010
indent_style = space
1111
indent_size = 4
1212

13-
[*.{proj,props,sln,targets,sql}]
14-
indent_style = tab
15-
16-
[*.{xml,dna,config,nuspec,csproj,vcxproj,vcproj,targets,ps1,resx}]
13+
[*.{xml,config,nuspec,csproj,props,targets,ps1}]
1714
indent_size = 2
1815

19-
[*.{cpp,h,def}]
20-
indent_style = tab
16+
[*.{sh}]
17+
end_of_line = lf
2118

2219
[*.{dotsettings}]
2320
end_of_line = lf

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
* text=auto
33

44
# Explicitly declare files that should always be converted to LF regardless of platform
5+
*.sh text eol=lf
56
*.dotsettings text eol=lf

.github/workflows/dependabot-cake.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
on:
2+
schedule:
3+
# every Sunday at 6am
4+
- cron: '0 6 * * SUN'
5+
6+
workflow_dispatch:
7+
8+
jobs:
9+
dependabot-cake:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: check/update cake dependencies
13+
uses: augustoproiete-actions/nils-org--dependabot-cake-action@v1

.gitignore

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
1-
#Ignore thumbnails created by Windows
1+
#windows
22
Thumbs.db
33

4-
#Ignore metadata created by OSX
4+
#osx
55
.DS_Store
66
._*
77

8-
#Ignore files created by Visual Studio
8+
#visual-studio
99
.vs/
1010
*.user
1111
*.suo
1212
*.tmp_proj
13-
*.dbmdl
14-
*.dbproj.schemaview
1513
*.cache
1614
*.vsdoc
1715
[Oo]bj/
1816
[Bb]in/
1917
[Dd]ebug/
2018
[Rr]elease/
21-
[Rr][Cc]/
22-
[Cc]ode[Cc]overage/
23-
[Ff]x[Cc]op/
2419
[Ll]og/
2520
[Tt]emp/
2621

27-
# Ignore NuGet Packages
22+
#nuget
2823
*.nupkg
2924
**/packages/*
3025

31-
#Ignore files created by ReSharper
32-
_ReSharper*/
33-
34-
#Ignore files created by NUnit
35-
TestResult.xml
36-
*.VisualState.xml
26+
#cake
27+
.cake/
28+
/artifacts/*
29+
/test/**/tools/*

Directory.Build.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<Project>
2+
23
<PropertyGroup>
34
<LangVersion>latest</LangVersion>
45
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
9+
</ItemGroup>
10+
511
</Project>

build.cake

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#addin "nuget:?package=Cake.MinVer&version=1.0.0"
2+
#addin "nuget:?package=Cake.Args&version=1.0.0"
3+
4+
var target = ArgumentOrDefault<string>("target") ?? "pack";
5+
var buildVersion = MinVer(s => s.WithTagPrefix("v").WithDefaultPreReleasePhase("preview"));
6+
7+
Task("clean")
8+
.Does(() =>
9+
{
10+
CleanDirectory("./artifacts");
11+
CleanDirectories("./src/**/bin");
12+
CleanDirectories("./src/**/obj");
13+
CleanDirectories("./test/**/bin");
14+
CleanDirectories("./test/**/obj");
15+
});
16+
17+
Task("restore")
18+
.IsDependentOn("clean")
19+
.Does(() =>
20+
{
21+
DotNetCoreRestore("./serilog-sinks-notepad.sln", new DotNetCoreRestoreSettings
22+
{
23+
LockedMode = true,
24+
});
25+
});
26+
27+
Task("build")
28+
.IsDependentOn("restore")
29+
.DoesForEach(new[] { "Debug", "Release" }, (configuration) =>
30+
{
31+
DotNetCoreBuild("./serilog-sinks-notepad.sln", new DotNetCoreBuildSettings
32+
{
33+
Configuration = configuration,
34+
NoRestore = true,
35+
NoIncremental = false,
36+
ArgumentCustomization = args =>
37+
args.AppendQuoted($"-p:Version={buildVersion.Version}")
38+
.AppendQuoted($"-p:AssemblyVersion={buildVersion.FileVersion}")
39+
.AppendQuoted($"-p:FileVersion={buildVersion.FileVersion}")
40+
.AppendQuoted($"-p:ContinuousIntegrationBuild=true")
41+
});
42+
});
43+
44+
Task("test")
45+
.IsDependentOn("build")
46+
.Does(() =>
47+
{
48+
var settings = new DotNetCoreTestSettings
49+
{
50+
Configuration = "Release",
51+
NoRestore = true,
52+
NoBuild = true,
53+
};
54+
55+
var projectFiles = GetFiles("./test/**/*.csproj");
56+
foreach (var file in projectFiles)
57+
{
58+
DotNetCoreTest(file.FullPath, settings);
59+
}
60+
});
61+
62+
Task("pack")
63+
.IsDependentOn("test")
64+
.Does(() =>
65+
{
66+
var releaseNotes = $"https://github.com/augustoproiete/serilog-sinks-notepad/releases/tag/v{buildVersion.Version}";
67+
68+
DotNetCorePack("./src/Serilog.Sinks.Notepad/Serilog.Sinks.Notepad.csproj", new DotNetCorePackSettings
69+
{
70+
Configuration = "Release",
71+
NoRestore = true,
72+
NoBuild = true,
73+
OutputDirectory = "./artifacts/nuget",
74+
ArgumentCustomization = args =>
75+
args.AppendQuoted($"-p:Version={buildVersion.Version}")
76+
.AppendQuoted($"-p:PackageReleaseNotes={releaseNotes}")
77+
});
78+
});
79+
80+
Task("push")
81+
.IsDependentOn("pack")
82+
.Does(context =>
83+
{
84+
var url = context.EnvironmentVariable("NUGET_URL");
85+
if (string.IsNullOrWhiteSpace(url))
86+
{
87+
context.Information("No NuGet URL specified. Skipping publishing of NuGet packages");
88+
return;
89+
}
90+
91+
var apiKey = context.EnvironmentVariable("NUGET_API_KEY");
92+
if (string.IsNullOrWhiteSpace(apiKey))
93+
{
94+
context.Information("No NuGet API key specified. Skipping publishing of NuGet packages");
95+
return;
96+
}
97+
98+
var nugetPushSettings = new DotNetCoreNuGetPushSettings
99+
{
100+
Source = url,
101+
ApiKey = apiKey,
102+
};
103+
104+
foreach (var nugetPackageFile in GetFiles("./artifacts/nuget/*.nupkg"))
105+
{
106+
DotNetCoreNuGetPush(nugetPackageFile.FullPath, nugetPushSettings);
107+
}
108+
});
109+
110+
RunTarget(target);

build.cmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo on
2+
@cd %~dp0
3+
4+
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
5+
set DOTNET_CLI_TELEMETRY_OPTOUT=1
6+
set DOTNET_NOLOGO=1
7+
8+
dotnet tool restore
9+
@if %ERRORLEVEL% neq 0 goto :eof
10+
11+
dotnet cake %*

build.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
Set-Location -LiteralPath $PSScriptRoot
4+
5+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
6+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
7+
$env:DOTNET_NOLOGO = '1'
8+
9+
dotnet tool restore
10+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
11+
12+
dotnet cake @args
13+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euox pipefail
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")"
5+
6+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
7+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
8+
export DOTNET_NOLOGO=1
9+
10+
dotnet tool restore
11+
12+
dotnet cake "$@"

cake.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Nuget]
2+
Source=https://api.nuget.org/v3/index.json
3+
UseInProcessClient=true
4+
LoadDependencies=false
5+
6+
[Paths]
7+
Tools=./.cake
8+
Addins=./.cake/addins
9+
Modules=./.cake/modules
10+
11+
[Settings]
12+
SkipVerification=false

0 commit comments

Comments
 (0)