Skip to content
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

Update CI to enable net7.0 preview builds #1677

Merged
merged 5 commits into from
Sep 7, 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
9 changes: 8 additions & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ jobs:
- name: Update SubModules
if: steps.filter.outputs.src == 'true'
run: git submodule update --init --recursive

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
7.0.x
6.0.x
5.0.x
include-prerelease: true
- name: Build with dotnet
run: "dotnet build AzureSignalR.sln /p:DisableNet461Tests=true"
if: steps.filter.outputs.src == 'true'
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ jobs:
- name: Update SubModules
run: git submodule update --init --recursive
if: steps.filter.outputs.src == 'true'
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
7.0.x
6.0.x
5.0.x
include-prerelease: true
- name: Build with dotnet
run: "dotnet build AzureSignalR.sln /p:DisableNet461Tests=true"
if: steps.filter.outputs.src == 'true'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
7.0.x
6.0.x
5.0.x
include-prerelease: true

- name: Test
run: dotnet test
Expand Down
32 changes: 6 additions & 26 deletions docs/build-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Building Azure SignalR Service SDK from source allows you tweak and customize th

Building Azure SignalR Service SDK requires:

* Latest Visual Studio. <https://visualstudio.com>
* Latest Visual Studio (include pre-release). <https://visualstudio.com>
* Git. <https://git-scm.org>
* AspNetCore 3.0 SDK (Version >= 3.0.0). <https://dotnet.microsoft.com/download/dotnet-core/3.0>
* .NET SDK (Version >= 7.0.0-preview.7). <https://dotnet.microsoft.com/download/dotnet>

## Clone the source code

Expand All @@ -25,34 +25,14 @@ git submodule update --init --recursive

## Building on command-line

You can build the entire project on command line with the `build.cmd`/`.sh` scripts.
You can build the entire project on command line with the [`dotnet` command](https://docs.microsoft.com/dotnet/core/tools/dotnet). Run command below in the repo's root folder.

On Windows:
```
.\build.cmd
```

On macOS/Linux:
```
./build.sh
dotnet build
```

## Building in Visual Studio

Before opening our .sln files in Visual Studio or VS Code, it is suggested to run `.\build.cmd` to make sure all the dependencies are restored correctly.

The solution file is **AzureSignalR.sln** in the root.

## Build properties

Additional properties can be added as an argument in the form `/property:$name=$value`, or `/p:$name=$value` for short. For example:
```
.\build.cmd /p:Configuration=Release
```

Common properties include:
Before opening our .sln files in Visual Studio or VS Code, it is suggested to run `dotnet restore` to make sure all the dependencies are restored correctly.

Property | Description
-------------------------|-------------------------------------------------------------------------------------------------------------
BuildNumber | (string). A specific build number, typically from a CI counter, which is appended to the preview1 label.
Configuration | `Debug` or `Release`. Default = `Debug`.
The solution file is **AzureSignalR.sln** in the root.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
JialinXin marked this conversation as resolved.
Show resolved Hide resolved
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DefineConstants>MULTIFRAMEWORK</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class TestEndpointServiceConnectionContainerTests : VerifiableLoggedTest
private readonly string ConnectionString2 = string.Format(ConnectionStringFormatter, Url2);
private readonly string ConnectionString3 = string.Format(ConnectionStringFormatter, Url3);
private static readonly JoinGroupWithAckMessage DefaultGroupMessage = new JoinGroupWithAckMessage("a", "a", -1);
private const int TimeoutSec = 10000;

public TestEndpointServiceConnectionContainerTests(ITestOutputHelper output) : base(output)
{
Expand Down Expand Up @@ -1050,8 +1051,8 @@ public async Task TestEndpointManagerWithAddEndpointsWithServersTag()
var serversTag = "Server1;Server2;Server3";
await Task.WhenAll(containers.Select(c => c.MockReceivedServersPing(serversTag)));

// wait one interval+ for Ready state and check negotiation is added.
await Task.Delay(6000);
await hubEndpoints[1].ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

ngoEps = sem.GetEndpoints("hub").OrderBy(x => x.Name).ToArray();
Assert.Equal(2, ngoEps.Length);
Expand Down Expand Up @@ -1162,7 +1163,8 @@ public async Task TestEndpointManagerWithRemovedEndpointsWithClients()

// Mock client now drops and able to remove endpoints
await Task.WhenAll(containers.Select(x => x.MockReceivedStatusPing(false)));
await Task.Delay(6000);
await hubEndpoints[1].ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

// validate container side updated
hubEndpoints = container.GetOnlineEndpoints().ToArray();
Expand Down Expand Up @@ -1242,7 +1244,8 @@ public async Task TestEndpointManagerWithMultiHubsWithEndpointTypeUpdate()
await Task.WhenAll(containers.Select(x => x.MockReceivedServersPing("aaa;bbb")));
containers1 = container1.GetTestOnlineContainers();
await Task.WhenAll(containers1.Select(x => x.MockReceivedServersPing("aaa;bbb")));
await Task.Delay(6000);
await hubEndpoints.Single(x => x.Name == "22" && x.EndpointType == EndpointType.Primary).ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

ngoEps = sem.GetEndpoints("hub").OrderBy(x => x.Name).ToArray();
Assert.Equal(2, ngoEps.Length);
Expand All @@ -1255,7 +1258,8 @@ public async Task TestEndpointManagerWithMultiHubsWithEndpointTypeUpdate()
await Task.WhenAll(containers.Select(x => x.MockReceivedStatusPing(false)));
containers1 = container1.GetTestOnlineContainers();
await Task.WhenAll(containers1.Select(x => x.MockReceivedStatusPing(false)));
await Task.Delay(6000);
await hubEndpoints.Single(x => x.Name == "22" && x.EndpointType == EndpointType.Secondary).ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

// validate container updated as well
hubEndpoints = container.GetOnlineEndpoints().OrderBy(x => x.Name).ToArray();
Expand Down Expand Up @@ -1347,7 +1351,8 @@ public async Task TestEndpointManagerWithMultiHubsWithServerEndpointUpdate()
await Task.WhenAll(containers.Select(x => x.MockReceivedServersPing("aaa;bbb")));
containers1 = container1.GetTestOnlineContainers();
await Task.WhenAll(containers1.Select(x => x.MockReceivedServersPing("aaa;bbb")));
await Task.Delay(6000);
await hubEndpoints.Single(x => x.Name == "1" && x.ServerEndpoint.AbsoluteUri == testSe).ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);
JialinXin marked this conversation as resolved.
Show resolved Hide resolved

ngoEps = sem.GetEndpoints("hub").OrderBy(x => x.Name).ToArray();
Assert.Equal(2, ngoEps.Length);
Expand All @@ -1359,7 +1364,8 @@ public async Task TestEndpointManagerWithMultiHubsWithServerEndpointUpdate()
await Task.WhenAll(containers.Select(x => x.MockReceivedStatusPing(false)));
containers1 = container1.GetTestOnlineContainers();
await Task.WhenAll(containers1.Select(x => x.MockReceivedStatusPing(false)));
await Task.Delay(6000);
await hubEndpoints.Single(x => x.Name == "1" && x.ServerEndpoint.AbsoluteUri == Url1).ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

// validate container updated as well
hubEndpoints = container.GetOnlineEndpoints().OrderBy(x => x.Name).ToArray();
Expand Down Expand Up @@ -1424,8 +1430,8 @@ public async Task TestEndpointManagerWithReloadMultipleTimes()
var serversTag = "Server1;Server2;Server3";
await Task.WhenAll(containers.Select(c => c.MockReceivedServersPing(serversTag)));

// wait one interval+ for Ready state and check negotiation is added.
await Task.Delay(6000);
await hubEndpoints[1].ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

ngoEps = sem.GetEndpoints("hub").OrderBy(x => x.Name).ToArray();
Assert.Equal(2, ngoEps.Length);
Expand All @@ -1449,7 +1455,7 @@ public async Task TestEndpointManagerWithReloadMultipleTimes()
_ = sem.TestReloadServiceEndpoints(newEndpoints, 10);

// validate container side not updated
hubEndpoints = container.GetOnlineEndpoints().ToArray();
hubEndpoints = container.GetOnlineEndpoints().OrderBy(x => x.Name).ToArray();
Assert.Equal(2, hubEndpoints.Length);
Assert.Equal("1", hubEndpoints[0].Name);

Expand All @@ -1460,7 +1466,8 @@ public async Task TestEndpointManagerWithReloadMultipleTimes()

// Mock client now drops and able to remove endpoints
await Task.WhenAll(containers.Select(x => x.MockReceivedStatusPing(false)));
await Task.Delay(6000);
await hubEndpoints[0].ScaleTask.OrTimeout(TimeoutSec);
await Task.Delay(100);

// validate container side updated
hubEndpoints = container.GetOnlineEndpoints().ToArray();
Expand Down
4 changes: 4 additions & 0 deletions test/Microsoft.Azure.SignalR.Tests/NegotiateHandlerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,10 @@ public async Task TestNegotiateHandlerWithMultipleEndpointsAndCustomRouter()
};

var responseFeature = new HttpResponseFeature();
var responseBodyFeature = new StreamResponseBodyFeature(responseFeature.Body);
features.Set<IHttpRequestFeature>(requestFeature);
features.Set<IHttpResponseFeature>(responseFeature);
features.Set<IHttpResponseBodyFeature>(responseBodyFeature);
httpContext = new DefaultHttpContext(features);

handler = serviceProvider.GetRequiredService<NegotiateHandler<Chat>>();
Expand All @@ -419,8 +421,10 @@ public async Task TestNegotiateHandlerWithMultipleEndpointsAndCustomRouter()
};

responseFeature = new HttpResponseFeature();
responseBodyFeature = new StreamResponseBodyFeature(responseFeature.Body);
features.Set<IHttpRequestFeature>(requestFeature);
features.Set<IHttpResponseFeature>(responseFeature);
features.Set<IHttpResponseBodyFeature>(responseBodyFeature);
httpContext = new DefaultHttpContext(features);

handler = serviceProvider.GetRequiredService<NegotiateHandler<Chat>>();
Expand Down