From 7f51e5525b7f8515138d101ca2bc7f740bdae188 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 13:21:26 -0700 Subject: [PATCH 1/9] CI tweaks. --- .github/codecov.yml | 8 ++--- .github/workflows/ci.yml | 31 +++++++++++++------ .github/workflows/codeql-analysis.yml | 4 +-- .github/workflows/package-validation.yml | 8 ++--- .github/workflows/publish-packages-1.0.yml | 6 ++-- OpenTelemetry.sln | 2 +- .../OpenTelemetry.proj | 4 +-- 7 files changed, 37 insertions(+), 26 deletions(-) rename OpenTelemetry.proj => build/OpenTelemetry.proj (86%) diff --git a/.github/codecov.yml b/.github/codecov.yml index b20bf1b2972..c381869ce70 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -33,22 +33,22 @@ ignore: - "test" flags: - unittests-Solution-Stable: + unittests-Solution: carryforward: true paths: - src - unittests-Solution-Experimental: + unittests-Project-Stable: carryforward: true paths: - src - unittests-Instrumentation-Stable: + unittests-Project-Experimental: carryforward: true paths: - src - unittests-Instrumentation-Experimental: + unittests-UnstableCoreLibraries-Experimental: carryforward: true paths: - src diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1a0d80bac4..7f222b07cc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: build: ['build/**', '.github/**/*.yml', '**/*.targets', '**/*.props'] shared: ['src/Shared/**'] code: ['**.cs', '**.csproj', '.editorconfig'] + solution: ['OpenTelemetry.sln'] packaged-code: ['src/**', '!**/*.md'] api-code: ['*/OpenTelemetry.Api*/**', '!**/*.md'] api-packages: ['src/OpenTelemetry.Api*/**', '!**/*.md'] @@ -50,19 +51,30 @@ jobs: || contains(needs.detect-changes.outputs.changes, 'build') uses: ./.github/workflows/dotnet-format.yml - build-test-solution-stable: + build-test-solution: needs: detect-changes if: | - contains(needs.detect-changes.outputs.changes, 'code') + contains(needs.detect-changes.outputs.changes, 'solution') || contains(needs.detect-changes.outputs.changes, 'build') || contains(needs.detect-changes.outputs.changes, 'shared') uses: ./.github/workflows/Component.BuildTest.yml with: project-name: 'OpenTelemetry.sln' + code-cov-name: 'Solution' + + build-test-project-stable: + needs: detect-changes + if: | + contains(needs.detect-changes.outputs.changes, 'code') + || contains(needs.detect-changes.outputs.changes, 'build') + || contains(needs.detect-changes.outputs.changes, 'shared') + uses: ./.github/workflows/Component.BuildTest.yml + with: + project-name: './build/OpenTelemetry.proj' project-build-commands: '-p:ExposeExperimentalFeatures=false' - code-cov-name: 'Solution-Stable' + code-cov-name: 'Project-Stable' - build-test-solution-experimental: + build-test-project-experimental: needs: detect-changes if: | contains(needs.detect-changes.outputs.changes, 'code') @@ -70,9 +82,9 @@ jobs: || contains(needs.detect-changes.outputs.changes, 'shared') uses: ./.github/workflows/Component.BuildTest.yml with: - project-name: 'OpenTelemetry.sln' + project-name: './build/OpenTelemetry.proj' project-build-commands: '-p:ExposeExperimentalFeatures=true' - code-cov-name: 'Solution-Experimental' + code-cov-name: 'Project-Experimental' # Build unstable core libraries using stable packages released to NuGet build-test-unstable-core: @@ -85,7 +97,7 @@ jobs: with: project-name: './build/UnstableCoreLibraries.proj' project-build-commands: '-p:RunningDotNetPack=true -p:ExposeExperimentalFeatures=true' - code-cov-name: 'Unstable-Core' + code-cov-name: 'UnstableCoreLibraries-Experimental' otlp-integration-test: needs: detect-changes @@ -163,8 +175,9 @@ jobs: detect-changes, lint-md, lint-dotnet-format, - build-test-solution-stable, - build-test-solution-experimental, + build-test-solution, + build-test-project-stable, + build-test-project-experimental, build-test-unstable-core, otlp-integration-test, w3c-trace-context-integration-test, diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c091dc85184..3cdd6a57b6d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,8 +39,8 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v4 - - name: dotnet pack OpenTelemetry.proj - run: dotnet pack OpenTelemetry.proj --configuration Release + - name: dotnet pack + run: dotnet pack ./build/OpenTelemetry.proj --configuration Release - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/package-validation.yml b/.github/workflows/package-validation.yml index 757b38c18a5..d1f7658ee2d 100644 --- a/.github/workflows/package-validation.yml +++ b/.github/workflows/package-validation.yml @@ -20,8 +20,8 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v4 - - name: Pack - run: dotnet pack OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=false /p:RunningDotNetPack=true + - name: dotnet pack + run: dotnet pack ./build/OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=false /p:RunningDotNetPack=true run-package-validation-experimental: runs-on: windows-latest @@ -37,5 +37,5 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v4 - - name: Pack - run: dotnet pack OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=true /p:RunningDotNetPack=true + - name: dotnet pack + run: dotnet pack ./build/OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=true /p:RunningDotNetPack=true diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index dd2e568f2d5..1391382e3ca 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -51,13 +51,13 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore OpenTelemetry.proj -p:RunningDotNetPack=true + run: dotnet restore ./build/OpenTelemetry.proj -p:RunningDotNetPack=true - name: dotnet build - run: dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true + run: dotnet build ./build/OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true - name: dotnet pack - run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || inputs.tag || '' }} + run: dotnet pack ./build/OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || inputs.tag || '' }} - name: Publish Artifacts id: upload-artifacts diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index 5150016a129..0bc7ade01a8 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -17,7 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json LICENSE.TXT = LICENSE.TXT NuGet.config = NuGet.config - OpenTelemetry.proj = OpenTelemetry.proj README.md = README.md THIRD-PARTY-NOTICES.TXT = THIRD-PARTY-NOTICES.TXT VERSIONING.md = VERSIONING.md @@ -38,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png build\OpenTelemetry.prod.loose.ruleset = build\OpenTelemetry.prod.loose.ruleset build\OpenTelemetry.prod.ruleset = build\OpenTelemetry.prod.ruleset + build\OpenTelemetry.proj = build\OpenTelemetry.proj build\OpenTelemetry.test.ruleset = build\OpenTelemetry.test.ruleset build\RELEASING.md = build\RELEASING.md build\stylecop.json = build\stylecop.json diff --git a/OpenTelemetry.proj b/build/OpenTelemetry.proj similarity index 86% rename from OpenTelemetry.proj rename to build/OpenTelemetry.proj index b55859fe017..9a4714bb6cc 100644 --- a/OpenTelemetry.proj +++ b/build/OpenTelemetry.proj @@ -6,9 +6,7 @@ - + From 6557c28a834cd959830e5f5a68690704ccb459c1 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 13:39:44 -0700 Subject: [PATCH 2/9] Fixes. --- .github/workflows/Component.BuildTest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Component.BuildTest.yml b/.github/workflows/Component.BuildTest.yml index f97c8b94f9b..61d3345c5cf 100644 --- a/.github/workflows/Component.BuildTest.yml +++ b/.github/workflows/Component.BuildTest.yml @@ -59,13 +59,13 @@ jobs: run: dotnet build ${{ inputs.project-name }} --configuration Release --no-restore ${{ inputs.project-build-commands }} - name: dotnet test ${{ inputs.project-name }} - run: dotnet test ${{ inputs.project-name }} --collect:"Code Coverage" --results-directory:TestResults --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true + run: dotnet test ${{ inputs.project-name }} --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 + run: dotnet-coverage merge -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/**/*.coverage - name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} uses: codecov/codecov-action@v4 From 940093d78bca6daff75e11186f0f0db9c92ea0c4 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 13:47:03 -0700 Subject: [PATCH 3/9] Fixes. --- .github/workflows/Component.BuildTest.yml | 2 +- build/OpenTelemetry.proj | 14 +++++++++----- build/UnstableCoreLibraries.proj | 16 ++++++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Component.BuildTest.yml b/.github/workflows/Component.BuildTest.yml index 61d3345c5cf..f5ef85e0dc3 100644 --- a/.github/workflows/Component.BuildTest.yml +++ b/.github/workflows/Component.BuildTest.yml @@ -59,7 +59,7 @@ jobs: run: dotnet build ${{ inputs.project-name }} --configuration Release --no-restore ${{ inputs.project-build-commands }} - name: dotnet test ${{ inputs.project-name }} - run: dotnet test ${{ inputs.project-name }} --collect:"Code Coverage" --results-directory:./TestResults --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true + run: dotnet test ${{ inputs.project-name }} --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 diff --git a/build/OpenTelemetry.proj b/build/OpenTelemetry.proj index 9a4714bb6cc..86987bbbe2a 100644 --- a/build/OpenTelemetry.proj +++ b/build/OpenTelemetry.proj @@ -1,14 +1,18 @@ + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName) + + - - - + + + - - + + diff --git a/build/UnstableCoreLibraries.proj b/build/UnstableCoreLibraries.proj index 8d333db2d94..7686376563a 100644 --- a/build/UnstableCoreLibraries.proj +++ b/build/UnstableCoreLibraries.proj @@ -1,12 +1,16 @@ + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName) + + - - - + + + - - - + + + From a26a533977062f9c55ad3ea4c667e63f1f07d614 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 14:50:59 -0700 Subject: [PATCH 4/9] Use OpenTelemetry.proj for dotnet format workflow. --- .github/workflows/dotnet-format.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index b6baf18aab0..46c2e1a3906 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -20,7 +20,7 @@ jobs: run: dotnet restore - name: dotnet format - run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes + run: dotnet format ./build/OpenTelemetry.proj --no-restore --verify-no-changes env: ExposeExperimentalFeatures: false @@ -38,6 +38,6 @@ jobs: run: dotnet restore - name: dotnet format - run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes + run: dotnet format ./build/OpenTelemetry.proj --no-restore --verify-no-changes env: ExposeExperimentalFeatures: true From 8082bd868ae5b8b36a96bb5d4675cc97e52a260c Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 15:39:40 -0700 Subject: [PATCH 5/9] Tweak for dotnet format not supporting proj files. --- .github/workflows/dotnet-format.yml | 20 ++++++++++++++++---- src/OpenTelemetry/Batch.cs | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index 46c2e1a3906..e8face15605 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -17,10 +17,16 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore + run: dotnet restore ./build/OpenTelemetry.proj - name: dotnet format - run: dotnet format ./build/OpenTelemetry.proj --no-restore --verify-no-changes + shell: pwsh + run: | + $projects = Get-ChildItem -Path *.csproj -Recurse + + foreach ($project in $projects) { + dotnet format $project --no-restore --verify-no-changes + } env: ExposeExperimentalFeatures: false @@ -35,9 +41,15 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore + run: dotnet restore ./build/OpenTelemetry.proj - name: dotnet format - run: dotnet format ./build/OpenTelemetry.proj --no-restore --verify-no-changes + shell: pwsh + run: | + $projects = Get-ChildItem -Path *.csproj -Recurse + + foreach ($project in $projects) { + dotnet format $project --no-restore --verify-no-changes + } env: ExposeExperimentalFeatures: true diff --git a/src/OpenTelemetry/Batch.cs b/src/OpenTelemetry/Batch.cs index b4ddd08cf17..6f16c5eeacc 100644 --- a/src/OpenTelemetry/Batch.cs +++ b/src/OpenTelemetry/Batch.cs @@ -4,6 +4,8 @@ using System.Collections; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +// Testing dotnet format workflow +using System.Linq; using OpenTelemetry.Internal; using OpenTelemetry.Logs; From 7187d1dd248328b22221a2b11a9a3f7f9fec7095 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 16:01:06 -0700 Subject: [PATCH 6/9] Revert dotnet format change. --- .github/workflows/dotnet-format.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index e8face15605..28207e005b7 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -17,16 +17,10 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore ./build/OpenTelemetry.proj + run: dotnet restore OpenTelemetry.sln - name: dotnet format - shell: pwsh - run: | - $projects = Get-ChildItem -Path *.csproj -Recurse - - foreach ($project in $projects) { - dotnet format $project --no-restore --verify-no-changes - } + run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes # Note: .proj files are currently not supported by dotnet format env: ExposeExperimentalFeatures: false @@ -44,12 +38,6 @@ jobs: run: dotnet restore ./build/OpenTelemetry.proj - name: dotnet format - shell: pwsh - run: | - $projects = Get-ChildItem -Path *.csproj -Recurse - - foreach ($project in $projects) { - dotnet format $project --no-restore --verify-no-changes - } + run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes # Note: .proj files are currently not supported by dotnet format env: ExposeExperimentalFeatures: true From 854d059df5ac9d4bdb10104e9180bb5b57faf533 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 16:02:21 -0700 Subject: [PATCH 7/9] Tweak. --- .github/workflows/dotnet-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index 28207e005b7..56f780d4dae 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -35,7 +35,7 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore ./build/OpenTelemetry.proj + run: dotnet restore ./build/OpenTelemetry.sln - name: dotnet format run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes # Note: .proj files are currently not supported by dotnet format From 7ad7c251f5ecda702d0e8f8d4dab00192ffce67a Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 16:04:24 -0700 Subject: [PATCH 8/9] Tweak. --- .github/workflows/dotnet-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index 56f780d4dae..2ea4834570f 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -35,7 +35,7 @@ jobs: uses: actions/setup-dotnet@v4 - name: dotnet restore - run: dotnet restore ./build/OpenTelemetry.sln + run: dotnet restore OpenTelemetry.sln - name: dotnet format run: dotnet format OpenTelemetry.sln --no-restore --verify-no-changes # Note: .proj files are currently not supported by dotnet format From 4ff635bc6995322aced68a1e568cd9247bb85012 Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Fri, 24 May 2024 16:10:19 -0700 Subject: [PATCH 9/9] Revert code added to test dotnet format. --- src/OpenTelemetry/Batch.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/OpenTelemetry/Batch.cs b/src/OpenTelemetry/Batch.cs index 6f16c5eeacc..b4ddd08cf17 100644 --- a/src/OpenTelemetry/Batch.cs +++ b/src/OpenTelemetry/Batch.cs @@ -4,8 +4,6 @@ using System.Collections; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -// Testing dotnet format workflow -using System.Linq; using OpenTelemetry.Internal; using OpenTelemetry.Logs;