*DRAFT** ci: Revert linux deploy changes #3650
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 | |
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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 NewRelic.Agent.Extensions | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1 | |
- 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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: NewRelic.OpenTracing.AmazonLambda.Tracer | |
path: ${{ github.workspace }}\src\AwsLambda\AwsLambdaOpenTracer\bin\Release\netstandard2.0-ILRepacked | |
if-no-files-found: error | |
run-linux-container-tests: | |
needs: build-fullagent-msi | |
name: Run Linux Container Tests | |
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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, | |
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, | |
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/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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@4803fad82c266c7860218e93d3024b5810c7866a # v2.6.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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: integration-test-artifacts-linux-arm64 | |
path: ${{ env.test_path }}/**/* | |
if-no-files-found: error | |
- name: Archive Test Artifacts | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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, | |
# Disabling Oracle temporarily | |
#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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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' | |
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 IntegrationTestWorkingDirectory on Failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: integration-test-artifacts | |
path: 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@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.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-integration-tests, run-unbounded-tests] | |
if: always() | |
steps: | |
- name: Successful test run | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing test run | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |