Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[repo] Dedicated workflows for Instrumentation.Process & Exporter.OneCollector #1355

Merged
merged 7 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ comment:
require_changes: no

ignore:
- "**.md"
- "src/OpenTelemetry.Contrib.Shared" # copied from main OTel project and has code coverage there
- "test/**/*"
- "**/*.md"
- "src/Shared" # copied from main OTel project and has code coverage there
- "test"
- "examples"
- "build"

flags:
unittests:
carryforward: true
paths:
- src

unittests-Exporter.OneCollector:
carryforward: true
paths:
- src/OpenTelemetry.Exporter.OneCollector

unittests-Instrumentation.Process:
carryforward: true
paths:
- src/OpenTelemetry.Instrumentation.Process

57 changes: 57 additions & 0 deletions .github/workflows/ci-Exporter.OneCollector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build OpenTelemetry.Exporter.OneCollector

on:
pull_request:
branches: [ 'main*', 'exporter*' ]
paths:
- '*/OpenTelemetry.Exporter.OneCollector*/**'
- 'build/**'
- '!**.md'

env:
PROJECT: OpenTelemetry.Exporter.OneCollector

jobs:
build-test:

strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
exclude:
- os: ubuntu-latest
version: net462

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup dotnet
uses: actions/setup-dotnet@v3

- name: dotnet restore build/Projects/${{env.PROJECT}}.proj
run: dotnet restore build/Projects/${{env.PROJECT}}.proj

- name: dotnet build build/Projects/${{env.PROJECT}}.proj
run: dotnet build build/Projects/${{env.PROJECT}}.proj --configuration Release --no-restore

- name: dotnet test test/${{env.PROJECT}}.Tests
run: dotnet test test/${{env.PROJECT}}.Tests --collect:"Code Coverage" --results-directory:TestResults --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true

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

- name: Merging test results
run: dotnet-coverage merge -r -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/*.coverage

- uses: codecov/[email protected]
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: unittests-Exporter.OneCollector
name: Code Coverage for Exporter.OneCollector on [${{ matrix.os }}.${{ matrix.version }}]
54 changes: 39 additions & 15 deletions .github/workflows/ci-Instrumentation.Process.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
name: Instrumentation.Process
name: Build OpenTelemetry.Instrumentation.Process

on:
pull_request:
branches: [ 'main*' ]
branches: [ 'main*', 'instrumentation*' ]
paths:
- 'src/OpenTelemetry.Instrumentation.Process/**'
- 'test/OpenTelemetry.Instrumentation.Process.Tests/**'
- '*/OpenTelemetry.Instrumentation.Process*/**'
- 'build/**'
- '!**.md'

env:
COMPONENT_NAME: OpenTelemetry.Instrumentation.Process
PROJECT: OpenTelemetry.Instrumentation.Process

jobs:
unit-test:
build-test:

strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ ubuntu-latest, windows-latest ]
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
exclude:
- os: ubuntu-latest
version: net462

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install .NET 7 SDK
uses: actions/[email protected]
with:
dotnet-version: '7.0.x'
- name: Setup dotnet
uses: actions/setup-dotnet@v3

- name: dotnet restore test/${{ env.PROJECT }}.Tests
run: dotnet restore test/${{ env.PROJECT }}.Tests

- name: dotnet build test/${{ env.PROJECT }}.Tests
run: dotnet build test/${{ env.PROJECT }}.Tests --configuration Release --no-restore

- name: Build
run: dotnet build --configuration Release test/${{ env.COMPONENT_NAME }}.Tests/${{ env.COMPONENT_NAME }}.Tests.csproj
- name: dotnet test test/${{ env.PROJECT }}.Tests
run: dotnet test test/${{ env.PROJECT }}.Tests --collect:"Code Coverage" --results-directory:"TestResults" --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true

- name: Test
run: dotnet test test/${{ env.COMPONENT_NAME }}.Tests/bin/Release/**/${{ env.COMPONENT_NAME }}.Tests.dll --logger:"console;verbosity=detailed"
- name: Install coverage tool
run: dotnet tool install -g dotnet-coverage

- name: Merging test results
run: dotnet-coverage merge -r -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/*.coverage

- uses: codecov/[email protected]
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: unittests-Instrumentation.Process
name: Code Coverage for Instrumentation.Process on [${{ matrix.os }}.${{ matrix.version }}]
7 changes: 0 additions & 7 deletions .github/workflows/ci-aot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Publish AOTCompatibility testApp

on:
push:
branches: [ 'main*' ]
paths:
- 'src/OpenTelemetry.Instrumentation.Runtime/**'
- '!src/OpenTelemetry.Instrumentation.Runtime/README.md'
- 'src/OpenTelemetry.Instrumentation.EventCounters/**'
- '!src/OpenTelemetry.Instrumentation.EventCounters/README.md'
pull_request:
branches: [ 'main*' ]
paths:
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Build

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
- '**.md'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
- '**.md'
- '*/OpenTelemetry.Instrumentation.Process*/**'
- '*/OpenTelemetry.Exporter.OneCollector*/**'

jobs:
build-test:
Expand All @@ -29,11 +27,37 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3

- name: Install dependencies
- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test ${{ matrix.version }}
run: dotnet test **/bin/**/${{ matrix.version }}/*.Tests.dll --logger:"console;verbosity=detailed"
shell: pwsh
run: |
$projects = Get-ChildItem `
-Path test/*.Tests/*.csproj `
-Exclude OpenTelemetry.Instrumentation.Process.Tests.csproj, OpenTelemetry.Exporter.OneCollector.Tests.csproj

ForEach ($project in $projects)
{
dotnet test $project.FullName --collect:"Code Coverage" --results-directory:"TestResults" --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true
}

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

- name: Merging test results
run: dotnet-coverage merge -r -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/*.coverage

- uses: codecov/[email protected]
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: unittests
name: Code Coverage for solution on [${{ matrix.os }}.${{ matrix.version }}]
53 changes: 0 additions & 53 deletions .github/workflows/dotnet-core-cov.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: dotnet format

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
- '**.cs'
- '.editorconfig'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/integration-md.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Integration Tests

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
- '**.md'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Integration Tests

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
- '**.md'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: markdownlint

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
- '**.md'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/sanitycheck.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: sanitycheck

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]

Expand Down
9 changes: 6 additions & 3 deletions build/Common.nonprod.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@
Refer to https://docs.microsoft.com/en-us/nuget/concepts/package-versioning for semver syntax.
-->
<BenchmarkDotNetPkgVer>[0.13.6,0.14)</BenchmarkDotNetPkgVer>
<CoverletCollectorPkgVer>[6.0.0,7.0.0)</CoverletCollectorPkgVer>
<DotNetXUnitCliVer>[2.3.1,3.0)</DotNetXUnitCliVer>
<MicrosoftExtensionsLoggingPkgVer>[5.0.0,7.0)</MicrosoftExtensionsLoggingPkgVer>
<MicrosoftNETTestSdkPkgVer>[17.6.3,18.0)</MicrosoftNETTestSdkPkgVer>
<MicrosoftNETTestSdkPkgVer>[17.7.2,18.0)</MicrosoftNETTestSdkPkgVer>
<MoqPkgVer>[4.18.4,5.0)</MoqPkgVer>
<OpenTelemetryExporterInMemoryPkgVer>$(OpenTelemetryCoreLatestVersion)</OpenTelemetryExporterInMemoryPkgVer>
<OpenTelemetryExporterInMemoryLatestPreReleasePkgVer>$(OpenTelemetryCoreLatestPrereleaseVersion)</OpenTelemetryExporterInMemoryLatestPreReleasePkgVer>
<XUnitRunnerVisualStudioPkgVer>[2.5.0,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.5.0,3.0)</XUnitPkgVer>
<WiremockNetPkgVer>[1.5.32,2.0)</WiremockNetPkgVer>
</PropertyGroup>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPkgVer)" Condition="'$(IsTestProject)' == 'true'" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up PR - probably we can do the same with xunit, dotnet-xunit and xunit-visualstudio-runner.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to that. But I didn't here because I thought I saw one project using MSTest (not xunit). Personally I am OK with component owners using a different framework if they want, no reason in my mind that they MUST use xunit. But we could simplify it down by using a property like <XUnitEnabled>true</XUnitEnabled> and then use that to add in whatever references we need?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go with opt-out for XUnitEnabled for all tests packages as major (all?) of our packages are based on this.

BTW I cannot find the MSTest reference in this repository.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked, I couldn't find it either. Maybe I imagined it 😄 Anyway opened this: #1363

</ItemGroup>

</Project>
2 changes: 0 additions & 2 deletions build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
Refer to https://docs.microsoft.com/en-us/nuget/concepts/package-versioning for semver syntax.
-->
<MinVerPkgVer>[4.3.0,5.0)</MinVerPkgVer>
<MicrosoftCodeCoveragePkgVer>[17.6.3]</MicrosoftCodeCoveragePkgVer>
<MicrosoftExtensionsHostingAbstractionsPkgVer>[2.1.0,5.0)</MicrosoftExtensionsHostingAbstractionsPkgVer>
<MicrosoftExtensionsOptionsPkgVer>[3.1.0,)</MicrosoftExtensionsOptionsPkgVer>
<MicrosoftNETFrameworkReferenceAssembliesPkgVer>[1.0.3,2.0)</MicrosoftNETFrameworkReferenceAssembliesPkgVer>
Expand All @@ -53,7 +52,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesPkgVer)" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersPkgVer)" Condition="'$(SkipAnalysis)'!='true'" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeCoverage" Version="$(MicrosoftCodeCoveragePkgVer)" Condition="'$(Configuration)'=='Release'" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(IncludeSharedExceptionExtensionsSource)'=='true'">
Expand Down
12 changes: 0 additions & 12 deletions build/process-codecoverage.ps1

This file was deleted.

Loading