Skip to content

Commit abd634a

Browse files
Builds: Various fixes (#47)
- Use centralized package versioning - Update packages to latest - Fix build warnings / errors from package updates - Move to net6 SDK in global.json and GitHub Actions - Move benchmarks/samples/test projects to net6.0 - Kill appveyor Builds - Determinstic Builds - Add support for builds on `main` branch Co-authored-by: Nick Craver <nrcraver@gmail.com>
1 parent 199994e commit abd634a

File tree

15 files changed

+108
-75
lines changed

15 files changed

+108
-75
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build & Test
33
on:
44
pull_request:
55
branches:
6-
- master
6+
- main
77
paths-ignore:
88
- 'docs/**' # Don't run workflow when files are only in the /docs directory
99

@@ -16,9 +16,8 @@ jobs:
1616
uses: actions/checkout@v2
1717
with:
1818
fetch-depth: 0
19-
- uses: actions/setup-dotnet@v1
20-
with:
21-
dotnet-version: '3.1.201'
19+
- name: Install .NET SDK
20+
uses: actions/setup-dotnet@v1
2221
- name: .NET Build
2322
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
2423
- name: .NET Test
@@ -31,6 +30,8 @@ jobs:
3130
uses: actions/checkout@v2
3231
with:
3332
fetch-depth: 0
33+
- name: Install .NET SDK
34+
uses: actions/setup-dotnet@v1
3435
- name: .NET Build
3536
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
3637
- name: .NET Test

.github/workflows/packages.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build, Test & Package
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
paths-ignore:
88
- 'docs/**' # Don't run workflow when files are only in the /docs directory
99

@@ -16,9 +16,8 @@ jobs:
1616
uses: actions/checkout@v2
1717
with:
1818
fetch-depth: 0
19-
- uses: actions/setup-dotnet@v1
20-
with:
21-
dotnet-version: '3.1.201'
19+
- name: Install .NET SDK
20+
uses: actions/setup-dotnet@v1
2221
- name: .NET Build
2322
run: dotnet build Build.csproj -c Release --nologo /p:CI=true
2423
- name: .NET Test
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project>
22
<PropertyGroup>
33
<VersionPrefix>1.0.0</VersionPrefix>
4-
<Copyright>2019 Stack Exchange, Inc.</Copyright>
4+
<Copyright>2021 Stack Exchange, Inc.</Copyright>
55
<LibTargetFrameworks>netstandard2.0</LibTargetFrameworks>
66
<PackageId>$(AssemblyName)</PackageId>
77
<Features>strict</Features>
8-
<Authors>Stack Exchange, Inc., Bret Copeland</Authors>
8+
<Authors>Stack Exchange, Inc., Bret Copeland, Dean Ward</Authors>
99
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>
1010
<MSBuildWarningsAsMessages>NETSDK1069</MSBuildWarningsAsMessages>
1111
<NoWarn>NU5105</NoWarn>
@@ -16,15 +16,22 @@
1616
<DebugSymbols>true</DebugSymbols>
1717
<DebugType>embedded</DebugType>
1818
<DefaultLanguage>en-US</DefaultLanguage>
19-
<IncludeSymbols>false</IncludeSymbols>
19+
<IncludeSymbols>true</IncludeSymbols>
2020
<PublishRepositoryUrl>true</PublishRepositoryUrl>
21+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
22+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
23+
<!-- Switches on global package management using Directory.Packages.props -->
24+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
25+
</PropertyGroup>
26+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
27+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2128
</PropertyGroup>
2229
<ItemGroup>
2330
<ProjectCapability Include="DynamicDependentFile" />
2431
<ProjectCapability Include="DynamicFileNesting" />
2532
</ItemGroup>
2633
<ItemGroup>
27-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.1.71" PrivateAssets="all" />
28-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
34+
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" />
35+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
2936
</ItemGroup>
3037
</Project>

Directory.Packages.props

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project>
2+
<!--
3+
Note: this is *setting* the versions only, not including any actual packages.
4+
There's a <PackageVersion Include="..." /> in the place it's actually needed only
5+
(e.g. the .csproj or a Directory.Build.props), then this central spot updates all of
6+
those includes to the same version just before the package restore step runs.
7+
That means this central file defines all versions used, and serves to sync them all up.
8+
-->
9+
<ItemGroup>
10+
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
11+
<PackageVersion Include="coverlet.collector" Version="3.1.0" />
12+
<PackageVersion Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.61701" />
13+
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.55" />
14+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
15+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
16+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
17+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
18+
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.0" />
19+
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
20+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
21+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
22+
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.4.244" />
23+
<PackageVersion Include="Pipelines.Sockets.Unofficial" Version="2.2.2" />
24+
<PackageVersion Include="System.Buffers" Version="4.5.1" />
25+
<PackageVersion Include="System.Collections.Immutable" Version="6.0.0" />
26+
<PackageVersion Include="System.Text.Json" Version="6.0.1" />
27+
<PackageVersion Include="xunit" Version="2.4.1" />
28+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.1" />
29+
</ItemGroup>
30+
</Project>

StackExchange.Metrics.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
99
ProjectSection(SolutionItems) = preProject
1010
.gitattributes = .gitattributes
1111
.gitignore = .gitignore
12-
appveyor.yml = appveyor.yml
1312
build.cmd = build.cmd
1413
build.ps1 = build.ps1
1514
Directory.build.props = Directory.build.props

appveyor.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

benchmarks/StackExchange.Metrics.Benchmarks/StackExchange.Metrics.Benchmarks.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<ProjectReference Include="..\..\src\StackExchange.Metrics\StackExchange.Metrics.csproj" />
11-
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
12-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" IncludeAssets="runtime;build;native;contentfiles;analyzers" />
11+
<PackageReference Include="BenchmarkDotNet" />
12+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" IncludeAssets="runtime;build;native;contentfiles;analyzers" />
1313
</ItemGroup>
1414

1515
</Project>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "3.1.100",
3+
"version": "6.0.101",
44
"rollForward": "latestMajor",
55
"allowPrerelease": false
66
}

samples/StackExchange.Metrics.SampleHost/MyCustomHandler.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ namespace StackExchange.Metrics.SampleHost
1313
{
1414
/// <summary>
1515
/// A simple handler that serializes metrics as plain text in the format:
16-
/// &lt;metric_name&gt;,&ltmetric_value&gt;\n
16+
/// &lt;metric_name&gt;,&lt;metric_value&gt;\n
1717
/// </summary>
1818
public class MyCustomHandler : BufferedHttpMetricHandler
1919
{
2020
private static readonly MediaTypeHeaderValue _plainText = new MediaTypeHeaderValue("text/plain");
2121

22-
private Uri _uri;
23-
2422
/// <summary>
2523
/// Constructs a new handler pointing at the specified <see cref="System.Uri" />.
2624
/// </summary>
@@ -35,10 +33,7 @@ public MyCustomHandler(Uri uri)
3533
/// <summary>
3634
/// Gets or sets the URI used by the handler.
3735
/// </summary>
38-
public Uri Uri
39-
{
40-
get; set;
41-
}
36+
public Uri Uri { get; }
4237

4338
// no pre or post-amble for this handler
4439
protected override int GetPostambleLength(PayloadType payloadType) => 0;
@@ -57,9 +52,9 @@ protected override HttpClient CreateHttpClient()
5752
return httpClient;
5853
}
5954

60-
protected override ValueTask SendCounterAsync(ReadOnlySequence<byte> sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.Counter, _plainText, sequence);
61-
protected override ValueTask SendCumulativeCounterAsync(ReadOnlySequence<byte> sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.CumulativeCounter, _plainText, sequence);
62-
protected override ValueTask SendGaugeAsync(ReadOnlySequence<byte> sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.Gauge, _plainText, sequence);
55+
protected override ValueTask SendCounterAsync(ReadOnlySequence<byte> sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.Counter, _plainText, sequence);
56+
protected override ValueTask SendCumulativeCounterAsync(ReadOnlySequence<byte> sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.CumulativeCounter, _plainText, sequence);
57+
protected override ValueTask SendGaugeAsync(ReadOnlySequence<byte> sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.Gauge, _plainText, sequence);
6358
// this implementation doesn't support metadata
6459
protected override ValueTask SendMetadataAsync(ReadOnlySequence<byte> sequence) => default;
6560

samples/StackExchange.Metrics.SampleHost/StackExchange.Metrics.SampleHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

0 commit comments

Comments
 (0)