From b07e028f63c5a2e0a670decb7603148f68212d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Sat, 19 Aug 2023 01:24:37 +0200 Subject: [PATCH 1/9] Update dependencies and cleanup projects * Update test projects from .NET Core 3.1 (out of support) to .NET 6 (LTS) * Remove `` (see https://github.com/Microsoft/vstest/issues/472#issuecomment-378811616) * Remove `7.2` on test projects * Fix `Run_Specifies_Cancellation_Token` which (rightfully) throws when running on .NET 6 --- ...t.GraphQL.Core.Generation.UnitTests.csproj | 20 ++++------------ .../Octokit.GraphQL.Core.Generation.csproj | 3 --- .../ConnectionTests.cs | 2 +- .../Octokit.GraphQL.Core.UnitTests.csproj | 22 +++++------------ .../Octokit.GraphQL.Core.csproj | 7 +----- .../Octokit.GraphQL.IntegrationTests.csproj | 24 +++++++------------ .../Octokit.GraphQL.UnitTests.csproj | 24 ++++--------------- Octokit.GraphQL.sln.DotSettings | 1 + Octokit.GraphQL/Octokit.GraphQL.csproj | 4 ---- Tools/Generate/App.config | 6 ----- Tools/Generate/Generate.csproj | 3 +-- 11 files changed, 28 insertions(+), 88 deletions(-) delete mode 100644 Tools/Generate/App.config diff --git a/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj b/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj index 26891f9e..f0eb8ecb 100644 --- a/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj +++ b/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj @@ -1,24 +1,14 @@  - netcoreapp3.1 - 7.2 + net6.0 - - all - runtime; build; native; contentfiles; analyzers - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + - - - diff --git a/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj b/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj index dff05e44..355ce817 100644 --- a/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj +++ b/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj @@ -6,7 +6,4 @@ - - - diff --git a/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs b/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs index e0ad9cb1..9f896cb0 100644 --- a/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs +++ b/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs @@ -70,7 +70,7 @@ public static async Task Run_Specifies_Cancellation_Token() var connection = new Connection(ProductInformation, CredentialStore, httpClient); - await connection.Run(query, cancellationToken); + await Assert.ThrowsAsync(() => connection.Run(query, cancellationToken)); } [Theory] diff --git a/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj b/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj index 64bb6e77..d554d235 100644 --- a/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj +++ b/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj @@ -1,25 +1,15 @@  - netcoreapp3.1 - 7.2 + net6.0 - - - all - runtime; build; native; contentfiles; analyzers - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + - - - diff --git a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj index c06d860e..d0de0406 100644 --- a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj +++ b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj @@ -5,14 +5,9 @@ true ..\key.snk true - bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.Core.xml 7.2 - - - - - + diff --git a/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj b/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj index 3b2f3cf3..f0ffe125 100644 --- a/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj +++ b/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj @@ -1,26 +1,18 @@  - netcoreapp3.1 - Octokit.GraphQL.IntegrationTests - 7.2 + net6.0 - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + - - - diff --git a/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj b/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj index c276fa61..55b5c1a7 100644 --- a/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj +++ b/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj @@ -1,29 +1,15 @@  - netcoreapp3.1 - 7.2 + net6.0 - - - all - runtime; build; native; contentfiles; analyzers - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + - - - - - - diff --git a/Octokit.GraphQL.sln.DotSettings b/Octokit.GraphQL.sln.DotSettings index 7acf74fb..ced2c0d7 100644 --- a/Octokit.GraphQL.sln.DotSettings +++ b/Octokit.GraphQL.sln.DotSettings @@ -5,6 +5,7 @@ True True True + True True True True diff --git a/Octokit.GraphQL/Octokit.GraphQL.csproj b/Octokit.GraphQL/Octokit.GraphQL.csproj index 1adc92e2..00d7553a 100644 --- a/Octokit.GraphQL/Octokit.GraphQL.csproj +++ b/Octokit.GraphQL/Octokit.GraphQL.csproj @@ -4,13 +4,9 @@ true ..\key.snk true - bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.xml 7.2 - - - diff --git a/Tools/Generate/App.config b/Tools/Generate/App.config deleted file mode 100644 index 88fa4027..00000000 --- a/Tools/Generate/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Tools/Generate/Generate.csproj b/Tools/Generate/Generate.csproj index 5915e5ef..d7c40c27 100644 --- a/Tools/Generate/Generate.csproj +++ b/Tools/Generate/Generate.csproj @@ -1,8 +1,7 @@  Exe - netcoreapp3.1 - 7.2 + net6.0 From 9591059d6078032d52f19bc0ca667b41d833d162 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 26 Feb 2024 09:57:30 -0800 Subject: [PATCH 2/9] Bump to .NET 8, actions/setup-dotnet@v4 --- .github/workflows/dotnetcore.yml | 4 ++-- .github/workflows/generate-schema.yml | 4 ++-- .github/workflows/integration-tests.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 1305a9c4..dd8395ec 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -15,9 +15,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET Core and GitHub Packages - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 3.1.101 + dotnet-version: 8.x.x source-url: https://nuget.pkg.github.com/octokit/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/generate-schema.yml b/.github/workflows/generate-schema.yml index e8076d32..fca89242 100644 --- a/.github/workflows/generate-schema.yml +++ b/.github/workflows/generate-schema.yml @@ -14,9 +14,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 3.1.x + dotnet-version: 8.x.x - name: Install dependencies run: dotnet restore - name: Generate diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f465b87e..20287ae6 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -14,9 +14,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 3.1.101 + dotnet-version: 8.x.x - name: Build using .NET Core run: dotnet build Octokit.GraphQL.sln -c ${{ env.config }} - name: Run integration tests From 4ebf8a1380877a7e1bd2d6e3fb0f89a570319ebd Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 26 Feb 2024 14:54:37 -0800 Subject: [PATCH 3/9] Rename misspelled word in test functions --- .../ExpressionRewiterTests.cs | 10 +++++----- .../ExpressionRewriterAssertions.cs | 2 +- Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs b/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs index 691003a1..f3cd15cd 100644 --- a/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs +++ b/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs @@ -9,9 +9,9 @@ namespace Octokit.GraphQL.Core.UnitTests { - public class ExpressionRewiterTests + public class ExpressionRewriterTests { - public ExpressionRewiterTests() + public ExpressionRewriterTests() { ExpressionCompiler.IsUnitTesting = true; } @@ -250,16 +250,16 @@ public void Can_Use_Conditional_To_Compare_To_Null() // data["data"]["repository"], // x => x["name"].Type != JTokenType.Null ? x["name"].ToObject() : null); - var readableString = + var readableString = "data => Rewritten.Value.Select(data[\"data\"][\"repository\"],x => (x[\"name\"].Type != JTokenType.Null) ? x[\"name\"].ToObject() : null)"; - + // Expression put through ReadableExpression outputs the following, so I'm using a hard coded string instead // data => Rewritten.Value.Select(data["data"]["repository"], x => (((int)x["name"].Type) != 10) ? x["name"].ToObject() : null) ExpressionRewriterAssertions.AssertExpressionQueryEqual(readableString, query); } - + [Fact] public void Union_IssueOrPullRequest() { diff --git a/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs b/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs index 1b121747..8b9b865d 100644 --- a/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs +++ b/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs @@ -41,7 +41,7 @@ public static void AssertCompiledQueryExpressionEqual(Expression expected, IC public static void AssertCompiledQueryExpressionEqual(string expectedString, ICompiledQuery actualCompiledQuery, params string[] subqueryPlaceholderReplacements) { var actualResultExpression = actualCompiledQuery.GetResultBuilderExpression(); - var actualString = actualResultExpression.ToReadableString(settings => settings.NameAnonymousTypesUsing(_ => "object")); + var actualString = actualResultExpression.ToReadableString(/*settings => settings.NameAnonymousTypesUsing(_ => "object")*/); expectedString = ReplaceSubqueryPlaceholders(expectedString, subqueryPlaceholderReplacements); diff --git a/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs b/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs index a90fd917..bc6cc205 100644 --- a/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs +++ b/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs @@ -11,9 +11,9 @@ namespace Octokit.GraphQL.UnitTests { - public class ExpressionRewiterTests + public class ExpressionRewriterTests { - public ExpressionRewiterTests() + public ExpressionRewriterTests() { ExpressionCompiler.IsUnitTesting = true; } From eebfc65c46ff73e084fd9eedd63448d1c018fece Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 26 Feb 2024 15:25:49 -0800 Subject: [PATCH 4/9] Get latest version of ReadableExpressions library --- .../Octokit.GraphQL.Core.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj b/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj index d554d235..ba0318a6 100644 --- a/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj +++ b/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj @@ -3,7 +3,7 @@ net6.0 - + From 3773895ef8fa3e45e4c17e1f6416e95b8fbd623e Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Tue, 27 Feb 2024 13:13:38 -0800 Subject: [PATCH 5/9] More .NET 6.0 and remove LangVersion from .csproj --- .../Octokit.GraphQL.Core.Generation.csproj | 3 +-- Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj | 3 +-- Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj | 2 +- Octokit.GraphQL.nuspec | 8 ++++---- Octokit.GraphQL/Octokit.GraphQL.csproj | 3 +-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj b/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj index 355ce817..7cc3dd36 100644 --- a/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj +++ b/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj @@ -1,7 +1,6 @@  - netstandard2.0 - 7.2 + net6.0 diff --git a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj index d0de0406..cb4a997a 100644 --- a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj +++ b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj @@ -1,11 +1,10 @@  - netstandard2.0 + net6.0 Octokit.GraphQL true ..\key.snk true - 7.2 diff --git a/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj b/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj index 3f895b50..656eafef 100644 --- a/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj +++ b/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + net6.0 true false ../Octokit.GraphQL.nuspec diff --git a/Octokit.GraphQL.nuspec b/Octokit.GraphQL.nuspec index 68ed431a..9d565fdf 100644 --- a/Octokit.GraphQL.nuspec +++ b/Octokit.GraphQL.nuspec @@ -18,9 +18,9 @@ - - - - + + + + diff --git a/Octokit.GraphQL/Octokit.GraphQL.csproj b/Octokit.GraphQL/Octokit.GraphQL.csproj index 00d7553a..0d59019e 100644 --- a/Octokit.GraphQL/Octokit.GraphQL.csproj +++ b/Octokit.GraphQL/Octokit.GraphQL.csproj @@ -1,10 +1,9 @@  - netstandard2.0 + net6.0 true ..\key.snk true - 7.2 From 9ab3e99b7415f8fd5870137c28087c17fda5e2b2 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Tue, 27 Feb 2024 13:30:14 -0800 Subject: [PATCH 6/9] Rename misspelled file --- .../{ExpressionRewiterTests.cs => ExpressionRewriterTests.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Octokit.GraphQL.Core.UnitTests/{ExpressionRewiterTests.cs => ExpressionRewriterTests.cs} (100%) diff --git a/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs b/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterTests.cs similarity index 100% rename from Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs rename to Octokit.GraphQL.Core.UnitTests/ExpressionRewriterTests.cs From 4661572495ec86fd03b540e800cc727a93157b26 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Tue, 27 Feb 2024 13:46:05 -0800 Subject: [PATCH 7/9] Hacky test fix --- .../ExpressionRewriterAssertions.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs b/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs index 8b9b865d..e63e3097 100644 --- a/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs +++ b/Octokit.GraphQL.Core.UnitTests/ExpressionRewriterAssertions.cs @@ -41,11 +41,15 @@ public static void AssertCompiledQueryExpressionEqual(Expression expected, IC public static void AssertCompiledQueryExpressionEqual(string expectedString, ICompiledQuery actualCompiledQuery, params string[] subqueryPlaceholderReplacements) { var actualResultExpression = actualCompiledQuery.GetResultBuilderExpression(); - var actualString = actualResultExpression.ToReadableString(/*settings => settings.NameAnonymousTypesUsing(_ => "object")*/); + var actualString = actualResultExpression.ToReadableString(settings => settings.NameAnonymousTypesUsing(_ => "object")); expectedString = ReplaceSubqueryPlaceholders(expectedString, subqueryPlaceholderReplacements); - Assert.Equal(StripWhitespace(expectedString), StripWhitespace(actualString)); + // hacky fix for anonymous types: actual strings give "new" and expected strings give "new object" + expectedString = StripWhitespace(expectedString); + expectedString = expectedString.Replace("new{", "newobject{"); + + Assert.Equal(expectedString, StripWhitespace(actualString)); } public static string ReplaceSubqueryPlaceholders(string expectedString, params string[] subqueryPlaceholderReplacements) From 8675b7bdd8b72b1347e032c3e9572fb657e2e30c Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Tue, 27 Feb 2024 13:50:50 -0800 Subject: [PATCH 8/9] Roll back .nuspec file changes --- Octokit.GraphQL.nuspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Octokit.GraphQL.nuspec b/Octokit.GraphQL.nuspec index 9d565fdf..68ed431a 100644 --- a/Octokit.GraphQL.nuspec +++ b/Octokit.GraphQL.nuspec @@ -18,9 +18,9 @@ - - - - + + + + From c398db01c5ec6d16c194c06751beba650492d183 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Tue, 27 Feb 2024 14:39:17 -0800 Subject: [PATCH 9/9] .csproj GenerateDocumentationFile property --- .github/workflows/dotnetcore.yml | 2 +- Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj | 1 + Octokit.GraphQL.nuspec | 8 ++++---- Octokit.GraphQL/Octokit.GraphQL.csproj | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 2bb5b01a..ab99c04e 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -23,7 +23,7 @@ jobs: env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Setup NuGet - uses: nuget/setup-nuget@v1 + uses: nuget/setup-nuget@v2 with: nuget-version: 5.x - name: Build using .NET Core diff --git a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj index cb4a997a..592507f9 100644 --- a/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj +++ b/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj @@ -5,6 +5,7 @@ true ..\key.snk true + true diff --git a/Octokit.GraphQL.nuspec b/Octokit.GraphQL.nuspec index 68ed431a..9d565fdf 100644 --- a/Octokit.GraphQL.nuspec +++ b/Octokit.GraphQL.nuspec @@ -18,9 +18,9 @@ - - - - + + + + diff --git a/Octokit.GraphQL/Octokit.GraphQL.csproj b/Octokit.GraphQL/Octokit.GraphQL.csproj index 0d59019e..94f29070 100644 --- a/Octokit.GraphQL/Octokit.GraphQL.csproj +++ b/Octokit.GraphQL/Octokit.GraphQL.csproj @@ -4,6 +4,7 @@ true ..\key.snk true + true