From 60dc97b930811fb26c8021e31d8ef97bb2460d7e Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Thu, 19 Oct 2023 22:59:59 -0700 Subject: [PATCH] [repo] Add dedicated CI for EventCounters and Runtime instrumentation projects (#1404) --- .github/codecov.yml | 10 ++++ .github/workflows/ci.yml | 58 ++++++++++++++++--- .../package-Instrumentation.EventCounters.yml | 55 ++---------------- .../package-Instrumentation.Runtime.yml | 55 ++---------------- .../{ci-aot.yml => verifyaotcompat.yml} | 13 ++--- ...lemetry.Instrumentation.EventCounters.proj | 33 +++++++++++ ...OpenTelemetry.Instrumentation.Runtime.proj | 33 +++++++++++ opentelemetry-dotnet-contrib.sln | 4 +- 8 files changed, 142 insertions(+), 119 deletions(-) rename .github/workflows/{ci-aot.yml => verifyaotcompat.yml} (56%) create mode 100644 build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj create mode 100644 build/Projects/OpenTelemetry.Instrumentation.Runtime.proj diff --git a/.github/codecov.yml b/.github/codecov.yml index 8f6f7ee367..4b0f135946 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -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: @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f39867a53..9ae7ba4c30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,9 @@ 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'] @@ -29,13 +31,17 @@ jobs: 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*/**', @@ -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' @@ -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: | @@ -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: | @@ -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 ` @@ -212,8 +237,10 @@ 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, @@ -221,7 +248,7 @@ jobs: 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 @@ -241,6 +268,16 @@ 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, @@ -248,6 +285,7 @@ jobs: lint-md, lint-dotnet-format, build-test-aspnet, + build-test-eventcounters, build-test-extensions, build-test-geneva, build-test-onecollector, @@ -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 diff --git a/.github/workflows/package-Instrumentation.EventCounters.yml b/.github/workflows/package-Instrumentation.EventCounters.yml index 22d285eed9..0d31ed5664 100644 --- a/.github/workflows/package-Instrumentation.EventCounters.yml +++ b/.github/workflows/package-Instrumentation.EventCounters.yml @@ -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 diff --git a/.github/workflows/package-Instrumentation.Runtime.yml b/.github/workflows/package-Instrumentation.Runtime.yml index c06446fb53..7dee5caf36 100644 --- a/.github/workflows/package-Instrumentation.Runtime.yml +++ b/.github/workflows/package-Instrumentation.Runtime.yml @@ -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 diff --git a/.github/workflows/ci-aot.yml b/.github/workflows/verifyaotcompat.yml similarity index 56% rename from .github/workflows/ci-aot.yml rename to .github/workflows/verifyaotcompat.yml index 676e4ccfff..cf8425ed89 100644 --- a/.github/workflows/ci-aot.yml +++ b/.github/workflows/verifyaotcompat.yml @@ -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: diff --git a/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj b/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj new file mode 100644 index 0000000000..28db30bced --- /dev/null +++ b/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj @@ -0,0 +1,33 @@ + + + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj b/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj new file mode 100644 index 0000000000..b57a3a224c --- /dev/null +++ b/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj @@ -0,0 +1,33 @@ + + + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index d92d59d3c2..e194a73c78 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -28,7 +28,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{43CAFE52-F329-4431-87DA-7FEE1454D9A9}" ProjectSection(SolutionItems) = preProject .github\workflows\assign-reviewers.yml = .github\workflows\assign-reviewers.yml - .github\workflows\ci-aot.yml = .github\workflows\ci-aot.yml .github\workflows\ci-Exporter.OneCollector-Integration.yml = .github\workflows\ci-Exporter.OneCollector-Integration.yml .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml @@ -63,6 +62,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\package-PersistentStorage.yml = .github\workflows\package-PersistentStorage.yml .github\workflows\sanitycheck.yml = .github\workflows\sanitycheck.yml .github\workflows\stale.yml = .github\workflows\stale.yml + .github\workflows\verifyaotcompat.yml = .github\workflows\verifyaotcompat.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{824BD1DE-3FA8-4FE0-823A-FD365EAC78AF}" @@ -304,8 +304,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{04 build\Projects\OpenTelemetry.Exporter.OneCollector.proj = build\Projects\OpenTelemetry.Exporter.OneCollector.proj build\Projects\OpenTelemetry.Extensions.proj = build\Projects\OpenTelemetry.Extensions.proj build\Projects\OpenTelemetry.Instrumentation.AspNet.proj = build\Projects\OpenTelemetry.Instrumentation.AspNet.proj + build\Projects\OpenTelemetry.Instrumentation.EventCounters.proj = build\Projects\OpenTelemetry.Instrumentation.EventCounters.proj build\Projects\OpenTelemetry.Instrumentation.Owin.proj = build\Projects\OpenTelemetry.Instrumentation.Owin.proj build\Projects\OpenTelemetry.Instrumentation.Process.proj = build\Projects\OpenTelemetry.Instrumentation.Process.proj + build\Projects\OpenTelemetry.Instrumentation.Runtime.proj = build\Projects\OpenTelemetry.Instrumentation.Runtime.proj build\Projects\OpenTelemetry.Instrumentation.StackExchangeRedis.proj = build\Projects\OpenTelemetry.Instrumentation.StackExchangeRedis.proj build\Projects\OpenTelemetry.Instrumentation.Wcf.proj = build\Projects\OpenTelemetry.Instrumentation.Wcf.proj build\Projects\OpenTelemetry.PersistentStorage.proj = build\Projects\OpenTelemetry.PersistentStorage.proj