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] CI tweaks and improvements #5651

Merged
merged 11 commits into from
May 28, 2024
8 changes: 4 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

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

Is there still a concept called "core libraries" after instrumentation libs moved away?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's two tags:

<MinVerTagPrefix>core-</MinVerTagPrefix>
<MinVerTagPrefix>coreunstable-</MinVerTagPrefix>

But I get your point, we could probably just use stable- and unstable- since everything is now "core" 🤣 Follow-up!

carryforward: true
paths:
- src
2 changes: 1 addition & 1 deletion .github/workflows/Component.BuildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
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
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -50,29 +51,40 @@ 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')
|| 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'
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:
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

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

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 don't think so. I searched the repo for all occurrences of OpenTelemetry.proj to make sure I wasn't breaking anything. What I will do (follow-up) is mention in that guide new files\projects should be added to the solution.


- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
8 changes: 4 additions & 4 deletions .github/workflows/package-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 10 additions & 8 deletions OpenTelemetry.proj → build/OpenTelemetry.proj
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<Project>
<PropertyGroup>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
</PropertyGroup>

<ItemGroup>
<SolutionProjects Include="**\*.csproj" />
<PackProjects Include="src\**\*.csproj" />
<TestProjects Include="test\**\*.csproj" />
<SolutionProjects Include="$(RepoRoot)\**\*.csproj" />
<PackProjects Include="$(RepoRoot)\src\**\*.csproj" />
<TestProjects Include="$(RepoRoot)\test\**\*.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(RunningDotNetPack)' == 'true'">
<!-- Skip building these projects when publish packages workflow runs as
these projects need to depend upon instrumentation libraries taking a
project reference instead of package reference on API/SDK -->
<SolutionProjects Remove="docs\**\**\*.csproj" />
<SolutionProjects Remove="examples\**\*.csproj" />
<!-- Skip building these projects when publish packages workflow runs -->
<SolutionProjects Remove="$(RepoRoot)\docs\**\*.csproj" />
<SolutionProjects Remove="$(RepoRoot)\examples\**\*.csproj" />
<SolutionProjects Remove="@(TestProjects)" />
</ItemGroup>

Expand Down
16 changes: 10 additions & 6 deletions build/UnstableCoreLibraries.proj
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<Project>
<PropertyGroup>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
</PropertyGroup>

<ItemGroup>
<SolutionProjects Include="..\**\OpenTelemetry.Exporter.Prometheus.AspNetCore*.csproj" />
<SolutionProjects Include="..\**\OpenTelemetry.Exporter.Prometheus.HttpListener*.csproj" />
<SolutionProjects Include="..\**\OpenTelemetry.Shims.OpenTracing*.csproj" />
<SolutionProjects Include="$(RepoRoot)\**\OpenTelemetry.Exporter.Prometheus.AspNetCore*.csproj" />
<SolutionProjects Include="$(RepoRoot)\**\OpenTelemetry.Exporter.Prometheus.HttpListener*.csproj" />
<SolutionProjects Include="$(RepoRoot)\**\OpenTelemetry.Shims.OpenTracing*.csproj" />

<TestProjects Include="..\test\**\OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj" />
<TestProjects Include="..\test\**\OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj" />
<TestProjects Include="..\test\**\OpenTelemetry.Shims.OpenTracing.Tests.csproj" />
<TestProjects Include="$(RepoRoot)\test\**\OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj" />
<TestProjects Include="$(RepoRoot)\test\**\OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj" />
<TestProjects Include="$(RepoRoot)\test\**\OpenTelemetry.Shims.OpenTracing.Tests.csproj" />
</ItemGroup>

<Target Name="Build">
Expand Down