Skip to content

Update all projects to net6.0 #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Cache installers
uses: actions/cache@v2
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('tools/versions.json') }}
key: ${{ runner.os }}-v1-${{ hashFiles('tools/versions.json') }}
- name: Cache NuGet packages
uses: actions/cache@v2
with:
path: |
~/.nuget/packages
~/AppData/Local/NuGet/v3-cache
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
key: ${{ runner.os }}-v2-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-v1-nuget-
${{ runner.os }}-v2-nuget-
- name: Install and start RabbitMQ
run: ./tools/install.ps1
- name: List NuGet sources
Expand Down Expand Up @@ -65,16 +69,16 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Cache NuGet packages
uses: actions/cache@v2
with:
path: |
~/.nuget/packages
~/.local/share/NuGet/v3-cache
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
key: ${{ runner.os }}-v2-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-v1-nuget-
${{ runner.os }}-v2-nuget-
- name: List NuGet sources
run: dotnet nuget locals all --list
- name: Restore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test Tests/Tests.csproj --no-build --logger "console;verbosity=detailed" /p:AltCover=true
- name: Publish RabbitMQ.Stream.Client
uses: brandedoutcast/[email protected].2
uses: brandedoutcast/[email protected].5
with:
PROJECT_FILE_PATH: RabbitMQ.Stream.Client/RabbitMQ.Stream.Client.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
3 changes: 1 addition & 2 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM pivotalrabbitmq/rabbitmq-stream


RUN wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN rm packages-microsoft-prod.deb

RUN apt-get update && \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-5.0
apt-get install -y dotnet-sdk-6.0

RUN apt-get install make -y
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>RabbitMQ.Stream.Client.Cmd</RootNamespace>
</PropertyGroup>

Expand Down
11 changes: 7 additions & 4 deletions RabbitMQ.Stream.Client/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public int Write(Span<byte> span)

public class Client : IClient
{
private readonly TimeSpan defaultTimeout = TimeSpan.FromSeconds(10);

private uint correlationId = 0; // allow for some pre-amble

private byte nextPublisherId = 0;
Expand Down Expand Up @@ -278,14 +280,14 @@ await Request<UnsubscribeRequest, UnsubscribeResponse>(corr =>
return result;
}

private async ValueTask<TOut> Request<TIn, TOut>(Func<uint, TIn> request, int timeout = 10000)
private async ValueTask<TOut> Request<TIn, TOut>(Func<uint, TIn> request, TimeSpan? timeout = null)
where TIn : struct, ICommand where TOut : struct, ICommand
{
var corr = NextCorrelationId();
var tcs = PooledTaskSource<TOut>.Rent();
requests.TryAdd(corr, tcs);
await Publish(request(corr));
using CancellationTokenSource cts = new CancellationTokenSource(timeout);
using CancellationTokenSource cts = new CancellationTokenSource(timeout ?? defaultTimeout);
await using (cts.Token.Register(
valueTaskSource =>
((ManualResetValueTaskSource<TOut>) valueTaskSource).SetException(
Expand Down Expand Up @@ -450,7 +452,8 @@ public async Task<CloseResponse> Close(string reason)
return (CloseResponse) closeResponse;
}

var result = await Request<CloseRequest, CloseResponse>(corr => new CloseRequest(corr, reason));
// TODO LRB timeout
var result = await Request<CloseRequest, CloseResponse>(corr => new CloseRequest(corr, reason), TimeSpan.FromSeconds(30));
closeResponse = result;

try
Expand Down Expand Up @@ -568,4 +571,4 @@ void IValueTaskSource.OnCompleted(Action<object> continuation, object state, sho
void IValueTaskSource<T>.OnCompleted(Action<object> continuation, object state, short token,
ValueTaskSourceOnCompletedFlags flags) => _logic.OnCompleted(continuation, state, token, flags);
}
}
}
4 changes: 2 additions & 2 deletions RabbitMQ.Stream.Client/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace RabbitMQ.Stream.Client
{
public static class Consts
{
public const string ClientVersion = "1.0.0-beta.3";
public const string ClientVersion = "1.0.0-beta.4";
}
}
}
8 changes: 4 additions & 4 deletions RabbitMQ.Stream.Client/RabbitMQ.Stream.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>RabbitMQ.Stream.Client</AssemblyName>
<RootNamespace>RabbitMQ.Stream.Client</RootNamespace>
<Version>1.0.0-beta.3</Version>
<PackageVersion>1.0.0-beta.3</PackageVersion>
<Version>1.0.0-beta.4</Version>
<PackageVersion>1.0.0-beta.4</PackageVersion>
<Authors>VMware</Authors>
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client</RepositoryUrl>
<PackageDescription>The RabbitMQ Stream .NET client is the official client library for C# (and, implicitly, other .NET languages)</PackageDescription>
Expand All @@ -26,6 +26,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="system.io.pipelines" Version="5.0.1" />
<PackageReference Include="system.io.pipelines" Version="6.0.2" />
</ItemGroup>
</Project>
25 changes: 19 additions & 6 deletions Tests/ApiApproval.Approve.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace RabbitMQ.Stream.Client
public System.Threading.Tasks.Task<RabbitMQ.Stream.Client.CloseResponse> Close(string reason) { }
public System.Threading.Tasks.ValueTask<RabbitMQ.Stream.Client.CreateResponse> CreateStream(string stream, System.Collections.Generic.IDictionary<string, string> args) { }
public System.Threading.Tasks.ValueTask<bool> Credit(byte subscriptionId, ushort credit) { }
public System.Threading.Tasks.Task<System.ValueTuple<byte, RabbitMQ.Stream.Client.DeclarePublisherResponse>> DeclarePublisher(string publisherRef, string stream, System.Action<System.ReadOnlyMemory<ulong>> confirmCallback, System.Action<System.ValueTuple<, >[]> errorCallback) { }
public System.Threading.Tasks.Task<System.ValueTuple<byte, RabbitMQ.Stream.Client.DeclarePublisherResponse>> DeclarePublisher(string publisherRef, string stream, System.Action<System.ReadOnlyMemory<ulong>> confirmCallback, System.Action<System.ValueTuple<ulong, RabbitMQ.Stream.Client.ResponseCode>[]> errorCallback) { }
public System.Threading.Tasks.Task<RabbitMQ.Stream.Client.DeletePublisherResponse> DeletePublisher(byte publisherId) { }
public System.Threading.Tasks.ValueTask<RabbitMQ.Stream.Client.DeleteResponse> DeleteStream(string stream) { }
public System.Threading.Tasks.ValueTask<bool> Publish(RabbitMQ.Stream.Client.Publish publishMsg) { }
Expand All @@ -203,6 +203,7 @@ namespace RabbitMQ.Stream.Client
public ClientParameters() { }
protected ClientParameters(RabbitMQ.Stream.Client.ClientParameters original) { }
public RabbitMQ.Stream.Client.AddressResolver AddressResolver { get; set; }
public string ClientProvidedName { get; set; }
public System.Net.EndPoint Endpoint { get; set; }
protected virtual System.Type EqualityContract { get; }
public System.Action<RabbitMQ.Stream.Client.MetaDataUpdate> MetadataHandler { get; set; }
Expand Down Expand Up @@ -272,7 +273,7 @@ namespace RabbitMQ.Stream.Client
}
public static class Consts
{
public const string ClientVersion = "1.0.0-beta.3";
public const string ClientVersion = "1.0.0-beta.4";
}
public class Consumer : RabbitMQ.Stream.Client.AbstractEntity, System.IDisposable
{
Expand All @@ -281,10 +282,11 @@ namespace RabbitMQ.Stream.Client
public System.Threading.Tasks.Task StoreOffset(ulong offset) { }
public static System.Threading.Tasks.Task<RabbitMQ.Stream.Client.Consumer> Create(RabbitMQ.Stream.Client.ClientParameters clientParameters, RabbitMQ.Stream.Client.ConsumerConfig config, RabbitMQ.Stream.Client.StreamInfo metaStreamInfo) { }
}
public class ConsumerConfig : System.IEquatable<RabbitMQ.Stream.Client.ConsumerConfig>
public class ConsumerConfig : RabbitMQ.Stream.Client.INamedEntity, System.IEquatable<RabbitMQ.Stream.Client.ConsumerConfig>
{
public ConsumerConfig() { }
protected ConsumerConfig(RabbitMQ.Stream.Client.ConsumerConfig original) { }
public string ClientProvidedName { get; set; }
public System.Func<string, System.Threading.Tasks.Task> ConnectionClosedHandler { get; set; }
protected virtual System.Type EqualityContract { get; }
public System.Func<RabbitMQ.Stream.Client.Consumer, RabbitMQ.Stream.Client.MessageContext, RabbitMQ.Stream.Client.Message, System.Threading.Tasks.Task> MessageHandler { get; set; }
Expand Down Expand Up @@ -435,6 +437,10 @@ namespace RabbitMQ.Stream.Client
System.Buffers.ReadOnlySequence<byte> UnCompress(System.Buffers.ReadOnlySequence<byte> source, uint dataLen, uint unCompressedDataSize);
int Write(System.Span<byte> span);
}
public interface INamedEntity
{
string ClientProvidedName { get; set; }
}
public interface IOffsetType
{
RabbitMQ.Stream.Client.OffsetTypeEnum OffsetType { get; }
Expand Down Expand Up @@ -526,6 +532,10 @@ namespace RabbitMQ.Stream.Client
public System.Buffers.ReadOnlySequence<byte> UnCompress(System.Buffers.ReadOnlySequence<byte> source, uint dataLen, uint unCompressedDataSize) { }
public int Write(System.Span<byte> span) { }
}
public class OffsetNotFoundException : RabbitMQ.Stream.Client.ProtocolException
{
public OffsetNotFoundException(string s) { }
}
public enum OffsetTypeEnum
{
First = 1,
Expand Down Expand Up @@ -632,10 +642,11 @@ namespace RabbitMQ.Stream.Client
public System.Threading.Tasks.ValueTask Send(ulong publishingId, System.Collections.Generic.List<RabbitMQ.Stream.Client.Message> subEntryMessages, RabbitMQ.Stream.Client.CompressionType compressionType) { }
public static System.Threading.Tasks.Task<RabbitMQ.Stream.Client.Producer> Create(RabbitMQ.Stream.Client.ClientParameters clientParameters, RabbitMQ.Stream.Client.ProducerConfig config, RabbitMQ.Stream.Client.StreamInfo metaStreamInfo) { }
}
public class ProducerConfig : System.IEquatable<RabbitMQ.Stream.Client.ProducerConfig>
public class ProducerConfig : RabbitMQ.Stream.Client.INamedEntity, System.IEquatable<RabbitMQ.Stream.Client.ProducerConfig>
{
public ProducerConfig() { }
protected ProducerConfig(RabbitMQ.Stream.Client.ProducerConfig original) { }
public string ClientProvidedName { get; set; }
public System.Action<RabbitMQ.Stream.Client.Confirmation> ConfirmHandler { get; set; }
public System.Func<string, System.Threading.Tasks.Task> ConnectionClosedHandler { get; set; }
protected virtual System.Type EqualityContract { get; }
Expand Down Expand Up @@ -675,7 +686,7 @@ namespace RabbitMQ.Stream.Client
{
public const ushort Key = 4;
public byte PublisherId { get; }
public System.ValueTuple<, >[] PublishingErrors { get; }
public System.ValueTuple<ulong, RabbitMQ.Stream.Client.ResponseCode>[] PublishingErrors { get; }
public int SizeNeeded { get; }
public int Write(System.Span<byte> span) { }
}
Expand Down Expand Up @@ -734,6 +745,7 @@ namespace RabbitMQ.Stream.Client
AccessRefused = 16,
PreconditionFailed = 17,
PublisherDoesNotExist = 18,
OffsetNotFound = 19,
}
public class Routing : RabbitMQ.Stream.Client.IRouting
{
Expand Down Expand Up @@ -861,11 +873,12 @@ namespace RabbitMQ.Stream.Client
public System.Threading.Tasks.Task<bool> StreamExists(string stream) { }
public static System.Threading.Tasks.Task<RabbitMQ.Stream.Client.StreamSystem> Create(RabbitMQ.Stream.Client.StreamSystemConfig config) { }
}
public class StreamSystemConfig : System.IEquatable<RabbitMQ.Stream.Client.StreamSystemConfig>
public class StreamSystemConfig : RabbitMQ.Stream.Client.INamedEntity, System.IEquatable<RabbitMQ.Stream.Client.StreamSystemConfig>
{
public StreamSystemConfig() { }
protected StreamSystemConfig(RabbitMQ.Stream.Client.StreamSystemConfig original) { }
public RabbitMQ.Stream.Client.AddressResolver AddressResolver { get; set; }
public string ClientProvidedName { get; set; }
public System.Collections.Generic.IList<System.Net.EndPoint> Endpoints { get; set; }
protected virtual System.Type EqualityContract { get; }
public string Password { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion Tests/ApiApproval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

using System;
using System.Threading.Tasks;

using RabbitMQ.Stream.Client;
Expand All @@ -43,9 +44,11 @@ namespace Tests
[UsesVerify]
public class ApiApproval
{
[Fact(Skip="Fails on Linux")]
[SkippableFact]
public Task Approve()
{
Skip.IfNot(OperatingSystem.IsWindows());

string publicApi = typeof(Client).Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
ExcludeAttributes = new[]
Expand Down
14 changes: 7 additions & 7 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>

<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AltCover" Version="8.2.831" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="PublicApiGenerator" Version="10.2.0" />
<PackageReference Include="AltCover" Version="8.2.835" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="PublicApiGenerator" Version="10.3.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Verify.Xunit" Version="11.18.2" />
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="Verify.Xunit" Version="16.1.2" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down