Skip to content

Commit

Permalink
Dependency & Build updates (#158)
Browse files Browse the repository at this point in the history
Bump Microsoft.Extensions.Logging from 3.0.0 to 5.0.0
Bump Microsoft.Extensions.Logging.Console from 3.0.0 to 5.0.0
Bump Microsoft.Extensions.DependencyInjection from 3.0.0 to 5.0.0
Bump SonarAnalyzer.CSharp from 8.0.0.9566 to 8.15.0.24505
Bump Microsoft.NET.Test.Sdk from 16.2.0 to 16.8.0
Bump Microsoft.CodeAnalysis.FxCopAnalyzers from 2.9.7 to 3.3.1
Bump Polly from 6.1.2 to 7.2.1

Update builds to better support master to main branch rename.
  • Loading branch information
dustinchilson authored Nov 26, 2020
1 parent a151b4d commit 2777d7e
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 92 deletions.
64 changes: 30 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,62 @@ jobs:
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"

steps:

- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0

- name: Extract branch name
id: extract_branch
shell: powershell
run: Write-Host ([string]::Format("##[set-output name=branch;]{0}", $env:GITHUB_REF.Replace("refs/heads/", "")))

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.5.1'

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true

- name: Install NuGet client
uses: nuget/setup-nuget@v1
with:
nuget-version: '5.x'

- name: Run the Cake script
id: cake
uses: ecampidoglio/cake-action@master
uses: cake-build/cake-action@master
with:
cake-bootstrap: true

- name: Install NuGet client
uses: warrenbuckley/Setup-Nuget@v1
verbosity: Diagnostic
arguments: |
fullSemVer: ${{steps.gitversion.outputs.fullSemVer}}
assemblySemVer: ${{steps.gitversion.outputs.assemblySemVer}}
informationalVersion: ${{steps.gitversion.outputs.informationalVersion}}
- name: Add private GitHub registry to NuGet
run: nuget sources add -name "GPR" -Source https://nuget.pkg.github.com/dustinchilson/index.json -Username dustinchilson -Password ${{ secrets.GITHUB_TOKEN }}

- name: Push generated package to GitHub registry
run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg -Source "GPR" -SkipDuplicate
run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{steps.gitversion.outputs.fullSemVer}}.nupkg -Source "GPR" -SkipDuplicate

- name: Push generated package to nuget.org
if: steps.extract_branch.outputs.branch == 'main'
run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg -ApiKey ${{ secrets.NUGET_ORG_API_KEY }} -Source https://api.nuget.org/v3/index.json
run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{steps.gitversion.outputs.fullSemVer}}.nupkg -ApiKey ${{secrets.NUGET_ORG_API_KEY}} -Source https://api.nuget.org/v3/index.json

- name: Create Release
if: steps.extract_branch.outputs.branch == 'main'
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: v${{ env.GIT_VERSION }}
release_name: Release v${{ env.GIT_VERSION }}
tag_name: v${{steps.gitversion.outputs.fullSemVer}}
release_name: Release v${{steps.gitversion.outputs.fullSemVer}}
draft: false
prerelease: false

- name: Upload Test Results
if: steps.extract_branch.outputs.branch == 'main'
id: upload-test-results
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/TestResults.xml
asset_name: TestResults.xml
asset_content_type: application/xml

- name: Upload Nuget Package
if: steps.extract_branch.outputs.branch == 'main'
id: upload-nuget-package
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg
asset_name: NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg
asset_content_type: application/xml
body: https://www.nuget.org/packages/NLog.Targets.GraylogHttp/${{steps.gitversion.outputs.fullSemVer}}
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.0.0.9566" PrivateAssets="all" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.15.0.24505" PrivateAssets="all" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 1.0
next-version: 2.0

assembly-versioning-scheme: MajorMinor
commit-message-incrementing: Disabled
Expand All @@ -7,4 +7,4 @@ continuous-delivery-fallback-tag: ''
mode: ContinuousDeployment

ignore:
sha: []
sha: []
5 changes: 2 additions & 3 deletions NLog.Targets.GraylogHttp.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Targets.GraylogHttp", "src\NLog.Targets.GraylogHttp\NLog.Targets.GraylogHttp.csproj", "{2DA00B6B-A170-419D-AD82-AC139745A11E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{7970F18F-82A6-4B1C-B2D0-00F440E949F4}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
after.NLog.Targets.GraylogHttp.sln.targets = after.NLog.Targets.GraylogHttp.sln.targets
appveyor.yml = appveyor.yml
build.cake = build.cake
Directory.Build.props = Directory.Build.props
LICENSE = LICENSE
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ This library is packaged as a nuget package available [here](https://www.nuget.o
Install-Package NLog.Targets.GraylogHttp
```

## NetStandard, .Net Core 2.1-3.0, .Net Framework 4.5
## NetStandard, .Net Core 2.1-5.0, .Net Framework 4.5

This library runs under netstandard 1.3 and fully supports both .Net Core 2.1-3.0 and .Net Framework 4.5
This library runs under netstandard 1.3 and fully supports .Net Core 2.1-3.1, .Net 5.0, and .Net Framework 4.5+

## Usage

Expand Down
49 changes: 9 additions & 40 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#addin "nuget:?package=Cake.Json&version=4.0.0"
#addin "nuget:?package=Newtonsoft.Json&version=11.0.2"

// ARGUMENTS
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var platform = Argument("platform", "Any CPU");
var skipTests = Argument("SkipTests", false);

var fullSemVer = Argument("fullSemVer", "0.0.1");
var assemblySemVer = Argument("assemblySemVer", "0.0.1");
var informationalVersion = Argument("informationalVersion", "0.0.1");

// Variables
var artifactsDirectory = Directory("./artifacts");
var solutionFile = "./NLog.Targets.GraylogHttp.sln";
Expand All @@ -16,11 +16,11 @@ var msBuildSettings = new DotNetCoreMSBuildSettings
MaxCpuCount = 1
};

GitVersion versionInfo = null;

//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
msBuildSettings.Properties.Add("PackageVersion", new List<string> { fullSemVer });
msBuildSettings.Properties.Add("Version", new List<string> { assemblySemVer });
msBuildSettings.Properties.Add("FileVersion", new List<string> { assemblySemVer });
msBuildSettings.Properties.Add("AssemblyVersion", new List<string> { assemblySemVer });
msBuildSettings.Properties.Add("AssemblyInformationalVersion", new List<string> { informationalVersion });

// Define directories.
var buildDir = Directory("./build/bin") + Directory(configuration);
Expand All @@ -38,39 +38,8 @@ Task("Restore")
DotNetCoreRestore(solutionFile);
});

Task("Version")
.Does(() => {
// dotnet tool install --global GitVersion.Tool --version 5.1.2
DotNetCoreTool("tool",
new DotNetCoreToolSettings {
ArgumentCustomization = args => args.Append("restore")
});
// dotnet gitversion /output json
IEnumerable<string> redirectedStandardOutput;
StartProcess(
"dotnet",
new ProcessSettings {
Arguments = "dotnet-gitversion /output json",
RedirectStandardOutput = true
},
out redirectedStandardOutput
);
versionInfo = DeserializeJson<GitVersion>(string.Join(Environment.NewLine, redirectedStandardOutput));
Information($"::set-env name=GIT_VERSION::{versionInfo.FullSemVer}");
msBuildSettings.Properties.Add("PackageVersion", new List<string> { versionInfo.FullSemVer });
msBuildSettings.Properties.Add("Version", new List<string> { versionInfo.AssemblySemVer });
msBuildSettings.Properties.Add("FileVersion", new List<string> { versionInfo.AssemblySemVer });
msBuildSettings.Properties.Add("AssemblyVersion", new List<string> { versionInfo.AssemblySemVer });
msBuildSettings.Properties.Add("AssemblyInformationalVersion", new List<string> { versionInfo.InformationalVersion });
});

Task("Build")
.IsDependentOn("Restore")
.IsDependentOn("Version")
.Does(() =>
{
var path = MakeAbsolute(new DirectoryPath(solutionFile));
Expand Down
8 changes: 7 additions & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
"isRoot": true,
"tools": {
"gitversion.tool": {
"version": "5.1.2",
"version": "5.5.1",
"commands": [
"dotnet-gitversion"
]
},
"cake.tool": {
"version": "1.0.0-rc0001",
"commands": [
"dotnet-cake"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.4.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Polly" Version="6.1.2" />
<PackageReference Include="Polly" Version="7.2.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
Expand Down
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.35.0" />
<package id="Cake" version="0.38.5" />
</packages>

0 comments on commit 2777d7e

Please sign in to comment.