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

Feature: Upgrade .NET from Core 3.1 to 8.0 (and Native AOT!) #321

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1c84944
⬆️ Upgrade `.NET` from Core 3.1 to 8.0
Lamparter Sep 6, 2024
6456733
⬆️ Upgrade API projects to .NET 8
Lamparter Sep 7, 2024
6fc0afc
⚡️ Add .NET Native AOT
Lamparter Sep 7, 2024
6fb9559
✏️ Fix typo in unit tests
Lamparter Sep 8, 2024
e445b1c
🐛 Fix `Run_Specifies_Cancellation_Token` error
Lamparter Sep 8, 2024
253a5b0
🎨 Remove trailing space
Lamparter Sep 8, 2024
7607fa1
🔀 Merge branch `main` into `dotnet`
Lamparter Sep 28, 2024
38577dd
🔀 Merge branch `main` into `dotnet`
Lamparter Sep 28, 2024
1d58ce2
Update Octokit.GraphQL.Core.Generation.UnitTests.csproj
0x5bfa Sep 28, 2024
ac288db
💚 Fix solution configuration
Lamparter Sep 28, 2024
bbb68bf
Update Octokit.GraphQL.Core.Generation.csproj
0x5bfa Sep 28, 2024
bd9eea7
Update Octokit.GraphQL.Core.UnitTests.csproj
0x5bfa Sep 28, 2024
78ea5bf
Update Octokit.GraphQL.Core.csproj
0x5bfa Sep 28, 2024
cf89ad9
Update Octokit.GraphQL.IntegrationTests.csproj
0x5bfa Sep 28, 2024
c4dbc6c
Update Octokit.GraphQL.UnitTests.csproj
0x5bfa Sep 28, 2024
cb2cb6a
Update Octokit.GraphQL.csproj
0x5bfa Sep 28, 2024
93a3339
Update Generate.csproj
0x5bfa Sep 28, 2024
1554f52
Update Octokit.GraphQL.Pack.csproj
0x5bfa Sep 28, 2024
183ff1e
Merge branch 'octokit:main' into dotnet
0x5bfa Nov 8, 2024
2dd9202
Update ci.yml
0x5bfa Nov 8, 2024
b794dc9
Update Octokit.GraphQL.Pack.csproj
0x5bfa Nov 8, 2024
96237f2
Update Octokit.GraphQL.Pack.csproj
0x5bfa Nov 8, 2024
5116889
Update Octokit.GraphQL.nuspec
0x5bfa Nov 8, 2024
5cbb2b7
Update Octokit.GraphQL.Pack.csproj
0x5bfa Nov 8, 2024
bf5a0aa
Update Octokit.GraphQL.nuspec
0x5bfa Nov 8, 2024
808621b
Update Octokit.GraphQL.Core.csproj
0x5bfa Nov 8, 2024
869fbba
Update Octokit.GraphQL.csproj
0x5bfa Nov 8, 2024
d97f6ef
Update Octokit.GraphQL.csproj
0x5bfa Nov 8, 2024
26a5625
Update readme.md
0x5bfa Nov 8, 2024
88384a7
Delete scripts directory
0x5bfa Nov 8, 2024
6addd58
Delete lib directory
0x5bfa Nov 8, 2024
f9b5de6
Add files via upload
0x5bfa Nov 8, 2024
051751f
Rename src/Octokit.GraphQL.Core.UnitTests/AgileObjects.ReadableExpres…
0x5bfa Nov 8, 2024
66f85ad
Update nuget.config
0x5bfa Nov 8, 2024
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
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Octokit.GraphQL.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</dependencies>
</metadata>
<files>
<file src="src\Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.dll" target="lib\netstandard2.0"/>
<file src="src\Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.xml" target="lib\netstandard2.0"/>
<file src="src\Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.Core.dll" target="lib\netstandard2.0"/>
<file src="src\Octokit.GraphQL\bin\Release\netstandard2.0\Octokit.GraphQL.Core.xml" target="lib\netstandard2.0"/>
<file src="src\Octokit.GraphQL\bin\Release\net8.0\Octokit.GraphQL.dll" target="lib\net8.0"/>
<file src="src\Octokit.GraphQL\bin\Release\net8.0\Octokit.GraphQL.xml" target="lib\net8.0"/>
<file src="src\Octokit.GraphQL\bin\Release\net8.0\Octokit.GraphQL.Core.dll" target="lib\net8.0"/>
<file src="src\Octokit.GraphQL\bin\Release\net8.0\Octokit.GraphQL.Core.xml" target="lib\net8.0"/>
</files>
</package>
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="Custom Packages for Octokit.GraphQL" value="lib" />
<add key="Local Packages for Octokit.GraphQL.Core.UnitTests" value="src/Octokit.GraphQL.Core.UnitTests/Assets" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
Expand Down
27 changes: 12 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
```
83 changes: 0 additions & 83 deletions scripts/configure-integration-tests.ps1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net8.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="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="coverlet.msbuild" Version="2.8.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core.Generation\Octokit.GraphQL.Core.Generation.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Octokit.GraphQL.Core.UnitTests/ConnectionTests.cs
Original file line number Diff line number Diff line change
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
10 changes: 5 additions & 5 deletions src/Octokit.GraphQL.Core.UnitTests/ExpressionRewiterTests.cs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>net8.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="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="coverlet.msbuild" Version="2.8.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL.Core\Octokit.GraphQL.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
16 changes: 10 additions & 6 deletions src/Octokit.GraphQL.Core/Octokit.GraphQL.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.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>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Octokit.GraphQL.Core.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Octokit.GraphQL.IntegrationTests</AssemblyName>
<LangVersion>7.2</LangVersion>
<TargetFramework>net8.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="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</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>
9 changes: 7 additions & 2 deletions src/Octokit.GraphQL.Pack/Octokit.GraphQL.Pack.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NoBuild>true</NoBuild>
<TargetFramework>net8.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NuspecFile>../../Octokit.GraphQL.nuspec</NuspecFile>
<NuspecBasePath>../..</NuspecBasePath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Octokit.GraphQL\Octokit.GraphQL.csproj" />
</ItemGroup>

</Project>
Loading
Loading