Skip to content

Commit

Permalink
Merge branch 'main' into EnableNullable
Browse files Browse the repository at this point in the history
  • Loading branch information
repl-chris authored Sep 26, 2023
2 parents 5f6fc93 + f6e7359 commit 398a5ea
Show file tree
Hide file tree
Showing 103 changed files with 1,465 additions and 801 deletions.
40 changes: 37 additions & 3 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,40 @@ comment:
require_changes: no

ignore:
- "**.md"
- "src/OpenTelemetry.Contrib.Shared" # copied from main OTel project and has code coverage there
- "test/**/*"
- "**/*.md"
- "src/Shared" # copied from main OTel project and has code coverage there
- "test"
- "examples"
- "build"

flags:
unittests:
carryforward: true
paths:
- src

unittests-Exporter.Geneva:
carryforward: true
paths:
- src/OpenTelemetry.Exporter.Geneva

unittests-Exporter.OneCollector:
carryforward: true
paths:
- src/OpenTelemetry.Exporter.OneCollector

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

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

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

69 changes: 69 additions & 0 deletions .github/workflows/Component.BuildTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build Component

on:
workflow_call:
inputs:
project-name:
required: true
type: string
code-cov-name:
required: true
type: string
code-cov-prefix:
default: 'unittests'
required: false
type: string
os-list:
default: '[ "windows-latest", "ubuntu-latest" ]'
required: false
type: string
tfm-list:
default: '[ "net462", "net6.0", "net7.0" ]'
required: false
type: string

jobs:
build-test:

strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: ${{ fromJSON(inputs.os-list) }}
version: ${{ fromJSON(inputs.tfm-list) }}
exclude:
- os: ubuntu-latest
version: net462

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

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

- name: dotnet restore build/Projects/${{ inputs.project-name }}.proj
run: dotnet restore build/Projects/${{ inputs.project-name }}.proj

- name: dotnet build build/Projects/${{ inputs.project-name }}.proj
run: dotnet build build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-restore

- name: dotnet test test/${{ inputs.project-name }}.Tests
run: dotnet test test/${{ inputs.project-name }}.Tests --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

- name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
uses: codecov/[email protected]
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
name: Code Coverage for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}]
60 changes: 60 additions & 0 deletions .github/workflows/Component.Package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Pack Component

on:
workflow_call:
inputs:
project-name:
required: true
type: string

jobs:
build-test-pack:
permissions:
contents: write

strategy:
matrix:
os: [windows-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all

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

- name: dotnet restore build/Projects/${{ inputs.project-name }}.proj
run: dotnet restore build/Projects/${{ inputs.project-name }}.proj

- name: dotnet build build/Projects/${{ inputs.project-name }}.proj
run: dotnet build build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-restore -p:Deterministic=true

- name: dotnet test test/${{ inputs.project-name }}.Tests
run: dotnet test test/${{ inputs.project-name }}.Tests --configuration Release --no-restore --no-build

- name: dotnet pack build/Projects/${{ inputs.project-name }}.proj
run: dotnet pack build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-build --no-restore

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

- name: Publish Nuget
run: |
nuget push **/${{ inputs.project-name }}/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/${{ inputs.project-name }}/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/${{ inputs.project-name }}/CHANGELOG.md) for details." --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/ci-Exporter.Geneva.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build OpenTelemetry.Exporter.Geneva

on:
pull_request:
branches: [ 'main*', 'exporter*' ]
paths:
- '*/OpenTelemetry.Exporter.Geneva*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

jobs:
call-build-test:
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Exporter.Geneva
code-cov-name: Exporter.Geneva
1 change: 1 addition & 0 deletions .github/workflows/ci-Exporter.OneCollector-Integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: [ 'main*', 'exporter*' ]
paths:
- '*/OpenTelemetry.Exporter.OneCollector*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/ci-Exporter.OneCollector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build OpenTelemetry.Exporter.OneCollector

on:
pull_request:
branches: [ 'main*', 'exporter*' ]
paths:
- '*/OpenTelemetry.Exporter.OneCollector*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

jobs:
call-build-test:
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Exporter.OneCollector
code-cov-name: Exporter.OneCollector
20 changes: 20 additions & 0 deletions .github/workflows/ci-Instrumentation.Owin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build OpenTelemetry.Instrumentation.Owin

on:
pull_request:
branches: [ 'main*', 'instrumentation*' ]
paths:
- '*/OpenTelemetry.Instrumentation.Owin*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

jobs:
call-build-test:
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Instrumentation.Owin
code-cov-name: Instrumentation.Owin
os-list: '[ "windows-latest" ]'
tfm-list: '[ "net462" ]'

37 changes: 11 additions & 26 deletions .github/workflows/ci-Instrumentation.Process.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
name: Instrumentation.Process
name: Build OpenTelemetry.Instrumentation.Process

on:
pull_request:
branches: [ 'main*' ]
branches: [ 'main*', 'instrumentation*' ]
paths:
- 'src/OpenTelemetry.Instrumentation.Process/**'
- 'test/OpenTelemetry.Instrumentation.Process.Tests/**'

env:
COMPONENT_NAME: OpenTelemetry.Instrumentation.Process
- '*/OpenTelemetry.Instrumentation.Process*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

jobs:
unit-test:
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install .NET 7 SDK
uses: actions/[email protected]
with:
dotnet-version: '7.0.x'

- name: Build
run: dotnet build --configuration Release test/${{ env.COMPONENT_NAME }}.Tests/${{ env.COMPONENT_NAME }}.Tests.csproj
call-build-test:
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Instrumentation.Process
code-cov-name: Instrumentation.Process

- name: Test
run: dotnet test test/${{ env.COMPONENT_NAME }}.Tests/bin/Release/**/${{ env.COMPONENT_NAME }}.Tests.dll --logger:"console;verbosity=detailed"
18 changes: 18 additions & 0 deletions .github/workflows/ci-Instrumentation.Wcf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build OpenTelemetry.Instrumentation.Wcf

on:
pull_request:
branches: [ 'main*', 'instrumentation*' ]
paths:
- '*/OpenTelemetry.Instrumentation.Wcf*/**'
- 'src/Shared/**'
- 'build/**'
- '!**.md'

jobs:
call-build-test:
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Instrumentation.Wcf
code-cov-name: Instrumentation.Wcf

7 changes: 0 additions & 7 deletions .github/workflows/ci-aot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Publish AOTCompatibility testApp

on:
push:
branches: [ 'main*' ]
paths:
- 'src/OpenTelemetry.Instrumentation.Runtime/**'
- '!src/OpenTelemetry.Instrumentation.Runtime/README.md'
- 'src/OpenTelemetry.Instrumentation.EventCounters/**'
- '!src/OpenTelemetry.Instrumentation.EventCounters/README.md'
pull_request:
branches: [ 'main*' ]
paths:
Expand Down
44 changes: 38 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Build

on:
push:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
- '**.md'
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
paths-ignore:
- '**.md'
- '*/OpenTelemetry.Exporter.Geneva*/**'
- '*/OpenTelemetry.Exporter.OneCollector*/**'
- '*/OpenTelemetry.Instrumentation.Owin*/**'
- '*/OpenTelemetry.Instrumentation.Process*/**'
- '*/OpenTelemetry.Instrumentation.Wcf*/**'

jobs:
build-test:
Expand All @@ -29,11 +30,42 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3

- name: Install dependencies
- name: Restore
run: dotnet restore

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

- name: Test ${{ matrix.version }}
run: dotnet test **/bin/**/${{ matrix.version }}/*.Tests.dll --logger:"console;verbosity=detailed"
shell: pwsh
run: |
$projects = Get-ChildItem `
-Path test/*.Tests/*.csproj `
-Exclude `
OpenTelemetry.Exporter.Geneva.Tests.csproj,
OpenTelemetry.Exporter.OneCollector.Tests.csproj,
OpenTelemetry.Instrumentation.Owin.Tests.csproj,
OpenTelemetry.Instrumentation.Process.Tests.csproj,
OpenTelemetry.Instrumentation.Wcf.Tests.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
}
- 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

- uses: codecov/[email protected]
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: unittests
name: Code Coverage for solution on [${{ matrix.os }}.${{ matrix.version }}]
Loading

0 comments on commit 398a5ea

Please sign in to comment.