test: Improve integration test reliability #3060
Workflow file for this run
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 | |
# Does not run on PUSH since we have already ran all the test | |
on: | |
pull_request: | |
branches: | |
- main | |
- "feature/**" | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
build-for-release: | |
description: 'This is a Release build. Use the "real" code signing certificate.' | |
required: true | |
type: boolean | |
default: false | |
schedule: | |
- cron: "0 9 * * *" | |
# 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: | |
# This builds both FullAgent and MSIInstaller since MSIInstaller requires FullAgent artifacts. | |
build-fullagent-msi: | |
name: Build FullAgent and MSIInstaller | |
runs-on: windows-2022 | |
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1 | |
- name: Build FullAgent.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:AllowUnsafeBlocks=true ${{ env.fullagent_solution_path }}" | |
MSBuild.exe -restore -m -p: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 NewRelic.Agent.Extensions | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: NewRelic.Agent.Extensions | |
path: ${{ github.workspace }}\src\Agent\NewRelic\Agent\Extensions\NewRelic.Agent.Extensions\bin\Release | |
if-no-files-found: error | |
- name: Archive FullAgent Home folders | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
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 | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
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 | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
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: Create Self-signed code signing cert | |
if: ${{ (github.event_name == 'pull_request') || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'false') || github.event_name == 'schedule' }} | |
run: | | |
Write-Host "New-SelfSignedCertificate -DnsName "Self-signed code signing cert" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100)" | |
New-SelfSignedCertificate -DnsName "Self-signed code signing cert" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100) | |
shell: powershell | |
- 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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: msi-build-folder-artifacts | |
path: ${{ github.workspace }}\src\_build | |
if-no-files-found: error | |
- name: Archive NewRelic.OpenTracing.AmazonLambda.Tracer | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: NewRelic.OpenTracing.AmazonLambda.Tracer | |
path: ${{ github.workspace }}\src\AwsLambda\AwsLambdaOpenTracer\bin\Release\netstandard2.0-ILRepacked | |
if-no-files-found: error | |
run-linux-smoke-tests: | |
needs: build-fullagent-msi | |
name: Run Linux Smoke Tests | |
uses: ./.github/workflows/run_linux_smoke_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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1 | |
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1 | |
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
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, | |
BasicInstrumentation, | |
CatInbound, | |
CatOutbound, | |
CodeLevelMetrics, | |
Configuration, | |
CSP, | |
CustomAttributes, | |
CustomInstrumentation, | |
DataTransmission, | |
DistributedTracing, | |
Errors, | |
HttpClientInstrumentation, | |
InfiniteTracing, | |
Logging.ContextData, | |
Logging.HsmAndCsp, | |
Logging.LocalDecoration, | |
Logging.LogLevelDetection, | |
Logging.MaxSamplesStored, | |
Logging.MetricsAndForwarding, | |
Logging.ZeroMaxSamplesStored, | |
Owin, | |
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/net462 | |
# 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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: homefolders | |
path: src/Agent | |
- name: Download Integration Test Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: integrationtests | |
# Should not need a path because the integration test artifacts are archived with the full directory structure | |
- name: Install dependencies | |
run: | | |
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HostableWebCore | |
pip install aiohttp | |
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 IntegrationTestWorkingDirectory on Failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: integration-test-artifacts | |
path: | | |
C:\IntegrationTestWorkingDirectory\**\*.log | |
C:\IntegrationTestWorkingDirectory\**\*.config | |
if-no-files-found: error | |
- name: Archive Test Artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: integration-test-artifacts | |
path: C:\IntegrationTestWorkingDirectory\TestResults\**\*TestResults.trx | |
if-no-files-found: error | |
run-integration-tests-linux-arm64: | |
needs: build-fullagent-msi | |
name: Run IntegrationTests linux-arm64 | |
runs-on: ubuntu-22.04 | |
if: false | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
packages: write # for uraimo/run-on-arch-action to cache docker images | |
env: | |
test_path: ${{ github.workspace }}/tests/Agent/IntegrationTests/IntegrationTests/TestResults | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Download Agent Home Folders | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: homefolders | |
path: src/Agent | |
- name: Run test commands | |
uses: uraimo/run-on-arch-action@a8003307a739516fdd80ee6d3da8924db811b8da # v2.5.0 | |
with: | |
arch: aarch64 | |
distro: ubuntu18.04 | |
githubToken: ${{ github.token }} | |
env: | | |
test_secrets: '${{ secrets.TEST_SECRETS }}' | |
NR_DOTNET_TEST_SAVE_WORKING_DIRECTORY: 1 | |
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 | |
install: | | |
apt-get update -q -y && apt-get install -q -y curl | |
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 | |
mkdir -p /usr/share/dotnet | |
curl -sSL https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.414/dotnet-sdk-3.1.414-linux-arm64.tar.gz | tar -xzC /usr/share/dotnet | |
curl -sSL https://dotnetcli.azureedge.net/dotnet/Sdk/5.0.401/dotnet-sdk-5.0.401-linux-arm64.tar.gz | tar -xzC /usr/share/dotnet | |
curl -sSL https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-arm64.tar.gz | tar -xzC /usr/share/dotnet | |
ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet | |
dotnet help | |
dockerRunArgs: | | |
--volume "${{ env.test_path }}:/tmp/IntegrationTestWorkingDirectory" | |
run: | | |
cd tests/Agent/IntegrationTests/IntegrationTests | |
echo $test_secrets | dotnet user-secrets set --project "../Shared" | |
dotnet test -f netcoreapp3.1 -c Release -l "trx" --filter "FullyQualifiedName~ApiCallsTestsCore|FullyQualifiedName~InfiniteTracingNetCoreLatestTests" | |
- name: Archive IntegrationTestWorkingDirectory on Failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: integration-test-artifacts-linux-arm64 | |
path: ${{ env.test_path }}/**/* | |
if-no-files-found: error | |
- name: Archive Test Artifacts | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
if: ${{ always() }} | |
with: | |
name: integration-test-artifacts-linux-arm64 | |
path: ${{ env.test_path }}/*.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/net462 | |
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Download Agent Home Folders | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: homefolders | |
path: src/Agent | |
- name: Download Unbounded Integration Test Artifacts | |
uses: actions/download-artifact/@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
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 dependencies | |
run: | | |
Write-Host "Installing HostableWebCore Feature" | |
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HostableWebCore | |
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 | |
if ("${{ matrix.namespace }}" -eq "MsSql") { | |
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.UNBOUNDED_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' | |
uses: southpolesteve/cosmos-emulator-github-action@2b1168b52481f972890f5da2ff8f9d2cc3707804 # v1 | |
- 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 IntegrationTestWorkingDirectory on Failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: integration-test-artifacts | |
path: | | |
C:\IntegrationTestWorkingDirectory\**\*.log | |
C:\IntegrationTestWorkingDirectory\**\*.config | |
if-no-files-found: error | |
- name: Archive Test Artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: integration-test-artifacts | |
path: C:\IntegrationTestWorkingDirectory\TestResults\**\*TestResults.trx | |
if-no-files-found: error | |
create-package-rpm: | |
needs: build-fullagent-msi | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
name: Create RPM Package | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Download msi _build Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: msi-build-folder-artifacts | |
path: src/_build | |
- name: Download Agent Home Folders | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: rpm-build-artifacts | |
path: ${{ github.workspace }}/src/_build/CoreArtifacts | |
if-no-files-found: error | |
create-package-deb: | |
needs: build-fullagent-msi | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
name: Create Debian package | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Download Agent Home Folders | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: homefolders | |
path: src/Agent | |
- name: Download msi _build Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
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] | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
name: Run ArtifactBuilder | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Download Agent Home Folders | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: homefolders | |
path: src/Agent | |
- name: Download msi _build Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: msi-build-folder-artifacts | |
path: src/_build | |
- name: Download Debian _build Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: debian-build-artifacts | |
path: src/_build/CoreArtifacts | |
- name: Download RPM _build Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: rpm-build-artifacts | |
path: src/_build/CoreArtifacts | |
- name: Download NewRelic.Agent.Extensions | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: NewRelic.Agent.Extensions | |
path: src/Agent/NewRelic/Agent/Extensions/NewRelic.Agent.Extensions/bin/Release | |
- name: Download NewRelic.OpenTracing.AmazonLambda.Tracer | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: NewRelic.OpenTracing.AmazonLambda.Tracer | |
path: src/AwsLambda/AwsLambdaOpenTracer/bin/Release/netstandard2.0-ILRepacked | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1 | |
- 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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: deploy-artifacts | |
path: | | |
${{ github.workspace }}\build\BuildArtifacts | |
${{ github.workspace }}\deploy | |
if-no-files-found: error | |
run-multiverse_testing_suite: | |
permissions: | |
contents: write | |
name: Build and Publish Multiverse Testing Suite | |
needs: build-fullagent-msi | |
if: ${{ github.event.release || (github.event_name == 'workflow_dispatch' && github.event.inputs.build-for-release == 'true') }} | |
uses: newrelic/newrelic-dotnet-agent/.github/workflows/multiverse_run.yml@main | |
with: | |
agentVersion: ${{ needs.build-fullagent-msi.outputs.agentVersion }} |