Skip to content

Commit

Permalink
Updating contrib project (#24)
Browse files Browse the repository at this point in the history
updating EOF

updating EOF

updating EOF

updating proj file

updating

saved without BOM

removing unused lines
  • Loading branch information
eddynaka authored Sep 2, 2020
1 parent afa3b36 commit 2d0e5aa
Show file tree
Hide file tree
Showing 23 changed files with 232 additions and 124 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/dotnet-core-cov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Code Coverage
name: Code Coverage

on:
push:
Expand Down Expand Up @@ -31,15 +31,19 @@ jobs:
run: dotnet build --configuration Release --no-restore

- name: dotnet test
run: dotnet test --collect:"XPlat Code Coverage" --results-directory:"TestResults" --configuration Release --no-build -- RunConfiguration.DisableAppDomain=true
run: dotnet test --collect:"Code Coverage" --results-directory:"TestResults" --configuration Release --no-build -- RunConfiguration.DisableAppDomain=true

- name: Process code coverage
run: .\build\process-codecoverage.ps1
shell: powershell

- name: Install report tool
run: dotnet tool install -g dotnet-reportgenerator-globaltool

- name: Merging test results
run: reportgenerator -reports:TestResults/**/*.xml -targetdir:TestResults -reporttypes:Cobertura

- uses: codecov/[email protected].10
- uses: codecov/[email protected].12
with:
file: TestResults/Cobertura.xml
env_vars: OS
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core-linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Linux
name: Linux

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core-win.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Windows
name: Windows

on:
pull_request:
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: .NET
name: Pack

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
schedule:
- cron: '0 0 * * *' # once in a day at 00:00
push:
branches: [ master ]
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '*' # trigger when we create a tag

jobs:
build-test-pack:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-latest, ubuntu-latest]
os: [windows-latest]

steps:
- uses: actions/checkout@v2
Expand All @@ -31,15 +32,10 @@ jobs:
- name: dotnet build
run: dotnet build --configuration Release --no-restore -p:Deterministic=true

- name: dotnet test
run: dotnet test -p:CollectCoverage=false --configuration Release --no-build --logger:"console;verbosity=detailed"

- name: dotnet pack
if: ${{ matrix.os == 'windows-latest' }}
run: dotnet pack opentelemetry-dotnet-contrib.proj --configuration Release --no-build
run: dotnet pack OpenTelemetry.proj --configuration Release --no-build

- name: Publish Artifacts
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-packages
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: dotnet format

on:
pull_request:
branches: [ master ]
paths:
- '**.cs'
- '.editorconfig'

jobs:
check-format:
runs-on: windows-latest

steps:
- name: check out code
uses: actions/checkout@v2

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Install format tool
run: dotnet tool install -g dotnet-format

- name: dotnet format
run: dotnet-format --folder --check
2 changes: 1 addition & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
</configuration>
39 changes: 39 additions & 0 deletions build/Common.nonprod.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project>
<Import Project=".\Common.props" />

<PropertyGroup>
<IsPackable>false</IsPackable>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/OpenTelemetryContrib.test.ruleset</CodeAnalysisRuleSet>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)/debug.snk</AssemblyOriginatorKeyFile>
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn),1574,1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/stylecop.json" />
</ItemGroup>

<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Tests'))">
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<PropertyGroup Label="Package versions used in by test projects">
<!--
Please sort alphabetically.
Refer to https://docs.microsoft.com/en-us/nuget/concepts/package-versioning for semver syntax.
-->
<BenchmarkDotNetPkgVer>[0.12.1,0.13)</BenchmarkDotNetPkgVer>
<DotNetXUnitCliVer>[2.3.1,3.0)</DotNetXUnitCliVer>
<MicrosoftExtensionsLoggingPkgVer>[5.0.0-preview.8.20407.11]</MicrosoftExtensionsLoggingPkgVer>
<MicrosoftExtensionsLoggingConsolePkgVer>[5.0.0-preview.8.20407.11]</MicrosoftExtensionsLoggingConsolePkgVer>
<MicrosoftNETTestSdkPkgVer>[16.7.1,17.0)</MicrosoftNETTestSdkPkgVer>
<MoqPkgVer>[4.14.5,5.0)</MoqPkgVer>
<XUnitRunnerVisualStudioPkgVer>[2.4.3,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.4.1,3.0)</XUnitPkgVer>
</PropertyGroup>

</Project>
20 changes: 6 additions & 14 deletions build/Common.prod.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<Import Project=".\Common.props" />

<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)debug.snk</AssemblyOriginatorKeyFile>
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/open-telemetry/opentelemetry-dotnet-contrib</RepositoryUrl>
Expand All @@ -22,18 +22,15 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!--<MinVerVerbosity>detailed</MinVerVerbosity>-->
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)opentelemetry-icon-color.png" Pack="true" PackagePath="\"/>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/stylecop.json" />

<PackageReference Include="MinVer" Version="2.3.0" Condition="'$(IntegrationBuild)' != 'true'">
<PackageReference Include="MinVer" Version="$(MinVerPkgVer)" Condition="'$(IntegrationBuild)' != 'true'">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" Condition="'$(SkipAnalysis)'!='true'">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

<Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)'!=''">
Expand All @@ -53,11 +50,6 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup Condition="'$(Deterministic)'=='true'">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>
Expand All @@ -66,4 +58,4 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

</Project>
</Project>
48 changes: 48 additions & 0 deletions build/Common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<Project>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<SignAssembly>true</SignAssembly>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)debug.snk</AssemblyOriginatorKeyFile>
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Label="Package versions used in this repository">
<!--
Please sort alphabetically.
Refer to https://docs.microsoft.com/en-us/nuget/concepts/package-versioning for semver syntax.
-->
<MinVerPkgVer>[2.3.0,3.0)</MinVerPkgVer>
<MicrosoftCodeAnalysisFxCopAnalyzersPkgVer>[3.3.0]</MicrosoftCodeAnalysisFxCopAnalyzersPkgVer>
<MicrosoftCodeCoveragePkgVer>[16.7.1]</MicrosoftCodeCoveragePkgVer>
<MicrosoftExtensionsHostingAbstractionsPkgVer>[2.1.0,5.0)</MicrosoftExtensionsHostingAbstractionsPkgVer>
<MicrosoftNETFrameworkReferenceAssembliesPkgVer>[1.0.0,2.0)</MicrosoftNETFrameworkReferenceAssembliesPkgVer>
<MicrosoftSourceLinkGitHubPkgVer>[1.0.0,2.0)</MicrosoftSourceLinkGitHubPkgVer>
<OpenTelemetryPkgVer>[0.5.0-beta.2]</OpenTelemetryPkgVer>
<StyleCopAnalyzersPkgVer>[1.1.118,2.0)</StyleCopAnalyzersPkgVer>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/stylecop.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesPkgVer)" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersPkgVer)" Condition="'$(SkipAnalysis)'!='true'">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeCoverage" Version="$(MicrosoftCodeCoveragePkgVer)" Condition="'$(Configuration)'=='Release'"/>
<!--<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="$(MicrosoftCodeAnalysisFxCopAnalyzersPkgVer)" Condition="'$(SkipAnalysis)'!='true'">
<PrivateAssets>all</PrivateAssets>
</PackageReference>-->
</ItemGroup>
</Project>
32 changes: 0 additions & 32 deletions build/Common.test.props

This file was deleted.

8 changes: 8 additions & 0 deletions build/process-codecoverage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$files = Get-ChildItem "TestResults" -Filter "*.coverage" -Recurse
Write-Host $env:USERPROFILE
foreach ($file in $files)
{
$command = $env:USERPROFILE+ '\.nuget\packages\microsoft.codecoverage\16.7.1\build\netstandard1.0\CodeCoverage\CodeCoverage.exe analyze /output:' + $file.DirectoryName + '\' + $file.Name + '.xml '+ $file.FullName
Write-Host $command
Invoke-Expression $command
}
37 changes: 34 additions & 3 deletions build/sanitycheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import os
import sys

CR = b'\r'
CRLF = b'\r\n'
LF = b'\n'

def sanitycheck(pattern, allow_utf8 = False):
error_count = 0

Expand All @@ -13,12 +17,32 @@ def sanitycheck(pattern, allow_utf8 = False):
with open(filename, 'rb') as file:
content = file.read()
error = []
eol = None
lineno = 1
for line in content.splitlines():
if not content:
error.append(' Empty file found')
elif content[-1] != 10: # LF
error.append(' Missing a blank line before EOF')
for line in content.splitlines(True):
if allow_utf8 and lineno == 1 and line.startswith(b'\xef\xbb\xbf'):
line = line[3:]
if any(b > 127 for b in line):
error.append(' Non-ASCII character found at Ln:{} {}'.format(lineno, line))
if line[-2:] == CRLF:
if not eol:
eol = CRLF
elif eol != CRLF:
error.append(' Inconsistent line ending found at Ln:{} {}'.format(lineno, line))
line = line[:-2]
elif line[-1:] == LF:
if not eol:
eol = LF
elif eol != LF:
error.append(' Inconsistent line ending found at Ln:{} {}'.format(lineno, line))
line = line[:-1]
elif line[-1:] == CR:
error.append(' CR found at Ln:{} {}'.format(lineno, line))
line = line[:-1]
if line[-1:] == b' ' or line[-1:] == b'\t':
error.append(' Trailing space found at Ln:{} {}'.format(lineno, line))
lineno += 1
Expand All @@ -35,11 +59,18 @@ def sanitycheck(pattern, allow_utf8 = False):

retval = 0
retval += sanitycheck('**/*.cmd')
retval += sanitycheck('**/*.config', allow_utf8 = True)
retval += sanitycheck('**/*.cs', allow_utf8 = True)
retval += sanitycheck('**/*.cshtml', allow_utf8 = True)
retval += sanitycheck('**/*.csproj', allow_utf8 = True)
retval += sanitycheck('**/*.htm')
retval += sanitycheck('**/*.html')
retval += sanitycheck('**/*.md')
retval += sanitycheck('**/*.proj', allow_utf8 = True)
retval += sanitycheck('**/*.proj')
retval += sanitycheck('**/*.props')
retval += sanitycheck('**/*.py')
retval += sanitycheck('**/*.xml', allow_utf8 = True)
retval += sanitycheck('**/*.ruleset', allow_utf8 = True)
retval += sanitycheck('**/*.sln', allow_utf8 = True)
retval += sanitycheck('**/*.xml')

sys.exit(retval)
4 changes: 4 additions & 0 deletions build/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"maxParallelThreads": 1,
"parallelizeTestCollections": false
}
Loading

0 comments on commit 2d0e5aa

Please sign in to comment.