Skip to content

Commit bcf4e59

Browse files
authored
Merge pull request #1150 from rabbitmq/rabbitmq-dotnet-client-934-6.x
Merge pull request #1149 from rabbitmq/rabbitmq-dotnet-client-934
2 parents 0c95330 + eb035d6 commit bcf4e59

File tree

10 files changed

+184
-35
lines changed

10 files changed

+184
-35
lines changed

.github/workflows/main.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: rabbitmq-dotnet-client
2+
3+
on:
4+
push:
5+
branches: [ 6.x ]
6+
pull_request:
7+
branches: [ 6.x ]
8+
9+
jobs:
10+
build-win32:
11+
name: build/test on windows-latest
12+
13+
runs-on: windows-latest
14+
15+
# https://github.com/NuGet/Home/issues/11548
16+
env:
17+
NUGET_CERT_REVOCATION_MODE: offline
18+
19+
steps:
20+
- name: Clone repository
21+
uses: actions/checkout@v2
22+
with:
23+
submodules: true
24+
- name: Cache installers
25+
uses: actions/cache@v2
26+
with:
27+
# Note: the cache path is relative to the workspace directory
28+
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
29+
path: ~/installers
30+
key: ${{ runner.os }}-v0-${{ hashFiles('tools/versions.json') }}
31+
- name: Cache NuGet packages
32+
uses: actions/cache@v2
33+
with:
34+
path: |
35+
~/.nuget/packages
36+
~/AppData/Local/NuGet/v3-cache
37+
key: ${{ runner.os }}-v0-nuget-${{ hashFiles('**/*.csproj') }}
38+
restore-keys: |
39+
${{ runner.os }}-v0-nuget-
40+
- name: Install and start RabbitMQ
41+
run: ./tools/install.ps1
42+
- name: List NuGet sources
43+
run: dotnet nuget locals all --list
44+
- name: Restore
45+
run: dotnet restore --verbosity=normal
46+
- name: ApiGen
47+
run: dotnet run --project ./projects/Apigen/Apigen.csproj --apiName:AMQP_0_9_1 ./projects/specs/amqp0-9-1.stripped.xml ./gensrc/autogenerated-api-0-9-1.cs
48+
- name: Build
49+
run: dotnet build --no-restore --verbosity=normal
50+
- name: Test
51+
run: ./tools/gha-run-tests.ps1
52+
53+
build:
54+
name: build/test on ubuntu-latest
55+
56+
runs-on: ubuntu-latest
57+
58+
services:
59+
rabbitmq:
60+
image: pivotalrabbitmq/rabbitmq:master-otp-max
61+
ports:
62+
- 5672:5672
63+
- 15672:15672
64+
65+
steps:
66+
- name: Clone repository
67+
uses: actions/checkout@v2
68+
with:
69+
submodules: true
70+
- name: Setup .NET
71+
uses: actions/setup-dotnet@v1
72+
with:
73+
dotnet-version: 3.1.x
74+
- name: Cache NuGet packages
75+
uses: actions/cache@v2
76+
with:
77+
path: |
78+
~/.nuget/packages
79+
~/.local/share/NuGet/v3-cache
80+
key: ${{ runner.os }}-v0-nuget-${{ hashFiles('**/*.csproj') }}
81+
restore-keys: |
82+
${{ runner.os }}-v0-nuget-
83+
- name: Restore
84+
run: dotnet restore --verbosity=normal
85+
- name: ApiGen
86+
run: dotnet run --project ./projects/Apigen/Apigen.csproj --apiName:AMQP_0_9_1 ./projects/specs/amqp0-9-1.stripped.xml ./gensrc/autogenerated-api-0-9-1.cs
87+
- name: Build
88+
run: dotnet build --no-restore --verbosity=normal
89+
- name: Test
90+
run: dotnet test --no-restore --no-build --logger "console;verbosity=detailed" --framework "netcoreapp3.1"
91+
env:
92+
RABBITMQ_RABBITMQCTL_PATH: DOCKER:${{job.services.rabbitmq.id}}

_site

Submodule _site updated 166 files

build.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@ECHO OFF
22
set DOTNET_CLI_TELEMETRY_OPTOUT=1
3-
dotnet restore .\RabbitMQDotNetClient.sln
4-
dotnet run --project .\projects\Apigen\Apigen.csproj --apiName:AMQP_0_9_1 .\projects\specs\amqp0-9-1.stripped.xml .\gensrc\autogenerated-api-0-9-1.cs
5-
dotnet build .\RabbitMQDotNetClient.sln
3+
dotnet restore --verbosity=normal .\RabbitMQDotNetClient.sln
4+
dotnet run --verbosity=normal --project .\projects\Apigen\Apigen.csproj --apiName:AMQP_0_9_1 .\projects\specs\amqp0-9-1.stripped.xml .\gensrc\autogenerated-api-0-9-1.cs
5+
dotnet build --verbosity=normal .\RabbitMQDotNetClient.sln

projects/RabbitMQ.Client/RabbitMQ.Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<PackageTags>rabbitmq, amqp</PackageTags>
1818
<Product>RabbitMQ</Product>
1919
<PublishRepositoryUrl>true</PublishRepositoryUrl>
20+
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-dotnet-client.git</RepositoryUrl>
2021
<IncludeSymbols>true</IncludeSymbols>
2122
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2223
<AssemblyOriginatorKeyFile>../rabbit.snk</AssemblyOriginatorKeyFile>

projects/Unit/APIApproval.Approve.verified.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,13 @@ namespace RabbitMQ.Client.Logging
847847
{
848848
public static RabbitMQ.Client.Logging.RabbitMqClientEventSource Log;
849849
public RabbitMqClientEventSource() { }
850-
[System.Diagnostics.Tracing.Event(3, Keywords=System.Diagnostics.Tracing.EventKeywords.None | System.Diagnostics.Tracing.EventKeywords.All, Level=System.Diagnostics.Tracing.EventLevel.Error, Message="ERROR")]
850+
[System.Diagnostics.Tracing.Event(3, Keywords=System.Diagnostics.Tracing.EventKeywords.None, Level=System.Diagnostics.Tracing.EventLevel.Error, Message="ERROR")]
851851
public void Error(string message, RabbitMQ.Client.Logging.RabbitMqExceptionDetail ex) { }
852852
[System.Diagnostics.Tracing.NonEvent]
853853
public void Error(string message, System.Exception ex) { }
854-
[System.Diagnostics.Tracing.Event(1, Keywords=System.Diagnostics.Tracing.EventKeywords.None | System.Diagnostics.Tracing.EventKeywords.All, Level=System.Diagnostics.Tracing.EventLevel.Informational, Message="INFO")]
854+
[System.Diagnostics.Tracing.Event(1, Keywords=System.Diagnostics.Tracing.EventKeywords.None, Level=System.Diagnostics.Tracing.EventLevel.Informational, Message="INFO")]
855855
public void Info(string message) { }
856-
[System.Diagnostics.Tracing.Event(2, Keywords=System.Diagnostics.Tracing.EventKeywords.None | System.Diagnostics.Tracing.EventKeywords.All, Level=System.Diagnostics.Tracing.EventLevel.Warning, Message="WARN")]
856+
[System.Diagnostics.Tracing.Event(2, Keywords=System.Diagnostics.Tracing.EventKeywords.None, Level=System.Diagnostics.Tracing.EventLevel.Warning, Message="WARN")]
857857
public void Warn(string message) { }
858858
public class Keywords
859859
{

projects/Unit/APIApproval.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
namespace RabbitMQ.Client.Unit
3939
{
4040
[TestFixture]
41-
[Platform(Exclude="Mono")]
41+
[Platform(Exclude="Mono,Linux")]
4242
public class APIApproval
4343
{
4444
[Test]

projects/Unit/Unit.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
15+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
1616
<PackageReference Include="NUnit" Version="3.13.2" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
18-
<PackageReference Include="PublicApiGenerator" Version="10.2.0" />
19-
<PackageReference Include="Verify.NUnit" Version="11.18.2" />
17+
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
18+
<PackageReference Include="PublicApiGenerator" Version="10.3.0" />
19+
<PackageReference Include="Verify.NUnit" Version="12.2" />
2020
</ItemGroup>
2121

2222
</Project>

tools/gha-run-tests.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
$ProgressPreference = 'Continue'
2+
$ErrorActionPreference = 'Stop'
3+
Set-StrictMode -Version 2.0
4+
5+
$erlang_reg_path = 'HKLM:\SOFTWARE\Ericsson\Erlang'
6+
if (Test-Path 'HKLM:\SOFTWARE\WOW6432Node\')
7+
{
8+
$erlang_reg_path = 'HKLM:\SOFTWARE\WOW6432Node\Ericsson\Erlang'
9+
}
10+
$erlang_erts_version = Get-ChildItem -Path $erlang_reg_path -Name
11+
$erlang_home = (Get-ItemProperty -LiteralPath $erlang_reg_path\$erlang_erts_version).'(default)'
12+
13+
Write-Host "[INFO] Setting ERLANG_HOME to '$erlang_home'..."
14+
$env:ERLANG_HOME = $erlang_home
15+
[Environment]::SetEnvironmentVariable('ERLANG_HOME', $erlang_home, 'Machine')
16+
17+
$regPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RabbitMQ'
18+
if (Test-Path 'HKLM:\SOFTWARE\WOW6432Node\')
19+
{
20+
$regPath = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\RabbitMQ'
21+
}
22+
23+
$rabbitmq_base_path = Split-Path -Parent (Get-ItemProperty $regPath 'UninstallString').UninstallString
24+
$rabbitmq_version = (Get-ItemProperty $regPath "DisplayVersion").DisplayVersion
25+
$rabbitmqctl_path = Join-Path -Path $rabbitmq_base_path -ChildPath "rabbitmq_server-$rabbitmq_version" | Join-Path -ChildPath 'sbin' | Join-Path -ChildPath 'rabbitmqctl.bat'
26+
27+
Write-Host "[INFO] Setting RABBITMQ_RABBITMQCTL_PATH to '$rabbitmqctl_path'..."
28+
$env:RABBITMQ_RABBITMQCTL_PATH = $rabbitmqctl_path
29+
[Environment]::SetEnvironmentVariable('RABBITMQ_RABBITMQCTL_PATH', $rabbitmqctl_path, 'Machine')
30+
31+
$solution_file = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'RabbitMQDotNetClient.sln'
32+
dotnet test --no-restore --no-build --logger "console;verbosity=detailed" $solution_file

tools/appveyor/install.ps1 renamed to tools/install.ps1

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ Set-StrictMode -Version 2.0
44

55
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 'Tls12'
66

7-
Write-Host '[INFO] Removing all existing versions of Erlang...'
8-
Get-ChildItem -Path 'C:\Program Files\erl*\Uninstall.exe' | %{ Start-Process -Wait -NoNewWindow -FilePath $_ -ArgumentList '/S' }
7+
$versions_path = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'tools' | Join-Path -ChildPath 'versions.json'
8+
$versions = Get-Content $versions_path | ConvertFrom-Json
9+
Write-Host "[INFO] versions: $versions"
10+
$erlang_ver = $versions.erlang
11+
$rabbitmq_ver = $versions.rabbitmq
12+
13+
$base_installers_dir = Join-Path -Path $HOME -ChildPath 'installers'
14+
if (-Not (Test-Path $base_installers_dir))
15+
{
16+
New-Item -Verbose -ItemType Directory $base_installers_dir
17+
}
918

10-
$erlang_download_url = 'https://github.com/erlang/otp/releases/download/OTP-24.2.1/otp_win64_24.2.1.exe'
11-
$erlang_installer_path = Join-Path -Path $HOME -ChildPath 'otp_win64_24.2.1.exe'
19+
$erlang_download_url = "https://github.com/erlang/otp/releases/download/OTP-$erlang_ver/otp_win64_$erlang_ver.exe"
20+
$erlang_installer_path = Join-Path -Path $base_installers_dir -ChildPath "otp_win64_$erlang_ver.exe"
1221
$erlang_install_dir = Join-Path -Path $HOME -ChildPath 'erlang'
1322

1423
Write-Host '[INFO] Downloading Erlang...'
@@ -19,14 +28,14 @@ if (-Not (Test-Path $erlang_installer_path))
1928
}
2029
else
2130
{
22-
Write-Host "[INFO] Found" $erlang_installer_path "in cache."
31+
Write-Host "[INFO] Found '$erlang_installer_path' in cache!"
2332
}
2433

2534
Write-Host "[INFO] Installing Erlang to $erlang_install_dir..."
2635
& $erlang_installer_path '/S' "/D=$erlang_install_dir" | Out-Null
2736

28-
$rabbitmq_installer_download_url = 'https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.13/rabbitmq-server-3.9.13.exe'
29-
$rabbitmq_installer_path = Join-Path -Path $HOME -ChildPath 'rabbitmq-server-3.9.13.exe'
37+
$rabbitmq_installer_download_url = "https://github.com/rabbitmq/rabbitmq-server/releases/download/v$rabbitmq_ver/rabbitmq-server-$rabbitmq_ver.exe"
38+
$rabbitmq_installer_path = Join-Path -Path $base_installers_dir -ChildPath "rabbitmq-server-$rabbitmq_ver.exe"
3039

3140
$erlang_reg_path = 'HKLM:\SOFTWARE\Ericsson\Erlang'
3241
if (Test-Path 'HKLM:\SOFTWARE\WOW6432Node\')
@@ -36,22 +45,29 @@ if (Test-Path 'HKLM:\SOFTWARE\WOW6432Node\')
3645
$erlang_erts_version = Get-ChildItem -Path $erlang_reg_path -Name
3746
$erlang_home = (Get-ItemProperty -LiteralPath $erlang_reg_path\$erlang_erts_version).'(default)'
3847

39-
Write-Host "[INFO] Setting ERLANG_HOME to $erlang_home"
48+
Write-Host "[INFO] Setting ERLANG_HOME to '$erlang_home'..."
4049
$env:ERLANG_HOME = $erlang_home
4150
[Environment]::SetEnvironmentVariable('ERLANG_HOME', $erlang_home, 'Machine')
4251

43-
Write-Host '[INFO] Downloading RabbitMQ'
52+
Write-Host "[INFO] Setting RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS..."
53+
$env:RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS = '-rabbitmq_stream advertised_host localhost'
54+
[Environment]::SetEnvironmentVariable('RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS', '-rabbitmq_stream advertised_host localhost', 'Machine')
55+
56+
Write-Host '[INFO] Downloading RabbitMQ...'
4457

4558
if (-Not (Test-Path $rabbitmq_installer_path))
4659
{
4760
Invoke-WebRequest -UseBasicParsing -Uri $rabbitmq_installer_download_url -OutFile $rabbitmq_installer_path
4861
}
4962
else
5063
{
51-
Write-Host "[INFO] Found $rabbitmq_installer_path in cache."
64+
Write-Host "[INFO] Found '$rabbitmq_installer_path' in cache!"
5265
}
5366

54-
Write-Host '[INFO] Creating Erlang cookie files'
67+
Write-Host "[INFO] Installer dir '$base_installers_dir' contents:"
68+
Get-ChildItem -Verbose -Path $base_installers_dir
69+
70+
Write-Host '[INFO] Creating Erlang cookie files...'
5571

5672
function Set-ErlangCookie {
5773
Param($Path, $Value = 'RABBITMQ-COOKIE')
@@ -65,7 +81,7 @@ $erlang_cookie_system = Join-Path -Path $env:SystemRoot -ChildPath 'System32\con
6581
Set-ErlangCookie -Path $erlang_cookie_user
6682
Set-ErlangCookie -Path $erlang_cookie_system
6783

68-
Write-Host '[INFO] Installing and starting RabbitMQ with default config'
84+
Write-Host '[INFO] Installing and starting RabbitMQ with default config...'
6985

7086
& $rabbitmq_installer_path '/S' | Out-Null
7187
(Get-Service -Name RabbitMQ).Status
@@ -79,35 +95,36 @@ $rabbitmq_base_path = Split-Path -Parent (Get-ItemProperty $regPath 'UninstallSt
7995
$rabbitmq_version = (Get-ItemProperty $regPath "DisplayVersion").DisplayVersion
8096

8197
$rabbitmq_home = Join-Path -Path $rabbitmq_base_path -ChildPath "rabbitmq_server-$rabbitmq_version"
82-
Write-Host "[INFO] Setting RABBITMQ_HOME to $rabbitmq_home"
98+
Write-Host "[INFO] Setting RABBITMQ_HOME to '$rabbitmq_home'..."
8399
[Environment]::SetEnvironmentVariable('RABBITMQ_HOME', $rabbitmq_home, 'Machine')
84100
$env:RABBITMQ_HOME = $rabbitmq_home
85101

86102
$rabbitmqctl_path = Join-Path -Path $rabbitmq_base_path -ChildPath "rabbitmq_server-$rabbitmq_version" | Join-Path -ChildPath 'sbin' | Join-Path -ChildPath 'rabbitmqctl.bat'
103+
$rabbitmq_plugins_path = Join-Path -Path $rabbitmq_base_path -ChildPath "rabbitmq_server-$rabbitmq_version" | Join-Path -ChildPath 'sbin' | Join-Path -ChildPath 'rabbitmq-plugins.bat'
87104

88-
[Environment]::SetEnvironmentVariable('RABBITMQ_RABBITMQCTL_PATH', $rabbitmqctl_path, 'Machine')
89-
Write-Host "[INFO] Setting RABBITMQ_RABBITMQCTL_PATH to $rabbitmqctl_path"
105+
Write-Host "[INFO] Setting RABBITMQ_RABBITMQCTL_PATH to '$rabbitmqctl_path'..."
90106
$env:RABBITMQ_RABBITMQCTL_PATH = $rabbitmqctl_path
107+
[Environment]::SetEnvironmentVariable('RABBITMQ_RABBITMQCTL_PATH', $rabbitmqctl_path, 'Machine')
91108

92109
$epmd_running = $false
93110
[int]$count = 1
94111

95112
$epmd_exe = Join-Path -Path $erlang_home -ChildPath "erts-$erlang_erts_version" | Join-Path -ChildPath 'bin' | Join-Path -ChildPath 'epmd.exe'
96113

97-
Write-Host "[INFO] Waiting for epmd ($epmd_exe) to report that RabbitMQ has started"
114+
Write-Host "[INFO] Waiting for epmd ($epmd_exe) to report that RabbitMQ has started..."
98115

99116
Do {
100117
$epmd_running = & $epmd_exe -names | Select-String -CaseSensitive -SimpleMatch -Quiet -Pattern 'name rabbit at port'
101118
if ($epmd_running -eq $true) {
102-
Write-Host '[INFO] epmd reports that RabbitMQ is running'
119+
Write-Host '[INFO] epmd reports that RabbitMQ is running!'
103120
break
104121
}
105122

106123
if ($count -gt 60) {
107-
throw '[ERROR] too many tries waiting for epmd to report RabbitMQ running'
124+
throw '[ERROR] too many tries waiting for epmd to report RabbitMQ running!'
108125
}
109126

110-
Write-Host "[INFO] epmd NOT reporting yet that RabbitMQ is running, count: $count"
127+
Write-Host "[INFO] epmd NOT reporting yet that RabbitMQ is running, count: '$count'..."
111128
$count = $count + 1
112129
Start-Sleep -Seconds 5
113130

@@ -126,16 +143,19 @@ Do {
126143
}
127144

128145
if ($count -gt 120) {
129-
throw '[ERROR] too many tries waiting for just one erl process to be running'
146+
throw '[ERROR] too many tries waiting for just one erl process to be running!'
130147
}
131148

132-
Write-Host '[INFO] multiple erl instances running still'
149+
Write-Host '[INFO] multiple erl instances running still...'
133150
$count = $count + 1
134151
Start-Sleep -Seconds 5
135152

136153
} While ($true)
137154

138155
$ErrorActionPreference = 'Continue'
139-
Write-Host '[INFO] Getting RabbitMQ status in 5 seconds...'
140-
Start-Sleep -Seconds 5
156+
Write-Host '[INFO] Getting RabbitMQ status...'
141157
& $rabbitmqctl_path status
158+
159+
$ErrorActionPreference = 'Continue'
160+
Write-Host '[INFO] Enabling plugins...'
161+
& $rabbitmq_plugins_path enable rabbitmq_management rabbitmq_stream rabbitmq_stream_management

tools/versions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"erlang": "24.2.1",
3+
"rabbitmq": "3.9.13"
4+
}

0 commit comments

Comments
 (0)