-
Notifications
You must be signed in to change notification settings - Fork 293
397 lines (362 loc) · 15.9 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
name: Build
on:
pull_request:
branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ]
jobs:
lint-misspell-sanitycheck:
uses: ./.github/workflows/sanitycheck.yml
detect-changes:
runs-on: windows-latest
outputs:
changes: ${{ steps.changes.outputs.changes }}
steps:
- uses: AurorNZ/paths-filter@v4
id: changes
with:
filters: |
md: [ '**.md' ]
build: ['build/**', '.github/**/*.yml', '!.github/workflows/package-*', '**/*.targets', '**/*.props']
shared: ['src/Shared/**']
code: ['**.cs', '**.csproj', '.editorconfig']
aot: ['src/OpenTelemetry.Extensions.Enrichment/**']
aottestapp: ['test/OpenTelemetry.AotCompatibility.TestApp/**']
aspnet: ['*/OpenTelemetry.Instrumentation.AspNet*/**', 'examples/AspNet/**', '!**/*.md']
aws: ['*/OpenTelemetry.*.AWS*/**', '!**/*.md']
azure: ['*/OpenTelemetry.ResourceDetectors.Azure*/**', '!**/*.md']
eventcounters: ['*/OpenTelemetry.Instrumentation.EventCounters*/**', 'examples/event-counters/**', '!**/*.md']
extensions: ['*/OpenTelemetry.Extensions/**', '*/OpenTelemetry.Extensions.Tests/**', '!**/*.md']
geneva: ['*/OpenTelemetry.Exporter.Geneva*/**', '!**/*.md']
host: ['*/OpenTelemetry.ResourceDetectors.Host*/**', '!**/*.md']
onecollector: ['*/OpenTelemetry.Instrumentation.OneCollector*/**', '!**/*.md']
owin: ['*/OpenTelemetry.Instrumentation.Owin*/**', 'examples/owin/**', '!**/*.md']
persistentstorage: ['*/OpenTelemetry.PersistentStorage*/**', '!**/*.md']
process: ['*/OpenTelemetry.Instrumentation.Process*/**', 'examples/process-instrumentation/**', '!**/*.md']
processdetector: ['*/OpenTelemetry.ResourceDetectors.Process/**', '*/OpenTelemetry.ResourceDetectors.Process.Tests/**', '!**/*.md']
processruntime: ['*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**', '*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**', '!**/*.md']
redis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md']
resourcedetectors: ['*/OpenTelemetry.ResourceDetectors.*/**', '!**/*.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.ResourceDetectors.Azure*/**',
'!*/OpenTelemetry.ResourceDetectors.Host*/**',
'!*/OpenTelemetry.ResourceDetectors.Process/**',
'!*/OpenTelemetry.ResourceDetectors.Process.Tests/**',
'!*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**',
'!*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**',
'!*/OpenTelemetry.Instrumentation.EventCounters*/**',
'!examples/event-counters/**',
'!*/OpenTelemetry.Extensions/**',
'!*/OpenTelemetry.Extensions.Tests/**',
'!*/OpenTelemetry.Exporter.Geneva*/**',
'!*/OpenTelemetry.Exporter.OneCollector*/**',
'!*/OpenTelemetry.Instrumentation.Owin*/**',
'!examples/owin/**',
'!*/OpenTelemetry.PersistentStorage*/**',
'!*/OpenTelemetry.Instrumentation.Process*/**',
'!examples/process-instrumentation/**',
'!*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**',
'!examples/redis/**',
'!*/OpenTelemetry.Instrumentation.Runtime*/**',
'!examples/runtime-instrumentation/**',
'!*/OpenTelemetry.Instrumentation.Wcf*/**',
'!examples/wcf/**',
'!**/*.md'
]
lint-md:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'md')
|| contains(needs.detect-changes.outputs.changes, 'build')
uses: ./.github/workflows/markdownlint.yml
lint-dotnet-format:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'code')
|| contains(needs.detect-changes.outputs.changes, 'build')
uses: ./.github/workflows/dotnet-format.yml
build-test-aspnet:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'aspnet')
|| 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.AspNet
code-cov-name: Instrumentation.AspNet
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: |
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", "net8.0" ]'
build-test-extensions:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'extensions')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Extensions
code-cov-name: Extensions
build-test-geneva:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'geneva')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Exporter.Geneva
code-cov-name: Exporter.Geneva
build-test-host:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'host')
|| 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.Host
code-cov-name: ResourceDetectors.Host
build-test-onecollector:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'onecollector')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.Exporter.OneCollector
code-cov-name: Exporter.OneCollector
build-test-owin:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'owin')
|| 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.Owin
code-cov-name: Instrumentation.Owin
os-list: '[ "windows-latest" ]'
tfm-list: '[ "net462" ]'
build-test-persistentstorage:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'persistentstorage')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.PersistentStorage
code-cov-name: PersistentStorage
build-test-process:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'process')
|| 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.Process
code-cov-name: Instrumentation.Process
build-test-processdetector:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'processdetector')
|| 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.Process
code-cov-name: ResourceDetectors.Process
build-test-processruntime:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'processruntime')
|| 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.ProcessRuntime
code-cov-name: ResourceDetectors.ProcessRuntime
build-test-redis:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'redis')
|| 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.StackExchangeRedis
code-cov-name: Instrumentation.StackExchangeRedis
build-test-redis-integration:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'redis')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| 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: |
contains(needs.detect-changes.outputs.changes, 'wcf')
|| 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.Wcf
code-cov-name: Instrumentation.Wcf
build-test-solution:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'solution')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'shared')
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
- name: Restore, Build, & Test ${{ matrix.version }}
shell: pwsh
run: |
$projects = Get-ChildItem `
-Path test/*.Tests/*.csproj `
-Exclude `
OpenTelemetry.Exporter.Geneva.Tests.csproj,
OpenTelemetry.Exporter.OneCollector.Tests.csproj,
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.FileSystem.Tests.csproj,
OpenTelemetry.ResourceDetectors.Azure.Tests.csproj,
OpenTelemetry.ResourceDetectors.Host.Tests.csproj,
OpenTelemetry.ResourceDetectors.Process.Tests.csproj,
OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests.csproj
$failedProjects = @()
ForEach ($project in $projects)
{
dotnet test $project.FullName --collect:"Code Coverage" --results-directory:"TestResults" --framework ${{ matrix.version }} --configuration Release --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true
if ($LASTEXITCODE -ne 0)
{
$failedProjects = $failedProjects + $project
}
}
if ($failedProjects.Count -gt 0)
{
throw "dotnet test failed on '$failedProjects' project(s)"
}
- 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/codecov-action@v4
continue-on-error: true # Note: Don't fail for upload failures
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
token: ${{ secrets.CODECOV_TOKEN }}
with:
file: TestResults/Cobertura.xml
env_vars: OS,TFM
flags: unittests-Solution
name: Code Coverage for solution on [${{ matrix.os }}.${{ matrix.version }}]
codecov_yml_path: .github/codecov.yml
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, 'aws')
|| contains(needs.detect-changes.outputs.changes, 'azure')
|| contains(needs.detect-changes.outputs.changes, 'extensions')
|| contains(needs.detect-changes.outputs.changes, 'host')
|| contains(needs.detect-changes.outputs.changes, 'processdetector')
|| contains(needs.detect-changes.outputs.changes, 'processruntime')
|| contains(needs.detect-changes.outputs.changes, 'resourcedetectors')
|| contains(needs.detect-changes.outputs.changes, 'aot')
|| contains(needs.detect-changes.outputs.changes, 'aottestapp')
|| contains(needs.detect-changes.outputs.changes, 'build')
|| contains(needs.detect-changes.outputs.changes, 'redis')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/verifyaotcompat.yml
build-test:
needs: [
lint-misspell-sanitycheck,
detect-changes,
lint-md,
lint-dotnet-format,
build-test-aspnet,
build-test-azure,
build-test-eventcounters,
build-test-extensions,
build-test-geneva,
build-test-host,
build-test-onecollector,
build-test-owin,
build-test-persistentstorage,
build-test-process,
build-test-processdetector,
build-test-processruntime,
build-test-redis,
build-test-redis-integration,
build-test-runtime,
build-test-wcf,
build-test-solution,
verify-aot-compat
]
if: always() && !cancelled() && !contains(needs.*.result, 'failure')
runs-on: windows-latest
steps:
- run: echo 'build complete ✓'