diff --git a/.ci/oauth2/setup.sh b/.ci/oauth2/setup.sh
index 890b112ee8..49af95fb16 100755
--- a/.ci/oauth2/setup.sh
+++ b/.ci/oauth2/setup.sh
@@ -14,12 +14,6 @@ declare -r keycloak_image_version='20.0'
declare -r docker_network="$docker_name_prefix-net"
declare -r rabbitmq_docker_name="$docker_name_prefix-rabbitmq"
-function err_todo
-{
- echo '[ERROR] TODO' 1>&2
- exit 69
-}
-
function mode_is_uaa
{
[[ $mode == 'uaa' ]]
diff --git a/.ci/ubuntu/gha-setup.sh b/.ci/ubuntu/gha-setup.sh
index 30517242cf..39ae79bb0c 100755
--- a/.ci/ubuntu/gha-setup.sh
+++ b/.ci/ubuntu/gha-setup.sh
@@ -27,12 +27,6 @@ set -o nounset
declare -r rabbitmq_docker_name="$docker_name_prefix-rabbitmq"
-function err_todo
-{
- echo '[ERROR] TODO' 1>&2
- exit 69
-}
-
function start_rabbitmq
{
chmod 0777 "$GITHUB_WORKSPACE/.ci/ubuntu/log"
diff --git a/.ci/windows/gha-run-tests.ps1 b/.ci/windows/gha-run-tests.ps1
index 19ffedea4f..d75f977e57 100644
--- a/.ci/windows/gha-run-tests.ps1
+++ b/.ci/windows/gha-run-tests.ps1
@@ -31,4 +31,9 @@ New-Variable -Name ci_dir -Option Constant -Value (Join-Path -Path $env:GITHUB_W
New-Variable -Name certs_dir -Option Constant -Value (Join-Path -Path $ci_dir -ChildPath 'certs')
$csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'projects' | Join-Path -ChildPath 'Unit' | Join-Path -ChildPath 'Unit.csproj')
-dotnet test --environment RABBITMQ_RABBITMQCTL_PATH=$rabbitmqctl_path --environment PASSWORD=grapefruit --environment SSL_CERTS_DIR=$certs_dir $csproj_file --no-restore --no-build --logger "console;verbosity=detailed"
+
+dotnet test --environment "RABBITMQ_RABBITMQCTL_PATH=$rabbitmqctl_path" `
+ --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' `
+ --environment 'PASSWORD=grapefruit' `
+ --environment "SSL_CERTS_DIR=$certs_dir" `
+ $csproj_file --no-restore --no-build --logger "console;verbosity=detailed"
diff --git a/.ci/windows/versions.json b/.ci/windows/versions.json
index 89002acf0a..229d93cf78 100644
--- a/.ci/windows/versions.json
+++ b/.ci/windows/versions.json
@@ -1,4 +1,4 @@
{
- "erlang": "26.1.1",
+ "erlang": "26.1.2",
"rabbitmq": "3.12.6"
}
diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml
new file mode 100644
index 0000000000..691c4bae22
--- /dev/null
+++ b/.github/workflows/build-test.yaml
@@ -0,0 +1,93 @@
+name: build/test rabbitmq-dotnet-client
+
+on:
+ - workflow_call
+
+jobs:
+ build-win32:
+ name: build/test on windows-latest
+ runs-on: windows-latest
+ # https://github.com/NuGet/Home/issues/11548
+ env:
+ NUGET_CERT_REVOCATION_MODE: offline
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v4
+ with:
+ submodules: true
+ - name: Cache installers
+ uses: actions/cache@v3
+ with:
+ # Note: the cache path is relative to the workspace directory
+ # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
+ path: ~/installers
+ key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
+ - name: Cache NuGet packages
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.nuget/packages
+ ~/AppData/Local/NuGet/v3-cache
+ key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
+ restore-keys: |
+ ${{ runner.os }}-v1-nuget-
+ - name: Install and Start RabbitMQ
+ run: .\.ci\windows\gha-setup.ps1
+ - name: List NuGet sources
+ run: dotnet nuget locals all --list
+ - name: Build
+ run: dotnet build ${{ github.workspace }}\Build.csproj
+ - name: Verify
+ run: dotnet format ${{ github.workspace }}\RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
+ - name: Test
+ run: .\.ci\windows\gha-run-tests.ps1
+ - name: Maybe upload RabbitMQ logs
+ if: failure()
+ uses: actions/upload-artifact@v3
+ with:
+ name: rabbitmq-logs
+ path: ~/AppData/Roaming/RabbitMQ/log/
+ build:
+ name: build/test on ubuntu-latest
+ runs-on: ubuntu-latest
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v4
+ with:
+ submodules: true
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 6.x
+ - name: Cache NuGet packages
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.nuget/packages
+ ~/.local/share/NuGet/v3-cache
+ key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
+ restore-keys: |
+ ${{ runner.os }}-v1-nuget-
+ - name: Start RabbitMQ
+ id: start-rabbitmq
+ run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
+ - name: List NuGet sources
+ run: dotnet nuget locals all --list
+ - name: Build
+ run: dotnet build ${{ github.workspace }}/Build.csproj
+ - name: Verify
+ run: dotnet format ${{ github.workspace }}/RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
+ - name: Test
+ run: |
+ dotnet test \
+ --environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:${{ steps.start-rabbitmq.outputs.id }}" \
+ --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' \
+ --environment 'PASSWORD=grapefruit' \
+ --environment SSL_CERTS_DIR="${{ github.workspace }}/.ci/certs" \
+ "${{ github.workspace }}/projects/Unit/Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' --framework 'net6.0'
+ - name: Maybe upload RabbitMQ logs
+ if: failure()
+ uses: actions/upload-artifact@v3
+ with:
+ name: rabbitmq-logs
+ path: ${{ github.workspace }}/.ci/ubuntu/log/
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 3247558521..d975b57934 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -7,95 +7,5 @@ on:
branches: [ main ]
jobs:
- build-win32:
- name: build/test on windows-latest
-
- runs-on: windows-latest
-
- # https://github.com/NuGet/Home/issues/11548
- env:
- NUGET_CERT_REVOCATION_MODE: offline
-
- steps:
- - name: Clone repository
- uses: actions/checkout@v4
- with:
- submodules: true
- - name: Cache installers
- uses: actions/cache@v3
- with:
- # Note: the cache path is relative to the workspace directory
- # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
- path: ~/installers
- key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
- - name: Cache NuGet packages
- uses: actions/cache@v3
- with:
- path: |
- ~/.nuget/packages
- ~/AppData/Local/NuGet/v3-cache
- key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
- restore-keys: |
- ${{ runner.os }}-v1-nuget-
- - name: Install and Start RabbitMQ
- run: .\.ci\windows\gha-setup.ps1
- - name: List NuGet sources
- run: dotnet nuget locals all --list
- - name: Build
- run: dotnet build ${{ github.workspace }}\Build.csproj
- - name: Verify
- run: dotnet format ${{ github.workspace }}\RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
- - name: Test
- run: .\.ci\windows\gha-run-tests.ps1
- - name: Maybe upload RabbitMQ logs
- if: failure()
- uses: actions/upload-artifact@v3
- with:
- name: rabbitmq-logs
- path: ~/AppData/Roaming/RabbitMQ/log/
-
- build:
- name: build/test on ubuntu-latest
-
- runs-on: ubuntu-latest
-
- steps:
- - name: Clone repository
- uses: actions/checkout@v4
- with:
- submodules: true
- - name: Setup .NET
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: 6.x
- - name: Cache NuGet packages
- uses: actions/cache@v3
- with:
- path: |
- ~/.nuget/packages
- ~/.local/share/NuGet/v3-cache
- key: ${{ runner.os }}-v0-nuget-${{ hashFiles('**/*.csproj') }}
- restore-keys: |
- ${{ runner.os }}-v0-nuget-
- - name: Start RabbitMQ
- id: start-rabbitmq
- run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
- - name: List NuGet sources
- run: dotnet nuget locals all --list
- - name: Build
- run: dotnet build ${{ github.workspace }}/Build.csproj
- - name: Verify
- run: dotnet format ${{ github.workspace }}/RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
- - name: Test
- run: |
- dotnet test \
- --environment RABBITMQ_RABBITMQCTL_PATH=DOCKER:${{ steps.start-rabbitmq.outputs.id }} \
- --environment PASSWORD=grapefruit \
- --environment SSL_CERTS_DIR="${{ github.workspace }}/.ci/certs" \
- "${{ github.workspace }}/projects/Unit/Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' --framework 'net6.0'
- - name: Maybe upload RabbitMQ logs
- if: failure()
- uses: actions/upload-artifact@v3
- with:
- name: rabbitmq-logs
- path: ${{ github.workspace }}/.ci/ubuntu/log/
+ call-build-test:
+ uses: ./.github/workflows/build-test.yaml
diff --git a/.github/workflows/publish-nuget.yaml b/.github/workflows/publish-nuget.yaml
new file mode 100644
index 0000000000..848c8e2d5e
--- /dev/null
+++ b/.github/workflows/publish-nuget.yaml
@@ -0,0 +1,25 @@
+name: publish-nuget
+
+on:
+ workflow_call:
+ secrets:
+ NUGET_API_KEY:
+ required: true
+
+jobs:
+ publish-nuget:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/cache@v3
+ with:
+ path: |
+ ~/.nuget/packages
+ ~/.local/share/NuGet/v3-cache
+ key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
+ restore-keys: |
+ ${{ runner.os }}-v1-nuget-
+ - name: Build (Release)
+ run: dotnet build ${{ github.workspace }}\projects\RabbitMQ.Client\RabbitMQ.Client.csproj --verbosity=normal --configuration=Release --property CI=true
+ - name: Publish to NuGet
+ run: dotnet nuget push --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source 'https://api.nuget.org/v3/index.json' ${{ github.workspace }}\packages\RabbitMQ.Client.7.*.nupkg
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
new file mode 100644
index 0000000000..c01e5451aa
--- /dev/null
+++ b/.github/workflows/publish.yaml
@@ -0,0 +1,15 @@
+name: publish rabbitmq-dotnet-client
+
+on:
+ release:
+ types:
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
+ - published
+
+jobs:
+ call-build-test:
+ uses: ./.github/workflows/build-test.yaml
+ call-publish-nuget:
+ uses: ./.github/workflows/publish-nuget.yaml
+ needs: call-build-test
+ secrets: inherit
diff --git a/projects/RabbitMQ.Client.OAuth2/RabbitMQ.Client.OAuth2.csproj b/projects/RabbitMQ.Client.OAuth2/RabbitMQ.Client.OAuth2.csproj
index 9b00941508..c298a474e9 100644
--- a/projects/RabbitMQ.Client.OAuth2/RabbitMQ.Client.OAuth2.csproj
+++ b/projects/RabbitMQ.Client.OAuth2/RabbitMQ.Client.OAuth2.csproj
@@ -9,7 +9,6 @@
VMware, Inc. or its affiliates.
Copyright © 2007-2023 VMware, Inc. or its affiliates.
The RabbitMQ OAuth2 Client Library for .NET enables OAuth2 token refresh for RabbitMQ.Client
- true
true
icon.png
Apache-2.0 OR MPL-2.0
@@ -32,19 +31,15 @@
README.md
-
+
true
true
+ true
-
-
- $(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-$(MinVerPreRelease)-pr.$(CONCOURSE_PULL_REQUEST_NUMBER)
- $(PackageVersion)+$(MinVerBuildMetadata)
- $(PackageVersion)
-
-
-
+
+
+
diff --git a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj
index 1a51baf82a..68ebb42a02 100644
--- a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj
+++ b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj
@@ -9,7 +9,6 @@
VMware, Inc. or its affiliates.
Copyright © 2007-2022 VMware, Inc. or its affiliates.
The RabbitMQ .NET client is the official client library for C# (and, implicitly, other .NET languages)
- true
true
icon.png
Apache-2.0 OR MPL-2.0
@@ -32,19 +31,15 @@
README.md
-
+
true
true
+ true
-
-
- $(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-$(MinVerPreRelease)-pr.$(CONCOURSE_PULL_REQUEST_NUMBER)
- $(PackageVersion)+$(MinVerBuildMetadata)
- $(PackageVersion)
-
-
-
+
+
+
diff --git a/projects/Unit/Fixtures.cs b/projects/Unit/Fixtures.cs
index d5e77e3bae..ef345789b4 100644
--- a/projects/Unit/Fixtures.cs
+++ b/projects/Unit/Fixtures.cs
@@ -372,11 +372,6 @@ internal void AssertPreconditionFailed(ShutdownEventArgs args)
AssertShutdownError(args, Constants.PreconditionFailed);
}
- internal bool InitiatedByPeerOrLibrary(ShutdownEventArgs evt)
- {
- return !(evt.Initiator == ShutdownInitiator.Application);
- }
-
//
// Concurrency
//
diff --git a/projects/Unit/TestHeartbeats.cs b/projects/Unit/TestHeartbeats.cs
index 4a74cfd3e7..40deb350f7 100644
--- a/projects/Unit/TestHeartbeats.cs
+++ b/projects/Unit/TestHeartbeats.cs
@@ -117,45 +117,35 @@ public void TestHundredsOfConnectionsWithRandomHeartbeatInterval()
protected void RunSingleConnectionTest(ConnectionFactory cf)
{
- IConnection conn = cf.CreateConnection();
- IChannel ch = conn.CreateChannel();
- bool wasShutdown = false;
-
- conn.ConnectionShutdown += (sender, evt) =>
+ using (IConnection conn = cf.CreateConnection())
{
- lock (conn)
+ using (IChannel ch = conn.CreateChannel())
{
- if (InitiatedByPeerOrLibrary(evt))
- {
- CheckInitiator(evt);
- wasShutdown = true;
- }
- }
- };
- SleepFor(30);
-
- Assert.False(wasShutdown, "shutdown event should not have been fired");
- Assert.True(conn.IsOpen, "connection should be open");
+ bool wasShutdown = false;
- conn.Close();
- }
+ conn.ConnectionShutdown += (sender, evt) =>
+ {
+ lock (conn)
+ {
+ if (InitiatedByPeerOrLibrary(evt))
+ {
+ CheckInitiator(evt);
+ wasShutdown = true;
+ }
+ }
+ };
+ SleepFor(30);
- private void CheckInitiator(ShutdownEventArgs evt)
- {
- if (InitiatedByPeerOrLibrary(evt))
- {
- Console.WriteLine(((Exception)evt.Cause).StackTrace);
- string s = string.Format("Shutdown: {0}, initiated by: {1}",
- evt, evt.Initiator);
- Console.WriteLine(s);
- Assert.Fail(s);
+ Assert.False(wasShutdown, "shutdown event should not have been fired");
+ Assert.True(conn.IsOpen, "connection should be open");
+ }
}
}
private bool LongRunningTestsEnabled()
{
string s = Environment.GetEnvironmentVariable("RABBITMQ_LONG_RUNNING_TESTS");
- if (s is null || s.Equals(""))
+ if (String.IsNullOrEmpty(s))
{
return false;
}
@@ -164,8 +154,24 @@ private bool LongRunningTestsEnabled()
private void SleepFor(int t)
{
- Console.WriteLine("Testing heartbeats, sleeping for {0} seconds", t);
+ _output.WriteLine("Testing heartbeats, sleeping for {0} seconds", t);
Thread.Sleep(t * 1000);
}
+
+ private bool InitiatedByPeerOrLibrary(ShutdownEventArgs evt)
+ {
+ return !(evt.Initiator == ShutdownInitiator.Application);
+ }
+
+ private void CheckInitiator(ShutdownEventArgs evt)
+ {
+ if (InitiatedByPeerOrLibrary(evt))
+ {
+ _output.WriteLine(((Exception)evt.Cause).StackTrace);
+ string s = string.Format("Shutdown: {0}, initiated by: {1}", evt, evt.Initiator);
+ _output.WriteLine(s);
+ Assert.Fail(s);
+ }
+ }
}
}