TEST PR - DO NOT MERGE #4824
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# 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 | |
# 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 | |
with: | |
vs-prerelease: true | |
- 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 | |
with: | |
vs-prerelease: true | |
- 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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: 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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 | |
- 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: 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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 |