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

feat: breaking change: revive cleanup projects PR, target .NET 6.0 #313

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
6 changes: 3 additions & 3 deletions .github/workflows/dotnetcore.yml
Expand Up @@ -16,14 +16,14 @@ 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}}
- name: Setup NuGet
uses: nuget/setup-nuget@v1
uses: nuget/setup-nuget@v2
with:
nuget-version: 5.x
- name: Build using .NET Core
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate-schema.yml
Expand Up @@ -15,9 +15,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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Expand Up @@ -15,9 +15,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
Expand Down
@@ -1,24 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core.Generation\Octokit.GraphQL.Core.Generation.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
@@ -1,12 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs
Expand Up @@ -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<TaskCanceledException>(() => connection.Run(query, cancellationToken));
}

[Theory]
Expand Down
Expand Up @@ -45,7 +45,11 @@ public static void AssertCompiledQueryExpressionEqual<T>(string expectedString,

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{");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this feels like something is off with serialization. I'm not sure what the proper call would be here. Let me pull this down today and see if I can get a better picture of what might be going on.


Assert.Equal(expectedString, StripWhitespace(actualString));
}

public static string ReplaceSubqueryPlaceholders(string expectedString, params string[] subqueryPlaceholderReplacements)
Expand Down
Expand Up @@ -9,9 +9,9 @@

namespace Octokit.GraphQL.Core.UnitTests
{
public class ExpressionRewiterTests
public class ExpressionRewriterTests
{
public ExpressionRewiterTests()
public ExpressionRewriterTests()
{
ExpressionCompiler.IsUnitTesting = true;
}
Expand Down Expand Up @@ -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<string>() : null);

var readableString =
var readableString =
"data => Rewritten.Value.Select(data[\"data\"][\"repository\"],x => (x[\"name\"].Type != JTokenType.Null) ? x[\"name\"].ToObject<string>() : 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<string>() : null)

ExpressionRewriterAssertions.AssertExpressionQueryEqual(readableString, query);
}


[Fact]
public void Union_IssueOrPullRequest()
{
Expand Down
@@ -1,25 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AgileObjects.ReadableExpressions" Version="1.12.1" />
<PackageReference Include="coverlet.msbuild" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AgileObjects.ReadableExpressions" Version="4.1.1" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
11 changes: 3 additions & 8 deletions Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj
@@ -1,18 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Octokit.GraphQL</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<DocumentationFile>bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.Core.xml</DocumentationFile>
<LangVersion>7.2</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
@@ -1,26 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Octokit.GraphQL.IntegrationTests</AssemblyName>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.1.1" />
<PackageReference Include="Octokit" Version="0.29.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.10" />
<PackageReference Include="Octokit" Version="7.1.0" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
<ProjectReference Include="..\Octokit.GraphQL\Octokit.GraphQL.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NuspecFile>../Octokit.GraphQL.nuspec</NuspecFile>
Expand Down
4 changes: 2 additions & 2 deletions Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs
Expand Up @@ -11,9 +11,9 @@

namespace Octokit.GraphQL.UnitTests
{
public class ExpressionRewiterTests
public class ExpressionRewriterTests
{
public ExpressionRewiterTests()
public ExpressionRewriterTests()
{
ExpressionCompiler.IsUnitTesting = true;
}
Expand Down
24 changes: 5 additions & 19 deletions Octokit.GraphQL.UnitTests/Octokit.GraphQL.UnitTests.csproj
@@ -1,29 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Codecov" Version="1.10.0" />
<PackageReference Include="coverlet.msbuild" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core.UnitTests\Octokit.GraphQL.Core.UnitTests.csproj" />
<ProjectReference Include="..\Octokit.GraphQL\Octokit.GraphQL.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions Octokit.GraphQL.nuspec
Expand Up @@ -18,9 +18,9 @@
</dependencies>
</metadata>
<files>
<file src="Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.dll" target="lib\netstandard2.0"/>
<file src="Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.xml" target="lib\netstandard2.0"/>
<file src="Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.Core.dll" target="lib\netstandard2.0"/>
<file src="Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.Core.xml" target="lib\netstandard2.0"/>
<file src="Octokit.GraphQL\bin\Release\net6.0\Octokit.GraphQL.dll" target="lib\net6.0"/>
<file src="Octokit.GraphQL\bin\Release\net6.0\Octokit.GraphQL.xml" target="lib\net6.0"/>
<file src="Octokit.GraphQL\bin\Release\net6.0\Octokit.GraphQL.Core.dll" target="lib\net6.0"/>
<file src="Octokit.GraphQL\bin\Release\net6.0\Octokit.GraphQL.Core.xml" target="lib\net6.0"/>
</files>
</package>
1 change: 1 addition & 0 deletions Octokit.GraphQL.sln.DotSettings
Expand Up @@ -5,6 +5,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
Expand Down
8 changes: 2 additions & 6 deletions Octokit.GraphQL/Octokit.GraphQL.csproj
@@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<DocumentationFile>bin\$(Configuration)\netstandard1.1\Octokit.GraphQL.xml</DocumentationFile>
<LangVersion>7.2</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
6 changes: 0 additions & 6 deletions Tools/Generate/App.config

This file was deleted.

3 changes: 1 addition & 2 deletions Tools/Generate/Generate.csproj
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Octokit.GraphQL.Core.Generation\Octokit.GraphQL.Core.Generation.csproj" />
Expand Down