From a9ee9c4e36f535807acd05ad09339bcb651681be Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Mon, 23 Oct 2023 09:29:09 -0700 Subject: [PATCH] [repo] Add dedicated CI for the OpenTelemetry.ResourceDetectors.Azure project (#1406) --- .github/codecov.yml | 5 ++ .github/workflows/ci.yml | 19 ++++++- .../package-ResourceDetectors.Azure.yml | 55 ++----------------- ...OpenTelemetry.ResourceDetectors.Azure.proj | 32 +++++++++++ opentelemetry-dotnet-contrib.sln | 2 + 5 files changed, 61 insertions(+), 52 deletions(-) create mode 100644 build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj diff --git a/.github/codecov.yml b/.github/codecov.yml index 4b0f135946..25a4fe986f 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -93,3 +93,8 @@ flags: paths: - src/OpenTelemetry.PersistentStorage.Abstractions - src/OpenTelemetry.PersistentStorage.FileSystem + + unittests-ResourceDetectors.Azure: + carryforward: true + paths: + - src/OpenTelemetry.ResourceDetectors.Azure diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ae7ba4c30..edbfc5d276 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: code: ['**.cs', '.editorconfig'] aottestapp: ['test/OpenTelemetry.AotCompatibility.TestApp/**'] aspnet: ['*/OpenTelemetry.Instrumentation.AspNet*/**', 'examples/AspNet/**', '!**/*.md'] + azure: ['*/OpenTelemetry.ResourceDetectors.Azure*/**', '!**/*.md'] eventcounters: ['*/OpenTelemetry.Instrumentation.EventCounters*/**', 'examples/event-counters/**', '!**/*.md'] extensions: ['*/OpenTelemetry.Extensions*/**', '!**/*.md'] geneva: ['*/OpenTelemetry.Exporter.Geneva*/**', '!**/*.md'] @@ -40,6 +41,7 @@ jobs: '!test/OpenTelemetry.AotCompatibility.TestApp/**', '!*/OpenTelemetry.Instrumentation.AspNet*/**', '!examples/AspNet/**', + '!*/OpenTelemetry.ResourceDetectors.Azure*/**', '!*/OpenTelemetry.Instrumentation.EventCounters*/**', '!examples/event-counters/**', '!*/OpenTelemetry.Extensions*/**', @@ -82,6 +84,17 @@ jobs: os-list: '[ "windows-latest" ]' tfm-list: '[ "net462" ]' + build-test-azure: + needs: detect-changes + if: | + contains(needs.detect-changes.outputs.changes, 'azure') + || contains(needs.detect-changes.outputs.changes, 'build') + || contains(needs.detect-changes.outputs.changes, 'shared') + uses: ./.github/workflows/Component.BuildTest.yml + with: + project-name: OpenTelemetry.ResourceDetectors.Azure + code-cov-name: ResourceDetectors.Azure + build-test-eventcounters: needs: detect-changes if: | @@ -243,8 +256,8 @@ jobs: OpenTelemetry.Instrumentation.Runtime.Tests.csproj, OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj, OpenTelemetry.Instrumentation.Wcf.Tests.csproj, - OpenTelemetry.PersistentStorage.Abstractions.csproj, - OpenTelemetry.PersistentStorage.FileSystem.csproj + OpenTelemetry.PersistentStorage.FileSystem.Tests.csproj, + OpenTelemetry.ResourceDetectors.Azure.Tests.csproj ForEach ($project in $projects) { @@ -273,6 +286,7 @@ jobs: if: | contains(needs.detect-changes.outputs.changes, 'eventcounters') || contains(needs.detect-changes.outputs.changes, 'runtime') + || contains(needs.detect-changes.outputs.changes, 'azure') || contains(needs.detect-changes.outputs.changes, 'aottestapp') || contains(needs.detect-changes.outputs.changes, 'build') || contains(needs.detect-changes.outputs.changes, 'shared') @@ -285,6 +299,7 @@ jobs: lint-md, lint-dotnet-format, build-test-aspnet, + build-test-azure, build-test-eventcounters, build-test-extensions, build-test-geneva, diff --git a/.github/workflows/package-ResourceDetectors.Azure.yml b/.github/workflows/package-ResourceDetectors.Azure.yml index 58e58d7d1c..2918b0f4ab 100644 --- a/.github/workflows/package-ResourceDetectors.Azure.yml +++ b/.github/workflows/package-ResourceDetectors.Azure.yml @@ -12,55 +12,10 @@ on: - 'ResourceDetectors.Azure-*' # trigger when we create a tag with prefix "ResourceDetectors.Azure-" jobs: - build-test-pack: - runs-on: ${{ matrix.os }} + call-build-test-pack: permissions: contents: write - env: - PROJECT: OpenTelemetry.ResourceDetectors.Azure - - 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.ResourceDetectors.Azure + secrets: inherit diff --git a/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj b/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj new file mode 100644 index 0000000000..149ae576c5 --- /dev/null +++ b/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj @@ -0,0 +1,32 @@ + + + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index e194a73c78..6435228624 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -60,6 +60,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\package-Instrumentation.StackExchangeRedis.yml = .github\workflows\package-Instrumentation.StackExchangeRedis.yml .github\workflows\package-Instrumentation.Wcf.yml = .github\workflows\package-Instrumentation.Wcf.yml .github\workflows\package-PersistentStorage.yml = .github\workflows\package-PersistentStorage.yml + .github\workflows\package-ResourceDetectors.Azure.yml = .github\workflows\package-ResourceDetectors.Azure.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 @@ -311,6 +312,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{04 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 + build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj = build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj EndProjectSection EndProject Global