diff --git a/.github/workflows/dotnet-core-cov.yml b/.github/workflows/dotnet-core-cov.yml index 4ec3358d6f1..b4ce7b98a01 100644 --- a/.github/workflows/dotnet-core-cov.yml +++ b/.github/workflows/dotnet-core-cov.yml @@ -1,4 +1,4 @@ -name: .NET Code Coverage +name: Code Coverage on: push: @@ -31,7 +31,11 @@ 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 @@ -39,7 +43,7 @@ jobs: - name: Merging test results run: reportgenerator -reports:TestResults/**/*.xml -targetdir:TestResults -reporttypes:Cobertura - - uses: codecov/codecov-action@v1.0.10 + - uses: codecov/codecov-action@v1.0.12 with: file: TestResults/Cobertura.xml env_vars: OS diff --git a/.github/workflows/dotnet-core-linux.yml b/.github/workflows/dotnet-core-linux.yml index 9d27e3de914..b90bdc9a369 100644 --- a/.github/workflows/dotnet-core-linux.yml +++ b/.github/workflows/dotnet-core-linux.yml @@ -1,4 +1,4 @@ -name: .NET Linux +name: Linux on: pull_request: diff --git a/.github/workflows/dotnet-core-win.yml b/.github/workflows/dotnet-core-win.yml index 7e53e7c1abe..b93f270fe01 100644 --- a/.github/workflows/dotnet-core-win.yml +++ b/.github/workflows/dotnet-core-win.yml @@ -1,4 +1,4 @@ -name: .NET Windows +name: Windows on: pull_request: diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 5cf452378a5..e23ff6c3d0c 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -1,16 +1,17 @@ -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: @@ -18,7 +19,7 @@ jobs: strategy: matrix: - os: [windows-latest, ubuntu-latest] + os: [windows-latest] steps: - uses: actions/checkout@v2 @@ -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 diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml new file mode 100644 index 00000000000..721d46a77fe --- /dev/null +++ b/.github/workflows/dotnet-format.yml @@ -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 diff --git a/NuGet.config b/NuGet.config index 473a0742c6b..bb984e4c44f 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/build/Common.nonprod.props b/build/Common.nonprod.props new file mode 100644 index 00000000000..8a9fbf4742f --- /dev/null +++ b/build/Common.nonprod.props @@ -0,0 +1,39 @@ + + + + + false + $(MSBuildThisFileDirectory)/OpenTelemetryContrib.test.ruleset + + true + $(MSBuildThisFileDirectory)/debug.snk + $(DefineConstants);SIGNED + true + $(NoWarn),1574,1591 + + + + + + + + + true + + + + + [0.12.1,0.13) + [2.3.1,3.0) + [5.0.0-preview.8.20407.11] + [5.0.0-preview.8.20407.11] + [16.7.1,17.0) + [4.14.5,5.0) + [2.4.3,3.0) + [2.4.1,3.0) + + + diff --git a/build/Common.prod.props b/build/Common.prod.props index 5deefb3a1ed..6dad44268e0 100644 --- a/build/Common.prod.props +++ b/build/Common.prod.props @@ -1,5 +1,5 @@ - - + + true @@ -7,7 +7,7 @@ $(DefineConstants);SIGNED true - + git https://github.com/open-telemetry/opentelemetry-dotnet-contrib @@ -22,18 +22,15 @@ true - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - All - @@ -53,11 +50,6 @@ snupkg - - full - true - - @@ -66,4 +58,4 @@ true - \ No newline at end of file + diff --git a/build/Common.props b/build/Common.props new file mode 100644 index 00000000000..62425f6fdf7 --- /dev/null +++ b/build/Common.props @@ -0,0 +1,48 @@ + + + 8.0 + true + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName) + $(MSBuildThisFileDirectory)debug.snk + $(DefineConstants);SIGNED + + + + full + true + + + + true + + + + + [2.3.0,3.0) + [3.3.0] + [16.7.1] + [2.1.0,5.0) + [1.0.0,2.0) + [1.0.0,2.0) + [0.5.0-beta.2] + [1.1.118,2.0) + + + + + + + + + + All + + + + + diff --git a/build/Common.test.props b/build/Common.test.props deleted file mode 100644 index fe9bd1d4630..00000000000 --- a/build/Common.test.props +++ /dev/null @@ -1,32 +0,0 @@ - - - - false - $(MSBuildThisFileDirectory)/OpenTelemetryContrib.test.ruleset - - true - $(MSBuildThisFileDirectory)/debug.snk - $(DefineConstants);SIGNED - true - $(NoWarn),1574,1591 - - - - - - - - All - - - - - full - true - - - - true - - - \ No newline at end of file diff --git a/build/process-codecoverage.ps1 b/build/process-codecoverage.ps1 new file mode 100644 index 00000000000..3d29cbc98eb --- /dev/null +++ b/build/process-codecoverage.ps1 @@ -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 +} diff --git a/build/sanitycheck.py b/build/sanitycheck.py index 259cfd277aa..97c4e47454f 100644 --- a/build/sanitycheck.py +++ b/build/sanitycheck.py @@ -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 @@ -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 @@ -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) diff --git a/build/xunit.runner.json b/build/xunit.runner.json new file mode 100644 index 00000000000..fdeefaa4563 --- /dev/null +++ b/build/xunit.runner.json @@ -0,0 +1,4 @@ +{ + "maxParallelThreads": 1, + "parallelizeTestCollections": false +} diff --git a/opentelemetry-dotnet-contrib.proj b/opentelemetry-dotnet-contrib.proj index e9beb78b91d..db5061764ec 100644 --- a/opentelemetry-dotnet-contrib.proj +++ b/opentelemetry-dotnet-contrib.proj @@ -1,5 +1,4 @@ - - + @@ -15,4 +14,4 @@ - \ No newline at end of file + diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 6315c0be1b5..f84b91676ea 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -35,8 +35,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{824BD1DE-3FA8-4FE0-823A-FD365EAC78AF}" ProjectSection(SolutionItems) = preProject + build\Common.nonprod.props = build\Common.nonprod.props build\Common.prod.props = build\Common.prod.props - build\Common.test.props = build\Common.test.props + build\Common.props = build\Common.props build\debug.snk = build\debug.snk build\docfx.cmd = build\docfx.cmd build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 22172587a8b..c2701d09f98 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,4 @@ - \ No newline at end of file + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 4b8af02c113..df4ed847c0d 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -2,11 +2,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.csproj b/src/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.csproj index 7f25283fb8f..18eccaac790 100644 --- a/src/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.csproj +++ b/src/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.csproj @@ -6,4 +6,4 @@ $(PackageTags);distributed-tracing - \ No newline at end of file + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 73a8219ed11..a55fcdde66b 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,4 +1,4 @@ - - \ No newline at end of file + + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index a4e63e8064f..18398cd3b19 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,11 +1,3 @@ - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - \ No newline at end of file diff --git a/test/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests.csproj b/test/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests.csproj index 322a5b15e13..ec2e74ee49e 100644 --- a/test/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests.csproj +++ b/test/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests/OpenTelemetry.Contrib.Exporter.Stackdriver.Tests.csproj @@ -12,17 +12,17 @@ - + - - - - + + + + all runtime; build; native; contentfiles; analyzers - + - \ No newline at end of file + diff --git a/test/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCoreT/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.Tests.csproj b/test/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCoreT/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.Tests.csproj index 073e0682599..20e2d74d64d 100644 --- a/test/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCoreT/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.Tests.csproj +++ b/test/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCoreT/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore.Tests.csproj @@ -6,18 +6,18 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers - + - + - \ No newline at end of file + diff --git a/test/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests.csproj b/test/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests.csproj index c526006ddb0..522d9d3a737 100644 --- a/test/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests.csproj +++ b/test/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests/OpenTelemetry.Contrib.Instrumentation.MassTransit.Tests.csproj @@ -1,27 +1,26 @@ - - Unit test project for OpenTelemetry MassTransit instrumentation - netcoreapp2.1;netcoreapp3.1 - $(TargetFrameworks);net461 - + + Unit test project for OpenTelemetry MassTransit instrumentation + netcoreapp2.1;netcoreapp3.1 + $(TargetFrameworks);net461 + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - + + +