From 03d22cef8d37b19645498e9a6af97c3bfdb2d85d Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 10:54:46 +0100 Subject: [PATCH 01/22] create branche workflow for ubuntu --- .github/workflows/branches-ubuntu.yml | 80 ++++++++++++++++++++++++ GraphQL.Client.sln | 6 +- src/GraphQL.Client/GraphQL.Client.csproj | 2 +- 3 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/branches-ubuntu.yml diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml new file mode 100644 index 00000000..f9b89c25 --- /dev/null +++ b/.github/workflows/branches-ubuntu.yml @@ -0,0 +1,80 @@ +name: Branch workflow (Ubuntu) +on: + push: + branches-ignore: + - develop + - 'release/**' + - 'releases/**' +jobs: + generateVersionInfo: + name: GenerateVersionInfo + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup dotnet environment + uses: actions/setup-dotnet@master + with: + dotnet-version: '3.1.100' + - name: Restore dotnet tools + run: dotnet tool restore + - name: Fetch complete repository + run: git fetch + - name: Generate version info from git history + run: dotnet gitversion /output json | jq -r 'to_entries|map("GitVersion_\(.key)=\(.value|tostring)")|.[]' > gitversion.properties + - name: Upload version info file + uses: actions/upload-artifact@v1 + with: + name: gitversion + path: gitversion.properties + + build: + name: Build + needs: generateVersionInfo + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup dotnet environment + uses: actions/setup-dotnet@master + with: + dotnet-version: '3.1.100' + - name: Download version info file + uses: actions/download-artifact@v1 + with: + name: gitversion + path: ./ + - name: Inject version info into environment + run: export $(cat gitversion.properties | xargs) && echo $GitVersion_SemVer + - name: Build solution + run: dotnet build -c Release + - name: Create NuGet packages + run: dotnet pack -c Release --no-build -o nupkg + - name: Upload nuget packages + uses: actions/upload-artifact@v1 + with: + name: nupkg + path: nupkg + + test: + name: Test + needs: [build, generateVersionInfo] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup dotnet environment + uses: actions/setup-dotnet@master + with: + dotnet-version: '3.1.100' + - name: Download version info file + uses: actions/download-artifact@v1 + with: + name: gitversion + path: ./ + - name: Inject version info into environment + run: export $(cat gitversion.properties | xargs) && echo $GitVersion_SemVer + - name: Run tests + run: dotnet test -c Release diff --git a/GraphQL.Client.sln b/GraphQL.Client.sln index 510fa0b0..69510eb7 100644 --- a/GraphQL.Client.sln +++ b/GraphQL.Client.sln @@ -32,9 +32,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Server.Test", "tests\GraphQL.Server.Test\GraphQL.Server.Test.csproj", "{E95A1258-F666-4D4E-9101-E0C46F6A3CB3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C42106CF-F685-4F29-BC18-A70616BD68A0}" - ProjectSection(SolutionItems) = preProject - .github\FUNDING.yml = .github\FUNDING.yml - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{05CAF9B2-981E-40C0-AE31-5FA56E351F12}" ProjectSection(SolutionItems) = preProject @@ -68,7 +65,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.T EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Tests.Common", "tests\GraphQL.Client.Tests.Common\GraphQL.Client.Tests.Common.csproj", "{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphQL.Client.Serializer.SystemTextJson", "src\GraphQL.Client.Serializer.SystemTextJson\GraphQL.Client.Serializer.SystemTextJson.csproj", "{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.SystemTextJson", "src\GraphQL.Client.Serializer.SystemTextJson\GraphQL.Client.Serializer.SystemTextJson.csproj", "{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -138,6 +135,7 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {E95A1258-F666-4D4E-9101-E0C46F6A3CB3} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C} + {05CAF9B2-981E-40C0-AE31-5FA56E351F12} = {C42106CF-F685-4F29-BC18-A70616BD68A0} {95D78D57-3232-491D-BAD6-F373D76EA34D} = {D61415CA-D822-43DD-9AE7-993B8B60E855} {87FC440E-6A4D-47D8-9EB2-416FC31CC4A6} = {47C98B55-08F1-4428-863E-2C5C876DEEFE} {C212983F-67DB-44EB-BFB0-5DA75A86DF55} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C} diff --git a/src/GraphQL.Client/GraphQL.Client.csproj b/src/GraphQL.Client/GraphQL.Client.csproj index 31fa21ab..d7e74c27 100644 --- a/src/GraphQL.Client/GraphQL.Client.csproj +++ b/src/GraphQL.Client/GraphQL.Client.csproj @@ -3,7 +3,7 @@ - netstandard2.0;net461 + netstandard2.0 GraphQL.Client.Http From bac49776025d22c6b7e8747e5203972e3c2a4d7f Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 11:01:08 +0100 Subject: [PATCH 02/22] inject environment using ::set-env --- .github/workflows/branches-ubuntu.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index f9b89c25..668067db 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -23,12 +23,12 @@ jobs: - name: Fetch complete repository run: git fetch - name: Generate version info from git history - run: dotnet gitversion /output json | jq -r 'to_entries|map("GitVersion_\(.key)=\(.value|tostring)")|.[]' > gitversion.properties + run: dotnet gitversion /output json > gitversion.json - name: Upload version info file uses: actions/upload-artifact@v1 with: name: gitversion - path: gitversion.properties + path: gitversion.json build: name: Build @@ -47,7 +47,7 @@ jobs: name: gitversion path: ./ - name: Inject version info into environment - run: export $(cat gitversion.properties | xargs) && echo $GitVersion_SemVer + run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Build solution run: dotnet build -c Release - name: Create NuGet packages @@ -75,6 +75,6 @@ jobs: name: gitversion path: ./ - name: Inject version info into environment - run: export $(cat gitversion.properties | xargs) && echo $GitVersion_SemVer + run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Run tests run: dotnet test -c Release From 5dae880228a9df6ab51d0a00ab6770d4cc106418 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 11:07:28 +0100 Subject: [PATCH 03/22] output current version before build --- .github/workflows/branches-ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 668067db..7f066282 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -49,7 +49,7 @@ jobs: - name: Inject version info into environment run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Build solution - run: dotnet build -c Release + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release - name: Create NuGet packages run: dotnet pack -c Release --no-build -o nupkg - name: Upload nuget packages @@ -77,4 +77,4 @@ jobs: - name: Inject version info into environment run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Run tests - run: dotnet test -c Release + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release From b9710b3bfaccd2a7578d7f84393dd2e2e67a6df6 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 11:34:15 +0100 Subject: [PATCH 04/22] should run on ubuntu without installing dotnet first --- .github/workflows/branches-ubuntu.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 7f066282..4fde52ff 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -14,10 +14,10 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup dotnet environment - uses: actions/setup-dotnet@master - with: - dotnet-version: '3.1.100' + # - name: Setup dotnet environment + # uses: actions/setup-dotnet@master + # with: + # dotnet-version: '3.1.100' - name: Restore dotnet tools run: dotnet tool restore - name: Fetch complete repository @@ -37,10 +37,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Setup dotnet environment - uses: actions/setup-dotnet@master - with: - dotnet-version: '3.1.100' + # - name: Setup dotnet environment + # uses: actions/setup-dotnet@master + # with: + # dotnet-version: '3.1.100' - name: Download version info file uses: actions/download-artifact@v1 with: @@ -65,10 +65,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Setup dotnet environment - uses: actions/setup-dotnet@master - with: - dotnet-version: '3.1.100' + # - name: Setup dotnet environment + # uses: actions/setup-dotnet@master + # with: + # dotnet-version: '3.1.100' - name: Download version info file uses: actions/download-artifact@v1 with: From fcde0a4c0c35fe3b6bc9f73891f2aa848f2aaf9a Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 11:36:10 +0100 Subject: [PATCH 05/22] disable dotnet telemetry --- .github/workflows/branches-ubuntu.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 4fde52ff..086c7605 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -5,6 +5,8 @@ on: - develop - 'release/**' - 'releases/**' +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true jobs: generateVersionInfo: name: GenerateVersionInfo From 30d372b85b6e57b3d3dc898e8fe8ec1d728e8d46 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 11:41:55 +0100 Subject: [PATCH 06/22] remove commented dotnet setup steps --- .github/workflows/branches-ubuntu.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 086c7605..488f6596 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -16,10 +16,6 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - # - name: Setup dotnet environment - # uses: actions/setup-dotnet@master - # with: - # dotnet-version: '3.1.100' - name: Restore dotnet tools run: dotnet tool restore - name: Fetch complete repository @@ -39,10 +35,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - # - name: Setup dotnet environment - # uses: actions/setup-dotnet@master - # with: - # dotnet-version: '3.1.100' - name: Download version info file uses: actions/download-artifact@v1 with: @@ -67,10 +59,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - # - name: Setup dotnet environment - # uses: actions/setup-dotnet@master - # with: - # dotnet-version: '3.1.100' - name: Download version info file uses: actions/download-artifact@v1 with: From c2991b5104ff09e373cc3cd75e7a83841239288f Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 12:19:51 +0100 Subject: [PATCH 07/22] add ReferenceAssemblies package to allow net461 build on ubuntu vm --- src/GraphQL.Client/GraphQL.Client.csproj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GraphQL.Client/GraphQL.Client.csproj b/src/GraphQL.Client/GraphQL.Client.csproj index d7e74c27..3b11e942 100644 --- a/src/GraphQL.Client/GraphQL.Client.csproj +++ b/src/GraphQL.Client/GraphQL.Client.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + netstandard2.0;net461 GraphQL.Client.Http @@ -26,6 +26,7 @@ + @@ -38,4 +39,7 @@ + + + From cde1924d7ff824b876ae34bc3e227e3425cefe46 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 12:26:23 +0100 Subject: [PATCH 08/22] rename type param to eliminate build warning --- .../Helpers/ObservableTester.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/GraphQL.Client.Tests.Common/Helpers/ObservableTester.cs b/tests/GraphQL.Client.Tests.Common/Helpers/ObservableTester.cs index 1b8d8030..43bcbe18 100644 --- a/tests/GraphQL.Client.Tests.Common/Helpers/ObservableTester.cs +++ b/tests/GraphQL.Client.Tests.Common/Helpers/ObservableTester.cs @@ -7,7 +7,7 @@ using FluentAssertions.Primitives; namespace GraphQL.Client.Tests.Common.Helpers { - public class ObservableTester : IDisposable { + public class ObservableTester : IDisposable { private readonly IDisposable subscription; private readonly ManualResetEventSlim updateReceived = new ManualResetEventSlim(); private readonly ManualResetEventSlim completed = new ManualResetEventSlim(); @@ -25,7 +25,7 @@ public class ObservableTester : IDisposable { /// /// The last payload which was received. /// - public TPayload LastPayload { get; private set; } + public TSubscriptionPayload LastPayload { get; private set; } public Exception Error { get; private set; } @@ -33,7 +33,7 @@ public class ObservableTester : IDisposable { /// Creates a new which subscribes to the supplied /// /// the under test - public ObservableTester(IObservable observable) { + public ObservableTester(IObservable observable) { subscription = observable.ObserveOn(TaskPoolScheduler.Default).Subscribe( obj => { LastPayload = obj; @@ -59,8 +59,8 @@ public void Dispose() { subscription?.Dispose(); } - public SubscriptionAssertions Should() { - return new SubscriptionAssertions(this); + public SubscriptionAssertions Should() { + return new SubscriptionAssertions(this); } public class SubscriptionAssertions : ReferenceTypeAssertions, SubscriptionAssertions> { From 5a987990fb34e8068eab009bc659d4aed514ad2c Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 14:32:36 +0100 Subject: [PATCH 09/22] disable branch workflow on windows --- .github/workflows/branches.yml | 7 +------ GraphQL.Client.sln | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index a896d523..d88c4a2b 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -1,10 +1,5 @@ name: Branch workflow -on: - push: - branches-ignore: - - develop - - 'release/**' - - 'releases/**' +on: [] jobs: generateVersionInfo: name: GenerateVersionInfo diff --git a/GraphQL.Client.sln b/GraphQL.Client.sln index 69510eb7..e1943dde 100644 --- a/GraphQL.Client.sln +++ b/GraphQL.Client.sln @@ -35,6 +35,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C421 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{05CAF9B2-981E-40C0-AE31-5FA56E351F12}" ProjectSection(SolutionItems) = preProject + .github\workflows\branches-ubuntu.yml = .github\workflows\branches-ubuntu.yml .github\workflows\branches.yml = .github\workflows\branches.yml .github\workflows\main.yml = .github\workflows\main.yml EndProjectSection From 61b8adc7e5be81ae006fe16db2becaea42d50644 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 14:35:10 +0100 Subject: [PATCH 10/22] ignore all branches --- .github/workflows/branches.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index d88c4a2b..dbda74a2 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -1,5 +1,8 @@ name: Branch workflow -on: [] +on: + push: + branches-ignore: + - ** jobs: generateVersionInfo: name: GenerateVersionInfo From fc167577510855aa1c1514d96ee0e80c529ce007 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 14:36:02 +0100 Subject: [PATCH 11/22] put colons around wildcard --- .github/workflows/branches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index dbda74a2..430b2121 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -2,7 +2,7 @@ name: Branch workflow on: push: branches-ignore: - - ** + - '**' jobs: generateVersionInfo: name: GenerateVersionInfo From cd41f4b93ac07e2ae87d46a9919cb79a534b188a Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 15:01:53 +0100 Subject: [PATCH 12/22] fix connection status test --- .../WebsocketTests/Base.cs | 94 ++++++++++--------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs b/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs index b17ba3c0..6112a00c 100644 --- a/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs +++ b/tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs @@ -1,8 +1,8 @@ using System; +using System.Collections.Concurrent; using System.Diagnostics; using System.Net.WebSockets; using System.Threading; -using System.Threading.Tasks; using FluentAssertions; using GraphQL.Client.Abstractions; using GraphQL.Client.Abstractions.Websocket; @@ -247,49 +247,55 @@ public async void CanHandleConnectionTimeout() { return TimeSpan.Zero; }; - var statusMonitor = client.WebsocketConnectionState.Monitor(); - statusMonitor.Should().HaveReceivedPayload().Which.Should() - .Be(GraphQLWebsocketConnectionState.Disconnected); - - Debug.WriteLine("creating subscription stream"); - IObservable> observable = client.CreateSubscriptionStream(SubscriptionRequest, errorMonitor.Invoke); - - Debug.WriteLine("subscribing..."); - var tester = observable.Monitor(); - statusMonitor.Should().HaveReceivedPayload().Which.Should() - .Be(GraphQLWebsocketConnectionState.Connecting); - statusMonitor.Should().HaveReceivedPayload().Which.Should() - .Be(GraphQLWebsocketConnectionState.Connected); - callbackMonitor.Should().HaveBeenInvokedWithPayload(); - const string message1 = "Hello World"; - - var response = await client.AddMessageAsync(message1).ConfigureAwait(false); - response.Data.AddMessage.Content.Should().Be(message1); - tester.Should().HaveReceivedPayload() - .Which.Data.MessageAdded.Content.Should().Be(message1); - - Debug.WriteLine("stopping web host..."); - await server.StopAsync(CancellationToken.None).ConfigureAwait(false); - server.Dispose(); - Debug.WriteLine("web host stopped..."); - - errorMonitor.Should().HaveBeenInvokedWithPayload(TimeSpan.FromSeconds(10)) - .Which.Should().BeOfType(); - statusMonitor.Should().HaveReceivedPayload().Which.Should() - .Be(GraphQLWebsocketConnectionState.Disconnected); - - server = CreateServer(port); - reconnectBlocker.Set(); - statusMonitor.Should().HaveReceivedPayload(TimeSpan.FromSeconds(10)).Which.Should() - .Be(GraphQLWebsocketConnectionState.Connecting); - statusMonitor.Should().HaveReceivedPayload(TimeSpan.FromSeconds(10)).Which.Should() - .Be(GraphQLWebsocketConnectionState.Connected); - callbackMonitor.Should().HaveBeenInvokedWithPayload(); - - // disposing the client should complete the subscription - client.Dispose(); - tester.Should().HaveCompleted(TimeSpan.FromSeconds(5)); - server.Dispose(); + var websocketStates = new ConcurrentQueue(); + + using (client.WebsocketConnectionState.Subscribe(websocketStates.Enqueue)) { + websocketStates.Should().ContainSingle(state => state == GraphQLWebsocketConnectionState.Disconnected); + + Debug.WriteLine("creating subscription stream"); + IObservable> observable = + client.CreateSubscriptionStream(SubscriptionRequest, + errorMonitor.Invoke); + + Debug.WriteLine("subscribing..."); + var tester = observable.Monitor(); + callbackMonitor.Should().HaveBeenInvokedWithPayload(); + + websocketStates.Should().ContainInOrder( + GraphQLWebsocketConnectionState.Disconnected, + GraphQLWebsocketConnectionState.Connecting, + GraphQLWebsocketConnectionState.Connected); + // clear the collection so the next tests on the collection work as expected + websocketStates.Clear(); + + const string message1 = "Hello World"; + var response = await client.AddMessageAsync(message1).ConfigureAwait(false); + response.Data.AddMessage.Content.Should().Be(message1); + tester.Should().HaveReceivedPayload() + .Which.Data.MessageAdded.Content.Should().Be(message1); + + Debug.WriteLine("stopping web host..."); + await server.StopAsync(CancellationToken.None).ConfigureAwait(false); + server.Dispose(); + Debug.WriteLine("web host stopped..."); + + errorMonitor.Should().HaveBeenInvokedWithPayload(TimeSpan.FromSeconds(10)) + .Which.Should().BeOfType(); + websocketStates.Should().Contain(GraphQLWebsocketConnectionState.Disconnected); + + server = CreateServer(port); + reconnectBlocker.Set(); + callbackMonitor.Should().HaveBeenInvokedWithPayload(); + websocketStates.Should().ContainInOrder( + GraphQLWebsocketConnectionState.Disconnected, + GraphQLWebsocketConnectionState.Connecting, + GraphQLWebsocketConnectionState.Connected); + + // disposing the client should complete the subscription + client.Dispose(); + tester.Should().HaveCompleted(TimeSpan.FromSeconds(5)); + server.Dispose(); + } } From 34b7d03ba2419186060176fe93fd14d130493bb9 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 15:23:56 +0100 Subject: [PATCH 13/22] test publish job on branch workflow --- .github/workflows/branches-ubuntu.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 488f6596..1f420844 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -68,3 +68,22 @@ jobs: run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Run tests run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release + + publish: + name: Publish + needs: [test] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download nuget packages + uses: actions/download-artifact@v1 + with: + name: nupkg + - uses: actions/setup-dotnet@v1 + with: + source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Publish the package to GPR + run: dotnet nuget push ./nupkg/*.nupkg -k ${{secrets.GITHUB_TOKEN}} From 76c1be9459caccc3d79163b82de14f3926c09d3d Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 15:43:28 +0100 Subject: [PATCH 14/22] fix publish job to publish all packages --- .github/workflows/branches-ubuntu.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 1f420844..931976da 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -80,10 +80,11 @@ jobs: uses: actions/download-artifact@v1 with: name: nupkg + path: ./ - uses: actions/setup-dotnet@v1 with: source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Publish the package to GPR - run: dotnet nuget push ./nupkg/*.nupkg -k ${{secrets.GITHUB_TOKEN}} + run: dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate From 33b99e97541b0c26034fc2e49cbb513c893c68e8 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 16:05:48 +0100 Subject: [PATCH 15/22] use for loop to publish packages --- .github/workflows/branches-ubuntu.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 931976da..31b1d511 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -80,11 +80,10 @@ jobs: uses: actions/download-artifact@v1 with: name: nupkg - path: ./ - uses: actions/setup-dotnet@v1 with: source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Publish the package to GPR - run: dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate + run: for pkg in ./nupkg/*.nupkg; do dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done From 00a4875ed4db8d62458fa06efc35f585e40bbd97 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 16:06:33 +0100 Subject: [PATCH 16/22] fix for loop --- .github/workflows/branches-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 31b1d511..c5c79ee1 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -86,4 +86,4 @@ jobs: env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Publish the package to GPR - run: for pkg in ./nupkg/*.nupkg; do dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done + run: for p in ./nupkg/*.nupkg; do dotnet nuget push $p -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done From cb59c7476f6235cbbe53ecacf1f4d6b5a55a18bc Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 16:18:03 +0100 Subject: [PATCH 17/22] enable continuous deployment mode for all branches --- GitVersion.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 4b1b821f..2210324b 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,3 +1 @@ -branches: - release: - mode: ContinuousDeployment +mode: ContinuousDeployment From d5e313cf26b0a25e957de158f479b90402aa1b5e Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 16:38:40 +0100 Subject: [PATCH 18/22] create main workflow for ubuntu --- .../{branches.yml => branches-windows.yml} | 0 .github/workflows/main-ubuntu.yml | 92 +++++++++++++++++++ .../workflows/{main.yml => main-windows.yml} | 11 +-- 3 files changed, 95 insertions(+), 8 deletions(-) rename .github/workflows/{branches.yml => branches-windows.yml} (100%) create mode 100644 .github/workflows/main-ubuntu.yml rename .github/workflows/{main.yml => main-windows.yml} (96%) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches-windows.yml similarity index 100% rename from .github/workflows/branches.yml rename to .github/workflows/branches-windows.yml diff --git a/.github/workflows/main-ubuntu.yml b/.github/workflows/main-ubuntu.yml new file mode 100644 index 00000000..2cbffd4e --- /dev/null +++ b/.github/workflows/main-ubuntu.yml @@ -0,0 +1,92 @@ +name: Main workflow (Ubuntu) +on: + push: + branches: + - develop + - 'release/**' + - 'releases/**' + tags: + - v* + - V* +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true +jobs: + generateVersionInfo: + name: GenerateVersionInfo + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore dotnet tools + run: dotnet tool restore + - name: Fetch complete repository + run: git fetch + - name: Generate version info from git history + run: dotnet gitversion /output json > gitversion.json + - name: Upload version info file + uses: actions/upload-artifact@v1 + with: + name: gitversion + path: gitversion.json + + build: + name: Build + needs: generateVersionInfo + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download version info file + uses: actions/download-artifact@v1 + with: + name: gitversion + path: ./ + - name: Inject version info into environment + run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json + - name: Build solution + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release + - name: Create NuGet packages + run: dotnet pack -c Release --no-build -o nupkg + - name: Upload nuget packages + uses: actions/upload-artifact@v1 + with: + name: nupkg + path: nupkg + + test: + name: Test + needs: [build, generateVersionInfo] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download version info file + uses: actions/download-artifact@v1 + with: + name: gitversion + path: ./ + - name: Inject version info into environment + run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json + - name: Run tests + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release + + publish: + name: Publish + needs: [test] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download nuget packages + uses: actions/download-artifact@v1 + with: + name: nupkg + - uses: actions/setup-dotnet@v1 + with: + source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Publish the package to GPR + run: for p in ./nupkg/*.nupkg; do dotnet nuget push $p -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done diff --git a/.github/workflows/main.yml b/.github/workflows/main-windows.yml similarity index 96% rename from .github/workflows/main.yml rename to .github/workflows/main-windows.yml index 2ed05127..8ab30600 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main-windows.yml @@ -1,13 +1,8 @@ name: Main workflow -on: +on: push: - branches: - - develop - - 'release/**' - - 'releases/**' - tags: - - v* - - V* + branches-ignore: + - '**' jobs: generateVersionInfo: name: GenerateVersionInfo From 35052f60d9be25146290e9c82ea78a1862d1da96 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 19 Feb 2020 16:56:22 +0100 Subject: [PATCH 19/22] cd into nupkg dir --- .github/workflows/branches-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index c5c79ee1..9ec4e076 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -86,4 +86,4 @@ jobs: env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Publish the package to GPR - run: for p in ./nupkg/*.nupkg; do dotnet nuget push $p -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done + run: cd ./nupkg && dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate From 3ac99ef0bae0580be59665258a41207bd4d8efc0 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Thu, 20 Feb 2020 09:46:26 +0100 Subject: [PATCH 20/22] try package upload workaround --- .github/workflows/branches-ubuntu.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 9ec4e076..747b0e35 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -86,4 +86,8 @@ jobs: env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Publish the package to GPR - run: cd ./nupkg && dotnet nuget push *.nupkg -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "graphql-dotnet:${{ secrets.GHPackagesToken }}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/ + done From 94f9cb7a151aca5ff9226cc7ae9eb70b9a09bd06 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Thu, 20 Feb 2020 09:47:14 +0100 Subject: [PATCH 21/22] fix secret --- .github/workflows/branches-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 747b0e35..059ca0c9 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -89,5 +89,5 @@ jobs: run: | for f in ./nupkg/*.nupkg do - curl -vX PUT -u "graphql-dotnet:${{ secrets.GHPackagesToken }}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/ + curl -vX PUT -u "graphql-dotnet:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/ done From 43e8201ee3a1c17ed157ace229980eda89664b1f Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Thu, 20 Feb 2020 09:54:06 +0100 Subject: [PATCH 22/22] move publish step to main workflow --- .github/workflows/branches-ubuntu.yml | 23 ----------------------- .github/workflows/main-ubuntu.yml | 14 +++++++------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/.github/workflows/branches-ubuntu.yml b/.github/workflows/branches-ubuntu.yml index 059ca0c9..488f6596 100644 --- a/.github/workflows/branches-ubuntu.yml +++ b/.github/workflows/branches-ubuntu.yml @@ -68,26 +68,3 @@ jobs: run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json - name: Run tests run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release - - publish: - name: Publish - needs: [test] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Download nuget packages - uses: actions/download-artifact@v1 - with: - name: nupkg - - uses: actions/setup-dotnet@v1 - with: - source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish the package to GPR - run: | - for f in ./nupkg/*.nupkg - do - curl -vX PUT -u "graphql-dotnet:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/ - done diff --git a/.github/workflows/main-ubuntu.yml b/.github/workflows/main-ubuntu.yml index 2cbffd4e..bb58dcff 100644 --- a/.github/workflows/main-ubuntu.yml +++ b/.github/workflows/main-ubuntu.yml @@ -83,10 +83,10 @@ jobs: uses: actions/download-artifact@v1 with: name: nupkg - - uses: actions/setup-dotnet@v1 - with: - source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish the package to GPR - run: for p in ./nupkg/*.nupkg; do dotnet nuget push $p -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate; done + - name: Publish the package to GPR + # using workaround with CURL because of non-functioning upload via dotnet nuget (https://stackoverflow.com/a/58943251) + run: | + for f in ./nupkg/*.nupkg + do + curl -vX PUT -u "graphql-dotnet:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/ + done