diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9bad0a7..1cce1583 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,6 @@ jobs: uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 - with: - dotnet-version: 3.1.101 - name: Setup NuGet uses: nuget/setup-nuget@v2 @@ -48,8 +46,6 @@ jobs: uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 - with: - dotnet-version: 3.1.101 - name: Setup NuGet uses: nuget/setup-nuget@v2 @@ -77,16 +73,12 @@ jobs: - name: Setup .NET & GitHub Packages uses: actions/setup-dotnet@v4 with: - dotnet-version: 3.1.101 source-url: https://nuget.pkg.github.com/octokit/index.json env: NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build the solution - run: 'dotnet build ${{ env.OG_SOLUTION_PATH }} -c "${{ env.CONFIGURATION }}"' - - name: Create the new package - run: 'dotnet pack ${{ env.OG_PACK_PROJ_PATH }} -o "${{ env.ARTIFACTS_STAGING_DIR_PATH }}"' + run: 'dotnet pack ${{ env.OG_PACK_PROJ_PATH }} -c "${{ env.CONFIGURATION }}" -o "${{ env.ARTIFACTS_STAGING_DIR_PATH }}"' - name: Publish to GitHub Actions uses: actions/upload-artifact@v4 diff --git a/Octokit.GraphQL.nuspec b/Octokit.GraphQL.nuspec index 3bfa0d2d..7a167091 100644 --- a/Octokit.GraphQL.nuspec +++ b/Octokit.GraphQL.nuspec @@ -18,9 +18,9 @@ - - - - + + + + diff --git a/nuget.config b/nuget.config index 3e462954..33c81de3 100644 --- a/nuget.config +++ b/nuget.config @@ -2,7 +2,7 @@ - + diff --git a/readme.md b/readme.md index a933ec33..52a77cc3 100644 --- a/readme.md +++ b/readme.md @@ -34,7 +34,7 @@ Install-Package Octokit.GraphQL -IncludePrerelease using Octokit.GraphQL; using static Octokit.GraphQL.Variable; -// Authenticate with a PAT with a scope 'read:user' +// Authenticate with a PAT with a scope 'read:repo' var connection = new Connection(new("Octokit.GraphQL.Net.SampleApp", "1.0"), "LOGGED_IN_GITHUB_USER_TOKEN"); var query = new Query() @@ -93,10 +93,8 @@ var result = await connection.Run(query); // Check if sponsoring 'warrenbuckley' var activeSponsor = result.SingleOrDefault(x => x.User.Login.ToLowerInvariant() == "warrenbuckley"); -if(activeSponsor != null) -{ +if (activeSponsor != null) Console.WriteLine("Thanks for sponsoring Warren"); -} ``` ## Contributing & Feedback @@ -130,15 +128,14 @@ There are multiple ways to participate in the community: ``` . -├──Scripts // Code quality scripts -│ └──configure-integration-tests.ps1 // Integration tests configuration script -├──Tools // Code quality tools -│ └──Generate // GraphQL .NET entity generator -├──Octokit.GraphQL // Main API data contracts library -├──Octokit.GraphQL.Core // Octokit core code -├──Octokit.GraphQL.Core.Generation // Core entity generator tools -├──Octokit.GraphQL.Core.Generation.UnitTests // Core entity generator unit tests -├──Octokit.GraphQL.Core.UnitTests // Octokit core unit tests -├──Octokit.GraphQL.IntegrationTests // Octokit integration tests -└──Octokit.GraphQL.UnitTests // Octokit unit tests +├──src +│ ├──Octokit.GraphQL // Main API data contracts library +│ ├──Octokit.GraphQL.Core // Octokit core code +│ ├──Octokit.GraphQL.Core.Generation // Core entity generator tools +│ ├──Octokit.GraphQL.Core.Generation.UnitTests // Core entity generator unit tests +│ ├──Octokit.GraphQL.Core.UnitTests // Octokit core unit tests +│ ├──Octokit.GraphQL.IntegrationTests // Octokit integration tests +│ └──Octokit.GraphQL.UnitTests // Octokit unit tests +└──tools // Code quality tools + └──Generate // GraphQL .NET entity generator ``` diff --git a/scripts/configure-integration-tests.ps1 b/scripts/configure-integration-tests.ps1 deleted file mode 100644 index 5b5d01d2..00000000 --- a/scripts/configure-integration-tests.ps1 +++ /dev/null @@ -1,83 +0,0 @@ - -function SetVariable([string]$key, [string]$value) -{ - [environment]::SetEnvironmentVariable($key, $value, "User") - [environment]::SetEnvironmentVariable($key, $value) -} - -function AskYesNoQuestion([string]$question, [string]$key) -{ - $answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it") - if ($answer -eq "Y") - { - SetVariable $key "YES" - } - else - { - SetVariable $key $null - } - - Write-Host - - return ($answer -eq "Y") -} - -function VerifyEnvironmentVariable([string]$friendlyName, [string]$key, [bool]$optional = $false) -{ - if ($optional -eq $true) - { - $label = "(optional)" - } - else - { - $label = "(required)" - } - - $existing_value = [environment]::GetEnvironmentVariable($key,"User") - if ($existing_value -eq $null) - { - $value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label" - SetVariable $key $value - } - else - { - Write-Host "$existing_value found as the configured $friendlyName" - if ($optional -eq $true) - { - $clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y' - if ($clear -eq "Y") - { - $reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on" - if ($reset -eq "C") - { - $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" - SetVariable $key $value - } - elseif ($reset -eq "R") - { - SetVariable $key $null - } - } - } - else - { - $reset = Read-Host -Prompt "Press Y to change this value, otherwise we'll move on " - if ($reset -eq "Y") - { - $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" - SetVariable $key $value - } - } - } - - Write-Host -} - -Write-Host -Write-Host "BIG FREAKING WARNING!!!!!" -Write-Host "You should use a test account when running the Octokit integration tests!" -Write-Host -Write-Host - -VerifyEnvironmentVariable "account name" "OCTOKIT_GQL_GITHUBUSERNAME" -VerifyEnvironmentVariable "OAuth token" "OCTOKIT_GQL_OAUTHTOKEN" \ No newline at end of file diff --git a/src/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj b/src/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj index 26891f9e..e9c07312 100644 --- a/src/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj +++ b/src/Octokit.GraphQL.Core.Generation.UnitTests/Octokit.GraphQL.Core.Generation.UnitTests.csproj @@ -1,24 +1,18 @@  + - netcoreapp3.1 - 7.2 + net8.0 + - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + - - - + diff --git a/src/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj b/src/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj index dff05e44..8ebc32f8 100644 --- a/src/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj +++ b/src/Octokit.GraphQL.Core.Generation/Octokit.GraphQL.Core.Generation.csproj @@ -1,12 +1,16 @@  + - netstandard2.0 - 7.2 + net8.0 + + + true + true + + - - - + diff --git a/lib/AgileObjects.ReadableExpressions.1.12.1.nupkg b/src/Octokit.GraphQL.Core.UnitTests/Assets/AgileObjects.ReadableExpressions.1.12.1.nupkg similarity index 100% rename from lib/AgileObjects.ReadableExpressions.1.12.1.nupkg rename to src/Octokit.GraphQL.Core.UnitTests/Assets/AgileObjects.ReadableExpressions.1.12.1.nupkg diff --git a/src/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs b/src/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs index e0ad9cb1..9f896cb0 100644 --- a/src/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs +++ b/src/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/src/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs b/src/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs index 691003a1..f3cd15cd 100644 --- a/src/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs +++ b/src/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/src/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj b/src/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj index 64bb6e77..cd427ef6 100644 --- a/src/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj +++ b/src/Octokit.GraphQL.Core.UnitTests/Octokit.GraphQL.Core.UnitTests.csproj @@ -1,25 +1,19 @@  + - netcoreapp3.1 - 7.2 + net8.0 + - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + - - - + diff --git a/src/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj b/src/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj index aab51544..04478cc5 100644 --- a/src/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj +++ b/src/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj @@ -1,18 +1,22 @@  + - netstandard2.0 + net8.0 Octokit.GraphQL true ..\..\key.snk true - bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.Core.xml - 7.2 + bin\$(Configuration)\$(TargetFramework)\Octokit.GraphQL.Core.xml + + + true + true + + - - - + diff --git a/src/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj b/src/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj index 3b2f3cf3..752afc65 100644 --- a/src/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj +++ b/src/Octokit.GraphQL.IntegrationTests/Octokit.GraphQL.IntegrationTests.csproj @@ -1,9 +1,9 @@  + - netcoreapp3.1 - Octokit.GraphQL.IntegrationTests - 7.2 + net8.0 + @@ -11,16 +11,12 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + - - - + diff --git a/src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj b/src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj index 168b4b45..382ea871 100644 --- a/src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj +++ b/src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj @@ -1,9 +1,14 @@ + - netstandard2.0 - true + net8.0 false ../../Octokit.GraphQL.nuspec ../.. + + + + + diff --git a/src/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs b/src/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs index a90fd917..bc6cc205 100644 --- a/src/Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs +++ b/src/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; } diff --git a/src/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj b/src/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj index c276fa61..ce07d849 100644 --- a/src/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj +++ b/src/Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj @@ -1,29 +1,20 @@  + - netcoreapp3.1 - 7.2 + net8.0 + - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + - - - - - - + diff --git a/src/Octokit.GraphQL/Octokit.GraphQL.csproj b/src/Octokit.GraphQL/Octokit.GraphQL.csproj index d72d538d..4cc8018f 100644 --- a/src/Octokit.GraphQL/Octokit.GraphQL.csproj +++ b/src/Octokit.GraphQL/Octokit.GraphQL.csproj @@ -1,16 +1,20 @@  + - netstandard2.0 + net8.0 true ..\..\key.snk true - bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.xml - 7.2 + bin\$(Configuration)\$(TargetFramework)\Octokit.GraphQL.xml + + + true + true + + - - - + diff --git a/tools/Generate/Generate.csproj b/tools/Generate/Generate.csproj index 10ea20ff..de697aa9 100644 --- a/tools/Generate/Generate.csproj +++ b/tools/Generate/Generate.csproj @@ -1,10 +1,12 @@  + Exe - netcoreapp3.1 - 7.2 + net8.0 + +