Skip to content

Commit

Permalink
[repo] Add dedicated CI for EventCounters and Runtime instrumentation…
Browse files Browse the repository at this point in the history
… projects (#1404)
  • Loading branch information
CodeBlanch authored Oct 20, 2023
1 parent dc57213 commit 60dc97b
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 119 deletions.
10 changes: 10 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ flags:
- src/OpenTelemetry.Instrumentation.AspNet
- src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule

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

unittests-Instrumentation.Owin:
carryforward: true
paths:
Expand All @@ -68,6 +73,11 @@ flags:
paths:
- src/OpenTelemetry.Instrumentation.Process

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

unittests-Instrumentation.StackExchangeRedis:
carryforward: true
paths:
Expand Down
58 changes: 49 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,27 @@ jobs:
build: ['build/**', '.github/**/*.yml', '!.github/workflows/package-*']
shared: ['src/Shared/**']
code: ['**.cs', '.editorconfig']
aottestapp: ['test/OpenTelemetry.AotCompatibility.TestApp/**']
aspnet: ['*/OpenTelemetry.Instrumentation.AspNet*/**', 'examples/AspNet/**', '!**/*.md']
eventcounters: ['*/OpenTelemetry.Instrumentation.EventCounters*/**', 'examples/event-counters/**', '!**/*.md']
extensions: ['*/OpenTelemetry.Extensions*/**', '!**/*.md']
geneva: ['*/OpenTelemetry.Exporter.Geneva*/**', '!**/*.md']
onecollector: ['*/OpenTelemetry.Instrumentation.OneCollector*/**', '!**/*.md']
owin: ['*/OpenTelemetry.Instrumentation.Owin*/**', 'examples/owin/**', '!**/*.md']
persistentstorage: ['*/OpenTelemetry.PersistentStorage*/**', '!**/*.md']
process: ['*/OpenTelemetry.Instrumentation.Process*/**', 'examples/process-instrumentation/**', '!**/*.md']
redis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md']
runtime: ['*/OpenTelemetry.Instrumentation.Runtime*/**', 'examples/runtime-instrumentation/**', '!**/*.md']
wcf: ['*/OpenTelemetry.Instrumentation.Wcf*/**', 'examples/wcf/**', '!**/*.md']
solution: [
'src/**',
'test/**',
'examples/**',
'!test/OpenTelemetry.AotCompatibility.TestApp/**',
'!*/OpenTelemetry.Instrumentation.AspNet*/**',
'!examples/AspNet/**',
'!*/OpenTelemetry.Instrumentation.EventCounters*/**',
'!examples/event-counters/**',
'!*/OpenTelemetry.Extensions*/**',
'!*/OpenTelemetry.Exporter.Geneva*/**',
'!*/OpenTelemetry.Exporter.OneCollector*/**',
Expand All @@ -46,6 +52,8 @@ jobs:
'!examples/process-instrumentation/**',
'!*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**',
'!examples/redis/**',
'!*/OpenTelemetry.Instrumentation.Runtime*/**',
'!examples/runtime-instrumentation/**',
'!*/OpenTelemetry.Instrumentation.Wcf*/**',
'!examples/wcf/**',
'!**/*.md'
Expand Down Expand Up @@ -74,6 +82,18 @@ jobs:
os-list: '[ "windows-latest" ]'
tfm-list: '[ "net462" ]'

build-test-eventcounters:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'eventcounters')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Instrumentation.EventCounters
code-cov-name: Instrumentation.EventCounters
tfm-list: '[ "net6.0", "net7.0" ]'

build-test-extensions:
needs: detect-changes
if: |
Expand Down Expand Up @@ -161,6 +181,17 @@ jobs:
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/integration.yml

build-test-runtime:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'runtime')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Instrumentation.Runtime
code-cov-name: Instrumentation.Runtime

build-test-wcf:
needs: detect-changes
if: |
Expand Down Expand Up @@ -195,13 +226,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3

- name: Restore
run: dotnet restore

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

- name: Test ${{ matrix.version }}
- name: Restore, Build, & Test ${{ matrix.version }}
shell: pwsh
run: |
$projects = Get-ChildItem `
Expand All @@ -212,16 +237,18 @@ jobs:
OpenTelemetry.Extensions.Tests.csproj,
OpenTelemetry.Instrumentation.AspNet.Tests.csproj,
OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.Tests.csproj,
OpenTelemetry.Instrumentation.EventCounters.Tests.csproj,
OpenTelemetry.Instrumentation.Owin.Tests.csproj,
OpenTelemetry.Instrumentation.Process.Tests.csproj,
OpenTelemetry.Instrumentation.Runtime.Tests.csproj,
OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj,
OpenTelemetry.Instrumentation.Wcf.Tests.csproj,
OpenTelemetry.PersistentStorage.Abstractions.csproj,
OpenTelemetry.PersistentStorage.FileSystem.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
dotnet test $project.FullName --collect:"Code Coverage" --results-directory:"TestResults" --framework ${{ matrix.version }} --configuration Release --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true
}
- name: Install coverage tool
Expand All @@ -241,13 +268,24 @@ jobs:
flags: unittests-Solution
name: Code Coverage for solution on [${{ matrix.os }}.${{ matrix.version }}]

verify-aot-compat:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'eventcounters')
|| contains(needs.detect-changes.outputs.changes, 'runtime')
|| contains(needs.detect-changes.outputs.changes, 'aottestapp')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/verifyaotcompat.yml

build-test:
needs: [
lint-misspell-sanitycheck,
detect-changes,
lint-md,
lint-dotnet-format,
build-test-aspnet,
build-test-eventcounters,
build-test-extensions,
build-test-geneva,
build-test-onecollector,
Expand All @@ -256,8 +294,10 @@ jobs:
build-test-process,
build-test-redis,
build-test-redis-integration,
build-test-runtime,
build-test-wcf,
build-test-solution
build-test-solution,
verify-aot-compat
]
if: always() && !cancelled() && !contains(needs.*.result, 'failure')
runs-on: windows-latest
Expand Down
55 changes: 5 additions & 50 deletions .github/workflows/package-Instrumentation.EventCounters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,10 @@ on:
- 'Instrumentation.EventCounters-*' # trigger when we create a tag with prefix "Instrumentation.EventCounters-"

jobs:
build-test-pack:
runs-on: ${{ matrix.os }}
call-build-test-pack:
permissions:
contents: write
env:
PROJECT: OpenTelemetry.Instrumentation.EventCounters

strategy:
matrix:
os: [windows-latest]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all

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

- name: Install dependencies
run: dotnet restore src/${{env.PROJECT}}

- name: dotnet build ${{env.PROJECT}}
run: dotnet build src/${{env.PROJECT}} --configuration Release --no-restore -p:Deterministic=true

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

- name: dotnet pack ${{env.PROJECT}}
run: dotnet pack src/${{env.PROJECT}} --configuration Release --no-build

- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{env.PROJECT}}-packages
path: '**/${{env.PROJECT}}/bin/**/*.*nupkg'

- name: Publish Nuget
run: |
nuget push **/${{env.PROJECT}}/bin/**/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_TOKEN }} -SymbolApiKey ${{ secrets.NUGET_TOKEN }}
- name: Create GitHub Prerelease
if: ${{ (contains(github.ref_name, '-alpha.') || contains(github.ref_name, '-beta.') || contains(github.ref_name, '-rc.')) }}
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --verify-tag --notes "See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/${{ github.ref_name }}/src/${{env.PROJECT}}/CHANGELOG.md) for details." --prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
if: ${{ !(contains(github.ref_name, '-alpha.') || contains(github.ref_name, '-beta.') || contains(github.ref_name, '-rc.')) }}
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --verify-tag --notes "See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/${{ github.ref_name }}/src/${{env.PROJECT}}/CHANGELOG.md) for details." --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/Component.Package.yml
with:
project-name: OpenTelemetry.Instrumentation.EventCounters
secrets: inherit
55 changes: 5 additions & 50 deletions .github/workflows/package-Instrumentation.Runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,10 @@ on:
- 'Instrumentation.Runtime-*' # trigger when we create a tag with prefix "Instrumentation.Runtime-"

jobs:
build-test-pack:
runs-on: ${{ matrix.os }}
call-build-test-pack:
permissions:
contents: write
env:
PROJECT: OpenTelemetry.Instrumentation.Runtime

strategy:
matrix:
os: [windows-latest]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all

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

- name: Install dependencies
run: dotnet restore src/${{env.PROJECT}}

- name: dotnet build ${{env.PROJECT}}
run: dotnet build src/${{env.PROJECT}} --configuration Release --no-restore -p:Deterministic=true

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

- name: dotnet pack ${{env.PROJECT}}
run: dotnet pack src/${{env.PROJECT}} --configuration Release --no-build

- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{env.PROJECT}}-packages
path: '**/${{env.PROJECT}}/bin/**/*.*nupkg'

- name: Publish Nuget
run: |
nuget push **/${{env.PROJECT}}/bin/**/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_TOKEN }} -SymbolApiKey ${{ secrets.NUGET_TOKEN }}
- name: Create GitHub Prerelease
if: ${{ (contains(github.ref_name, '-alpha.') || contains(github.ref_name, '-beta.') || contains(github.ref_name, '-rc.')) }}
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --verify-tag --notes "See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/${{ github.ref_name }}/src/${{env.PROJECT}}/CHANGELOG.md) for details." --prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
if: ${{ !(contains(github.ref_name, '-alpha.') || contains(github.ref_name, '-beta.') || contains(github.ref_name, '-rc.')) }}
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --verify-tag --notes "See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/${{ github.ref_name }}/src/${{env.PROJECT}}/CHANGELOG.md) for details." --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/Component.Package.yml
with:
project-name: OpenTelemetry.Instrumentation.Runtime
secrets: inherit
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: Publish AOTCompatibility testApp
name: Publish & Verify AOT Compatibility

on:
pull_request:
branches: [ 'main*' ]
paths:
- 'src/OpenTelemetry.Instrumentation.Runtime/**'
- '!src/OpenTelemetry.Instrumentation.Runtime/README.md'
- 'src/OpenTelemetry.Instrumentation.EventCounters/**'
- '!src/OpenTelemetry.Instrumentation.EventCounters/README.md'
workflow_call:

jobs:
aot-test:
run-verify-aot-compat:

strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
Expand Down
33 changes: 33 additions & 0 deletions build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>

<PropertyGroup>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName)</RepoRoot>
</PropertyGroup>

<ItemGroup>
<SolutionProjects Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.EventCounters\OpenTelemetry.Instrumentation.EventCounters.csproj" />
<SolutionProjects Include="$(RepoRoot)\test\OpenTelemetry.Instrumentation.EventCounters.Tests\OpenTelemetry.Instrumentation.EventCounters.Tests.csproj" />
<SolutionProjects Include="$(RepoRoot)\examples\event-counters\**\*.csproj" />

<PackProjects Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.EventCounters\OpenTelemetry.Instrumentation.EventCounters.csproj" />

<TestProjects Include="$(RepoRoot)\test\OpenTelemetry.Instrumentation.EventCounters.Tests\OpenTelemetry.Instrumentation.EventCounters.Tests.csproj" />
</ItemGroup>

<Target Name="Build">
<MSBuild Projects="@(SolutionProjects)" Targets="Build" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="Restore">
<MSBuild Projects="@(SolutionProjects)" Targets="Restore" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="Pack">
<MSBuild Projects="@(PackProjects)" Targets="Pack" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="VSTest">
<MSBuild Projects="@(TestProjects)" Targets="VSTest" ContinueOnError="ErrorAndStop" />
</Target>

</Project>
33 changes: 33 additions & 0 deletions build/Projects/OpenTelemetry.Instrumentation.Runtime.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>

<PropertyGroup>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName)</RepoRoot>
</PropertyGroup>

<ItemGroup>
<SolutionProjects Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Runtime\OpenTelemetry.Instrumentation.Runtime.csproj" />
<SolutionProjects Include="$(RepoRoot)\test\OpenTelemetry.Instrumentation.Runtime.Tests\OpenTelemetry.Instrumentation.Runtime.Tests.csproj" />
<SolutionProjects Include="$(RepoRoot)\examples\runtime-instrumentation\**\*.csproj" />

<PackProjects Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Runtime\OpenTelemetry.Instrumentation.Runtime.csproj" />

<TestProjects Include="$(RepoRoot)\test\OpenTelemetry.Instrumentation.Runtime.Tests\OpenTelemetry.Instrumentation.Runtime.Tests.csproj" />
</ItemGroup>

<Target Name="Build">
<MSBuild Projects="@(SolutionProjects)" Targets="Build" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="Restore">
<MSBuild Projects="@(SolutionProjects)" Targets="Restore" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="Pack">
<MSBuild Projects="@(PackProjects)" Targets="Pack" ContinueOnError="ErrorAndStop" />
</Target>

<Target Name="VSTest">
<MSBuild Projects="@(TestProjects)" Targets="VSTest" ContinueOnError="ErrorAndStop" />
</Target>

</Project>
Loading

0 comments on commit 60dc97b

Please sign in to comment.