-
Notifications
You must be signed in to change notification settings - Fork 62
780 lines (672 loc) · 31.5 KB
/
all_solutions.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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
name: .NET Agent All Solutions Build
on:
pull_request:
branches:
- main
- "feature/**"
release:
types: [published]
workflow_dispatch:
schedule:
- cron: "0 9 * * 1-5"
# only allow one instance of this workflow to be running per PR or branch, cancels any that are already running
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
scripts_path: ${{ github.workspace }}\build\scripts
tools_path: ${{ github.workspace }}\build\Tools
DOTNET_NOLOGO: true
jobs:
check-modified-files:
name: Check if source files were modified, skip remaining jobs if not
uses: ./.github/workflows/check_modified_files.yml
secrets: inherit
permissions:
contents: read
pull-requests: read
shellcheck:
name: Validate shell scripts
needs: check-modified-files
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Run Shellcheck
run: |
find ${{ github.workspace }} -name "*.sh" -exec shellcheck --severity=error {} +
# This builds both FullAgent and MSIInstaller since MSIInstaller requires FullAgent artifacts.
build-fullagent-msi:
name: Build FullAgent and MSIInstaller
runs-on: windows-2022
needs:
- check-modified-files
- shellcheck
# don't run this job if triggered by Dependabot, will cause all other jobs to be skipped as well
# run this job if non-workflow files were modified, or if triggered by a release, a manual execution or schedule
if: github.actor != 'dependabot[bot]' && (needs.check-modified-files.outputs.non-workflow-files-changed == 'true' || github.event.release || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
env:
fullagent_solution_path: ${{ github.workspace }}\FullAgent.sln
msi_solution_path: ${{ github.workspace }}\src\Agent\MsiInstaller\MsiInstaller.sln
outputs:
agentVersion: ${{ steps.agentVersion.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: Build FullAgent.sln
run: |
Write-Host "dotnet build --force --configuration Release -p:AllowUnsafeBlocks=true ${{ env.fullagent_solution_path }}"
dotnet build --force --configuration Release -p:AllowUnsafeBlocks=true ${{ env.fullagent_solution_path }}
shell: powershell
- name: Create agentVersion
id: agentVersion
run: |
$agentVersion = (Get-Item "${{ github.workspace }}\src\_build\AnyCPU-Release\NewRelic.Agent.Core\net462\NewRelic.Agent.Core.dll").VersionInfo.FileVersion
echo "version=$agentVersion" >> $env:GITHUB_OUTPUT
shell: powershell
- name: Archive FullAgent Home folders
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: homefolders
path: |
${{ github.workspace }}\src\Agent\newrelichome_x64
${{ github.workspace }}\src\Agent\newrelichome_x64_coreclr
${{ github.workspace }}\src\Agent\newrelichome_x64_coreclr_linux
${{ github.workspace }}\src\Agent\newrelichome_arm64_coreclr_linux
${{ github.workspace }}\src\Agent\newrelichome_x86
${{ github.workspace }}\src\Agent\newrelichome_x86_coreclr
if-no-files-found: error
- name: Convert Code Signing Certificate Into File
id: write_cert
run: |
$filePath = '${{ github.workspace }}\newrelic_code_sign_cert.pfx'
$bytes = [Convert]::FromBase64String('${{ secrets.SIGNING_CERT }}')
[IO.File]::WriteAllBytes($filePath, $bytes)
echo "filePath=$filePath" >> $env:GITHUB_OUTPUT
shell: powershell
- name: Install Code Signing Certificate
run: |
Write-Host "certutil.exe -f -user -p <passphrase> -importPFX ${{ steps.write_cert.outputs.filePath }} NoRoot"
certutil.exe -f -user -p ${{ secrets.CERT_PASSPHRASE }} -importPFX ${{ steps.write_cert.outputs.filePath }} NoRoot
shell: powershell
- name: Add msbuild to PATH (required for MsiInstaller build)
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
- name: Build MsiInstaller.sln x86
run: |
Write-Host "MSBuild.exe -restore -m -p:Configuration=Release -p:AllowUnsafeBlocks=true -p:Platform=x86 ${{ env.msi_solution_path }}"
MSBuild.exe -restore -m -p:Configuration=Release -p:AllowUnsafeBlocks=true -p:Platform=x86 ${{ env.msi_solution_path }}
shell: powershell
- name: Build MsiInstaller.sln x64
run: |
Write-Host "MSBuild.exe -restore -m -p:Configuration=Release -p:AllowUnsafeBlocks=true -p:Platform=x64 ${{ env.msi_solution_path }}"
MSBuild.exe -restore -m -p:Configuration=Release -p:AllowUnsafeBlocks=true -p:Platform=x64 ${{ env.msi_solution_path }}
shell: powershell
- name: Archive msi _build Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: msi-build-folder-artifacts
path: ${{ github.workspace }}\src\_build
if-no-files-found: error
run-linux-container-tests:
name: Run Linux Container Tests
needs:
- build-fullagent-msi
uses: ./.github/workflows/run_linux_container_tests.yml
secrets: inherit
build-integration-tests:
needs: build-fullagent-msi
name: Build IntegrationTests
runs-on: windows-2022
env:
integration_solution_path: ${{ github.workspace }}\tests\Agent\IntegrationTests\IntegrationTests.sln
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
with:
vs-prerelease: true
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: List SDKS
run: dotnet --list-sdks
shell: powershell
- name: Build IntegrationTests.sln
run: |
Write-Host "List NuGet Sources"
dotnet nuget list source # For unknown reasons, this step is necessary to avoid subsequent problems with NuGet package restore
Write-Host "MSBuild.exe -restore -m -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=LocalDeploy ${{ env.integration_solution_path }}"
MSBuild.exe -restore -m -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=LocalDeploy ${{ env.integration_solution_path }}
shell: powershell
- name: Archive Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: integrationtests
path: |
${{ github.workspace }}\test.runsettings # Force the artifacts to use repo root as root of package.
${{ github.workspace }}\tests\Agent\IntegrationTests\**\bin\**\*
${{ github.workspace }}\tests\Agent\IntegrationTests\**\Deploy\**\*
!${{ github.workspace }}\tests\Agent\IntegrationTests\**\obj\**\*
if-no-files-found: error
build-unbounded-tests:
needs: build-fullagent-msi
name: Build UnboundedIntegrationTests
runs-on: windows-2022
env:
unbounded_solution_path: ${{ github.workspace }}\tests\Agent\IntegrationTests\UnboundedIntegrationTests.sln
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
with:
vs-prerelease: true
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: Build UnboundedIntegrationTests.sln
run: |
Write-Host "List NuGet Sources"
dotnet nuget list source # For unknown reasons, this step is necessary to avoid subsequent problems with NuGet package restore
Write-Host "MSBuild.exe -restore -m -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=LocalDeploy ${{ env.unbounded_solution_path }}"
MSBuild.exe -restore -m -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=LocalDeploy ${{ env.unbounded_solution_path }}
shell: powershell
- name: Archive Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: unboundedintegrationtests
path: |
${{ github.workspace }}\test.runsettings # Force the artifacts to use repo root as root of package.
${{ github.workspace }}\tests\Agent\IntegrationTests\**\bin\**\*
${{ github.workspace }}\tests\Agent\IntegrationTests\**\Deploy\**\*
!${{ github.workspace }}\tests\Agent\IntegrationTests\**\obj\**\*
if-no-files-found: error
run-integration-tests:
needs: [build-integration-tests]
name: Run IntegrationTests
runs-on: windows-2022
strategy:
matrix:
namespace: [
AgentFeatures,
AgentLogs,
AgentMetrics,
Api,
AppDomainCaching,
AspNetCore,
AwsLambda.AutoInstrumentation,
AwsLambda.CloudWatch,
AwsLambda.Custom,
AwsLambda.DynamoDb,
AwsLambda.General,
AwsLambda.Kinesis,
AwsLambda.S3,
AwsLambda.Ses,
AwsLambda.Sns,
AwsLambda.Sqs,
AwsLambda.WebRequest,
AzureFunction,
BasicInstrumentation,
CatInbound,
CatOutbound,
CodeLevelMetrics,
Configuration,
CSP,
CustomAttributes,
CustomInstrumentation,
DataTransmission,
DistributedTracing,
Errors,
HttpClientInstrumentation,
InfiniteTracing,
LLM,
Logging.AuditLog,
Logging.ContextData,
Logging.HsmAndCsp,
Logging.LocalDecoration,
Logging.LogLevelDetection,
Logging.MaxSamplesStored,
Logging.MetricsAndForwarding,
Logging.ZeroMaxSamplesStored,
Owin,
MassTransit,
ReJit.NetCore,
ReJit.NetFramework,
RequestHandling,
RequestHeadersCapture.AspNet,
RequestHeadersCapture.AspNetCore,
RequestHeadersCapture.EnvironmentVariables,
RequestHeadersCapture.Owin,
RequestHeadersCapture.WCF,
RestSharp,
WCF.Client.IIS.ASPDisabled,
WCF.Client.IIS.ASPEnabled,
WCF.Client.Self,
WCF.Service.IIS.ASPDisabled,
WCF.Service.IIS.ASPEnabled,
WCF.Service.Self] # maintain alphabetical order, please!
fail-fast: false # we don't want one test failure in one namespace to kill the other runs
env:
integration_tests_shared_project: ${{ github.workspace }}/tests/Agent/IntegrationTests/Shared
integration_tests_path: ${{ github.workspace }}/tests/Agent/IntegrationTests/IntegrationTests/bin/Release/net481
# Make this variable true to enable extra data-gathering and logging to help troubleshoot test failures, at the cost of additional time and resources
enhanced_logging: false
NR_DOTNET_TEST_SAVE_WORKING_DIRECTORY: 1
azure_func_exe_path: C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\func.exe
NEW_RELIC_AZURE_FUNCTION_LOG_LEVEL_OVERRIDE: 1 # enables profiler debug logs when testing an azure function
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Disable TLS 1.3
run: |
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
if(!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force
}
New-ItemProperty -Path $registryPath -Name "DisabledByDefault" -Value "1" -PropertyType DWORD -Force
New-ItemProperty -Path $registryPath -Name "Enabled" -Value "0" -PropertyType DWORD -Force
shell: powershell
- name: Create and trust .NET development SSL certificate
run: |
dotnet dev-certs https --clean
dotnet dev-certs https --export-path ./devcert.pfx --password "password1"
$pwd = ConvertTo-SecureString -String "password1" -Force -AsPlainText
Import-PfxCertificate -FilePath ./devcert.pfx -CertStoreLocation Cert:\LocalMachine\Root -Password $pwd
dotnet dev-certs https --check --trust
shell: powershell
- name: Set up secrets
env:
INTEGRATION_TEST_SECRETS: ${{ secrets.TEST_SECRETS }}
run: |
"$Env:INTEGRATION_TEST_SECRETS" | dotnet user-secrets set --project ${{ env.integration_tests_shared_project }}
shell: pwsh #this doesn't work with normal powershell due to UTF-8 BOM handling
- name: Download Agent Home Folders
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent
- name: Download Integration Test Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: integrationtests
# Should not need a path because the integration test artifacts are archived with the full directory structure
- name: Install HostableWebCore Feature
if: | # only install for the required namespaces
matrix.namespace == 'AgentFeatures' || matrix.namespace == 'AgentLogs' || matrix.namespace == 'AgentMetrics' || matrix.namespace == 'BasicInstrumentation' ||
matrix.namespace == 'CatInbound' || matrix.namespace == 'CatOutbound' || matrix.namespace == 'CodeLevelMetrics' || matrix.namespace == 'CSP' ||
matrix.namespace == 'CustomAttributes' || matrix.namespace == 'CustomInstrumentation' || matrix.namespace == 'DataTransmission' ||
matrix.namespace == 'DistributedTracing' || matrix.namespace == 'Errors' || matrix.namespace == 'HttpClientInstrumentation' ||
matrix.namespace == 'Rejit.NetFramework' || matrix.namespace == 'RequestHandling' || matrix.namespace == 'RequestHeadersCapture.AspNet' ||
matrix.namespace == 'RequestHeadersCapture.AspNetCore' || matrix.namespace == 'RequestHeadersCapture.EnvironmentVariables' ||
matrix.namespace == 'RequestHeadersCapture.WCF' || matrix.namespace == 'WCF.Client.IIS.ASPDisabled' ||
matrix.namespace == 'WCF.Client.IIS.ASPEnabled' || matrix.namespace == 'WCF.Service.IIS.ASPDisabled' ||
matrix.namespace == 'WCF.Service.IIS.ASPEnabled'
run: |
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HostableWebCore
shell: powershell
- name: Install aiohttp
if: matrix.namespace == 'DistributedTracing'
run: |
pip install aiohttp
shell: powershell
- name: Install Azure Functions Core Tools
if: matrix.namespace == 'AzureFunction'
run: |
choco install azure-functions-core-tools -y --params "'/x64'"
shell: powershell
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: Run Integration Tests
run: |
if ($Env:enhanced_logging -eq $True) {
Write-Host "List ports in use"
netstat -no
}
Write-Host "Run tests"
# Test parallelization is disabled until we can solve concurrent dotnet publish issues with ConsoleMF usage
$json = Get-Content "${{ env.integration_tests_path }}/xunit.runner.json" | ConvertFrom-Json
$json | Add-Member -Name "parallelizeAssembly" -Value $false -MemberType NoteProperty
$json | Add-Member -Name "parallelizeTestCollections" -Value $false -MemberType NoteProperty
# if ("${{ matrix.namespace }}" -like "Logging.*" ) {
# $json.parallelizeAssembly = $true
# $json.parallelizeTestCollections = $true
# }
$json | ConvertTo-Json | Out-File "${{ env.integration_tests_path }}/xunit.runner.json"
dotnet test ${{ env.integration_tests_path }}/NewRelic.Agent.IntegrationTests.dll --filter FullyQualifiedName~NewRelic.Agent.IntegrationTests.${{ matrix.namespace }} --no-build --nologo --logger "trx;LogFileName=C:\IntegrationTestWorkingDirectory\TestResults\${{ matrix.namespace }}_testResults.trx"
if ($Env:enhanced_logging -eq $True) {
Write-Host "Get HostableWebCore errors (if any)"
Get-EventLog -LogName Application -Source HostableWebCore -ErrorAction:Ignore
Write-Host "Get .NET Runtime errors (if any)"
Get-EventLog -LogName Application -Source ".NET Runtime" -EntryType "Error","Warning" -ErrorAction:Ignore
}
shell: powershell
- name: Archive integration test results on failure
if: ${{ failure() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: integration-test-results-${{ matrix.namespace }}
path: |
C:\IntegrationTestWorkingDirectory\**\*.log
C:\IntegrationTestWorkingDirectory\**\*.config
C:\IntegrationTestWorkingDirectory\TestResults\**\*TestResults.trx
if-no-files-found: error
run-unbounded-tests:
needs: [build-unbounded-tests]
name: Run Unbounded Tests
runs-on: windows-2022
strategy:
matrix:
namespace:
[
CosmosDB,
Couchbase,
Elasticsearch,
MongoDB,
Msmq,
MsSql,
MySql,
NServiceBus,
NServiceBus5,
Oracle,
Postgres,
RabbitMq,
Redis,
]
fail-fast: false # we don't want one test failure in one namespace to kill the other runs
env:
integration_tests_shared_project: ${{ github.workspace }}/tests/Agent/IntegrationTests/Shared
unbounded_tests_path: ${{ github.workspace }}/tests/Agent/IntegrationTests/UnboundedIntegrationTests/bin/Release/net481
NR_DOTNET_TEST_SAVE_WORKING_DIRECTORY: 1
# Make this variable true to enable extra data-gathering and logging to help troubleshoot test failures, at the cost of additional time and resources
enhanced_logging: false
steps:
- name: My IP
run: (Invoke-WebRequest -uri "http://ifconfig.me/ip").Content
shell: powershell
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download Agent Home Folders
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent
- name: Download Unbounded Integration Test Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: unboundedintegrationtests
# Should not need a path because the integration test artifacts are archived with the full directory structure
- name: Disable TLS 1.3
run: |
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
if(!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force
}
New-ItemProperty -Path $registryPath -Name "DisabledByDefault" -Value "1" -PropertyType DWORD -Force
New-ItemProperty -Path $registryPath -Name "Enabled" -Value "0" -PropertyType DWORD -Force
shell: powershell
- name: Install HostableWebCore Feature
if: | # only install for the required namespaces
matrix.namespace == 'Couchbase' || matrix.namespace == 'MongoDB' || matrix.namespace == 'MsSql' || matrix.namespace == 'Oracle'
run: |
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HostableWebCore
shell: powershell
- name: Install MSMQ dependencies
if: matrix.namespace == 'Msmq'
run: |
Write-Host "Installing Msmq Features"
Enable-WindowsOptionalFeature -Online -FeatureName MSMQ-Server -All
Enable-WindowsOptionalFeature -Online -FeatureName MSMQ-HTTP -All
Enable-WindowsOptionalFeature -Online -FeatureName MSMQ-Triggers -All
shell: powershell
- name: Install MsSql dependencies
if: matrix.namespace == 'MsSql'
run: |
Write-Host "Installing MSSQL CLI"
msiexec /i "${{ github.workspace }}\build\Tools\sqlncli.msi" IACCEPTSQLNCLILICENSETERMS=YES /quiet /qn /norestart
Start-Sleep 20 # Need to wait for install to finish -- takes only a few seconds, but we need to be sure.
shell: powershell
- name: Set up secrets
env:
INTEGRATION_TEST_SECRETS: ${{ secrets.TEST_SECRETS }}
run: |
"$Env:INTEGRATION_TEST_SECRETS" | dotnet user-secrets set --project ${{ env.integration_tests_shared_project }}
shell: pwsh #this doesn't work with normal powershell due to UTF-8 BOM handling
# save in case we move back to using the emulator
# - name: Start Local CosmosDB Emulator for CosmosDB Tests
# if: matrix.namespace == 'CosmosDB'
# run: |
# Write-Host "Launching Cosmos DB Emulator"
# Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
# Start-CosmosDbEmulator
# shell: pwsh
- name: Setup .NET 9 Preview
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- name: Run Unbounded Integration Tests
run: |
if ($Env:enhanced_logging -eq $True) {
Write-Host "List ports in use"
netstat -no
}
# Test parallelization is disabled until we can solve concurrent dotnet publish issues with ConsoleMF usage
$json = Get-Content "${{ env.unbounded_tests_path }}/xunit.runner.json" | ConvertFrom-Json
$json | Add-Member -Name "parallelizeAssembly" -Value $false -MemberType NoteProperty
$json | Add-Member -Name "parallelizeTestCollections" -Value $false -MemberType NoteProperty
$json | ConvertTo-Json | Out-File "${{ env.unbounded_tests_path }}/xunit.runner.json"
dotnet test ${{ env.unbounded_tests_path }}/NewRelic.Agent.UnboundedIntegrationTests.dll --filter FullyQualifiedName~NewRelic.Agent.UnboundedIntegrationTests.${{ matrix.namespace }} --no-build --nologo --logger "trx;LogFileName=C:\IntegrationTestWorkingDirectory\TestResults\${{ matrix.namespace }}_testResults.trx"
if ($Env:enhanced_logging -eq $True) {
Write-Host "Get HostableWebCore errors (if any)"
Get-EventLog -LogName Application -Source HostableWebCore -ErrorAction:Ignore
Write-Host "Get .NET Runtime errors (if any)"
Get-EventLog -LogName Application -Source ".NET Runtime" -EntryType "Error","Warning" -ErrorAction:Ignore
}
shell: powershell
- name: Archive unbounded test results on failure
if: ${{ failure() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: unbounded-test-working-directory-${{ matrix.namespace }}
path: |
C:\IntegrationTestWorkingDirectory\**\*.log
C:\IntegrationTestWorkingDirectory\**\*.config
C:\IntegrationTestWorkingDirectory\TestResults\**\*TestResults.trx
if-no-files-found: error
create-package-rpm:
needs: build-fullagent-msi
name: Create RPM Package
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download msi _build Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: msi-build-folder-artifacts
path: src/_build
- name: Download Agent Home Folders
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent
- name: Convert GPG Key Into File
id: write_gpgkey
run: |
filePath="/tmp/gpg.tar.bz2"
echo "${{ secrets.GPG_KEY }}" | base64 -d > $filePath
echo "filePath=$filePath" >> $GITHUB_OUTPUT
shell: bash
- name: Copy GPG Key to keys
run: |
mkdir ${{ github.workspace }}/build/Linux/keys
cp -f ${{ steps.write_gpgkey.outputs.filePath }} ${{ github.workspace }}/build/Linux/keys/gpg.tar.bz2
shell: bash
- name: Build RPM
run: |
agentVersion=${{ needs.build-fullagent-msi.outputs.agentVersion }}
if [[ "$agentVersion" =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]]; then
major=$(echo $agentVersion | cut -d'.' -f1)
minor=$(echo $agentVersion | cut -d'.' -f2)
patch=$(echo $agentVersion | cut -d'.' -f3)
agentVersion="${major}.${minor}.${patch}"
echo "agentVersion is simplified to $agentVersion"
fi
cd ${{ github.workspace }}/build/Linux
docker compose build build_rpm
docker compose run -e AGENT_VERSION=$agentVersion -e GPG_KEYS=/keys/gpg.tar.bz2 build_rpm
shell: bash
- name: Archive RPM Package Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: rpm-build-artifacts
path: ${{ github.workspace }}/src/_build/CoreArtifacts
if-no-files-found: error
create-package-deb:
needs: build-fullagent-msi
name: Create Debian package
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download Agent Home Folders
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent
- name: Download msi _build Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: msi-build-folder-artifacts
path: src/_build
- name: Build Debian Package
run: |
agentVersion=${{ needs.build-fullagent-msi.outputs.agentVersion }}
if [[ "$agentVersion" =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]]; then
major=$(echo $agentVersion | cut -d'.' -f1)
minor=$(echo $agentVersion | cut -d'.' -f2)
patch=$(echo $agentVersion | cut -d'.' -f3)
agentVersion="${major}.${minor}.${patch}"
echo "agentVersion is simplified to $agentVersion"
fi
cd ${{ github.workspace }}/build/Linux
docker compose build build_deb
docker compose run -e AGENT_VERSION=$agentVersion build_deb
shell: bash
- name: Archive Debian Package Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: debian-build-artifacts
path: ${{ github.workspace }}/src/_build/CoreArtifacts
if-no-files-found: error
run-artifactbuilder:
needs: [create-package-rpm, create-package-deb]
name: Run ArtifactBuilder
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download Agent Home Folders
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent
- name: Download msi _build Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: msi-build-folder-artifacts
path: src/_build
- name: Download Debian _build Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: debian-build-artifacts
path: src/_build/CoreArtifacts
- name: Download RPM _build Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: rpm-build-artifacts
path: src/_build/CoreArtifacts
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
- name: Build NewRelic.NuGetHelper
run: |
MSBuild.exe -restore -m -p:Configuration=Release ${{ github.workspace }}\build\NewRelic.NuGetHelper\NewRelic.NuGetHelper.csproj
shell: powershell
- name: Run ArtifactBuilder
run: |
${{ github.workspace }}\build\package.ps1 -configuration Release -IncludeDownloadSite
shell: powershell
- name: Archive Deploy Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: deploy-artifacts
path: |
${{ github.workspace }}\build\BuildArtifacts
if-no-files-found: error
# This job is necessary in order for us to have a branch protection rule for tests with a matrix
# if any of the matrix tests fail, this job fails and the branch protection rule keeps the PR from merging
integration-test-status:
name: Check Test Matrix Status
runs-on: ubuntu-latest
needs: [run-linux-container-tests, run-integration-tests, run-unbounded-tests]
if: always()
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Successful test run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing test run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1