Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit 33f6f9d

Browse files
Enabled signing and automated MyGet deployments (#35)
Improve builds
1 parent da7cc06 commit 33f6f9d

10 files changed

Lines changed: 186 additions & 48 deletions

File tree

.vsts/ci-build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# CI build. No publioshing of artifacts
2+
3+
phases:
4+
5+
- phase: Windows
6+
queue: Hosted VS2017
7+
steps:
8+
- task: DotNetCoreInstaller@0
9+
displayName: force use of desired dotnet version
10+
inputs:
11+
version: "2.0.3"
12+
13+
- task: DotNetCoreCLI@2
14+
displayName: restore packages
15+
inputs:
16+
command: "restore"
17+
projects: "*.sln"
18+
19+
- task: DotNetCoreCLI@2
20+
displayName: build solution (Release)
21+
inputs:
22+
command: "build"
23+
projects: "*.sln"
24+
arguments: "--configuration Release"
25+
26+
# consider switch to https://docs.microsoft.com/vsts/pipelines/tasks/test/vstest?view=vsts
27+
- task: DotNetCoreCLI@2
28+
displayName: test
29+
inputs:
30+
command: "test"
31+
projects: "test/**/*.csproj"
32+
arguments: "--configuration Release"
33+
34+
- task: PublishTestResults@2
35+
36+
- phase: Linux
37+
queue: Hosted Linux Preview
38+
steps:
39+
- task: DotNetCoreInstaller@0
40+
displayName: force use of desired dotnet version
41+
inputs:
42+
version: "2.0.3"
43+
44+
- task: DotNetCoreCLI@2
45+
displayName: restore packages
46+
inputs:
47+
command: "restore"
48+
projects: "*.sln"
49+
50+
- task: DotNetCoreCLI@2
51+
displayName: build
52+
inputs:
53+
command: "build"
54+
projects: "*.sln"
55+
arguments: "--configuration Release"
56+
57+
- task: DotNetCoreCLI@2
58+
displayName: test
59+
inputs:
60+
command: "test"
61+
projects: "test/**/*.csproj"
62+
arguments: "--configuration Release"
63+
64+
- task: PublishTestResults@2
Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1-
queue:
2-
name: Hosted VS2017
1+
# CI build with the upload to MyGet
2+
3+
queue: Hosted VS2017
34
steps:
45
- task: DotNetCoreInstaller@0
56
displayName: force use of desired dotnet version
67
inputs:
78
version: "2.0.3"
89

9-
- task: DotNetCoreCLI@1
10+
- task: DotNetCoreCLI@2
1011
displayName: restore packages
1112
inputs:
1213
command: "restore"
1314
projects: "*.sln"
1415

15-
- task: DotNetCoreCLI@1
16-
displayName: build
16+
- task: DotNetCoreCLI@2
17+
displayName: build solution (Release)
1718
inputs:
1819
command: "build"
1920
projects: "*.sln"
2021
arguments: "--configuration Release"
2122

22-
- task: DotNetCoreCLI@1
23+
- task: DotNetCoreCLI@2
24+
displayName: pack solution (Release)
25+
inputs:
26+
command: "pack"
27+
projects: "*.sln"
28+
configuration: 'Release'
29+
packDirectory: '$(build.artifactStagingDirectory)'
30+
31+
- task: DotNetCoreCLI@2
2332
displayName: test
2433
inputs:
2534
command: "test"
@@ -36,8 +45,15 @@ steps:
3645
arguments: "--configuration Release --output $(build.artifactstagingdirectory)"
3746
zipAfterPublish: "True"
3847

48+
- task: NuGetCommand@2
49+
displayName: 'Publish nugets to MyGet'
50+
inputs:
51+
command: push
52+
nuGetFeedType: external
53+
publishFeedCredentials: 'myget-open-census'
54+
3955
- task: PublishBuildArtifacts@1
4056
inputs:
4157
PathtoPublish: "$(build.artifactstagingdirectory)"
4258
ArtifactName: "drop"
43-
ArtifactType: "Container"
59+
ArtifactType: "Container"

OpenCensus.sln

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
EndProject
1515
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}"
1616
ProjectSection(SolutionItems) = preProject
17+
build\Common.prod.props = build\Common.prod.props
18+
build\Common.test.props = build\Common.test.props
19+
build\debug.snk = build\debug.snk
1720
build\OpenCensus.prod.ruleset = build\OpenCensus.prod.ruleset
1821
build\OpenCensus.test.ruleset = build\OpenCensus.test.ruleset
1922
build\stylecop.json = build\stylecop.json
2023
EndProjectSection
2124
EndProject
22-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCensus.Exporter.Zipkin", "src\OpenCensus.Exporter.Zipkin\OpenCensus.Exporter.Zipkin.csproj", "{7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenCensus.Exporter.Zipkin", "src\OpenCensus.Exporter.Zipkin\OpenCensus.Exporter.Zipkin.csproj", "{7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}"
26+
EndProject
27+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vsts", ".vsts", "{61188153-47FB-4567-AC9B-79B2435853EB}"
28+
ProjectSection(SolutionItems) = preProject
29+
.vsts\ci-build.yml = .vsts\ci-build.yml
30+
.vsts\ci-myget-update.yml = .vsts\ci-myget-update.yml
31+
EndProjectSection
2332
EndProject
2433
Global
2534
GlobalSection(SolutionConfigurationPlatforms) = preSolution

build/Common.prod.props

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/OpenCensus.prod.ruleset</CodeAnalysisRuleSet>
5+
<DocumentationFile Condition="$(OS) == 'Windows_NT'">$(OutputPath)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile>
6+
<PackageOutputPath Condition="$(Build_ArtifactStagingDirectory) != ''">$(Build_ArtifactStagingDirectory)</PackageOutputPath>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
10+
<SignAssembly>true</SignAssembly>
11+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/debug.snk</AssemblyOriginatorKeyFile>
12+
<DelaySign>false</DelaySign>
13+
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/stylecop.json" />
18+
</ItemGroup>
19+
20+
<PropertyGroup>
21+
<!--
22+
Semantic Version. See http://semver.org for full details.
23+
Update for every public release.
24+
-->
25+
<SemanticVersionMajor>0</SemanticVersionMajor>
26+
<SemanticVersionMinor>1</SemanticVersionMinor>
27+
<SemanticVersionPatch>0</SemanticVersionPatch>
28+
<!--Valid values: beta1, beta2, EMPTY for stable -->
29+
<PreReleaseMilestone>beta1</PreReleaseMilestone>
30+
<!--
31+
Date when Semantic Version was changed.
32+
Update for every public release.
33+
NOTE!!!!!! Do not update when updating PreReleaseMilestone update
34+
as it will restart file versions so 2.4.0-beta1 may have higher
35+
file version (like 2.4.0.2222) than 2.4.0-beta2 (like 2.4.0.1111)
36+
-->
37+
<SemanticVersionDate>2018-08-25</SemanticVersionDate>
38+
39+
<PreReleaseVersion Condition="'$(PreReleaseVersion)'==''">$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
40+
</PropertyGroup>
41+
42+
<PropertyGroup>
43+
<VersionPrefix>$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch)</VersionPrefix>
44+
<VersionSuffix>$(PreReleaseMilestone)-$(PreReleaseVersion)</VersionSuffix>
45+
<FileVersion Condition="'$(PreReleaseVersion)' != ''">$(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch).$(PreReleaseVersion)</FileVersion>
46+
</PropertyGroup>
47+
</Project>

build/Common.test.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="$(OS) == 'Windows_NT'">
4+
<SignAssembly>true</SignAssembly>
5+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/debug.snk</AssemblyOriginatorKeyFile>
6+
<DelaySign>false</DelaySign>
7+
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
8+
</PropertyGroup>
9+
</Project>

build/debug.snk

596 Bytes
Binary file not shown.

src/OpenCensus.Exporter.Zipkin/OpenCensus.Exporter.Zipkin.csproj

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\Common.prod.props" />
23

34
<PropertyGroup>
5+
<Description>OpenCensus .NET API</Description>
46
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
57
<TargetFrameworks Condition="$(OS) != 'Windows_NT'">netstandard2.0</TargetFrameworks>
8+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
9+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
10+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
11+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
12+
<IncludeSymbols>True</IncludeSymbols>
13+
<PackageId>OpenCensus.Export.Zipkin</PackageId>
14+
<PackageTags>Tracing;OpenCensus;Management;Monitoring;Zipkin</PackageTags>
15+
<PackageIconUrl>https://opencensus.io/images/opencensus-logo.png</PackageIconUrl>
16+
<PackageProjectUrl>https://opencensus.io</PackageProjectUrl>
17+
<PackageLicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
18+
<Authors>OpenCensus authors</Authors>
19+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
620
</PropertyGroup>
721

8-
<PropertyGroup>
9-
<CodeAnalysisRuleSet>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\OpenCensus.prod.ruleset</CodeAnalysisRuleSet>
10-
</PropertyGroup>
11-
12-
<PropertyGroup>
13-
<DocumentationFile Condition="$(OS) == 'Windows_NT'">$(OutputPath)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile>
14-
</PropertyGroup>
15-
16-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net46|AnyCPU'">
17-
<PlatformTarget>x64</PlatformTarget>
18-
</PropertyGroup>
19-
20-
<ItemGroup>
21-
<AdditionalFiles Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\stylecop.json" />
22-
</ItemGroup>
23-
24-
2522
<ItemGroup>
2623
<ProjectReference Include="..\OpenCensus\OpenCensus.csproj" />
2724
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">

src/OpenCensus/OpenCensus.csproj

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\Common.prod.props" />
23

34
<PropertyGroup>
4-
<Description>OpenCensus .NET API</Description>
5-
<VersionPrefix>0.1.0</VersionPrefix>
6-
<VersionSuffix>beta1</VersionSuffix>
75
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
86
<TargetFrameworks Condition="$(OS) != 'Windows_NT'">netstandard2.0</TargetFrameworks>
9-
<AssemblyName>OpenCensus</AssemblyName>
10-
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
11-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
12-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
7+
<Description>OpenCensus .NET API</Description>
138
<RootNamespace>OpenCensus</RootNamespace>
149
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1510
<IncludeSymbols>True</IncludeSymbols>
@@ -20,31 +15,17 @@
2015
<PackageLicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
2116
<Authors>OpenCensus authors</Authors>
2217
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
23-
24-
</PropertyGroup>
25-
26-
<PropertyGroup>
27-
<CodeAnalysisRuleSet>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\OpenCensus.prod.ruleset</CodeAnalysisRuleSet>
28-
</PropertyGroup>
29-
30-
<PropertyGroup>
31-
<DocumentationFile Condition="$(OS) == 'Windows_NT'">$(OutputPath)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile>
3218
</PropertyGroup>
3319

3420
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
3521
<DebugType>full</DebugType>
3622
<DebugSymbols>true</DebugSymbols>
3723
</PropertyGroup>
3824

39-
<ItemGroup>
40-
<AdditionalFiles Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\stylecop.json" />
41-
</ItemGroup>
42-
4325
<ItemGroup>
4426
<PackageReference Include="System.Collections.Immutable" Version="1.4.0" />
4527
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
4628
<PrivateAssets>All</PrivateAssets>
4729
</PackageReference>
4830
</ItemGroup>
49-
5031
</Project>

src/OpenCensus/Properties/AssemblyInfo.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,19 @@
1616

1717
using System.Runtime.CompilerServices;
1818

19-
[assembly: InternalsVisibleTo("OpenCensus.Tests")]
20-
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
19+
[assembly: InternalsVisibleTo("OpenCensus.Tests" + AssemblyInfo.PublicKey)]
20+
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)]
21+
22+
#if SIGNED
23+
internal static class AssemblyInfo
24+
{
25+
public const string PublicKey = ", PublicKey=002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898";
26+
public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7";
27+
}
28+
#else
29+
internal static class AssemblyInfo
30+
{
31+
public const string PublicKey = "";
32+
public const string MoqPublicKey = "";
33+
}
34+
#endif

test/OpenCensus.Tests/OpenCensus.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenCensus.sln'))\build\Common.test.props" />
23

34
<PropertyGroup>
45
<Description>Unit test project for OpenCensus</Description>

0 commit comments

Comments
 (0)