Skip to content

Commit

Permalink
Support .NET 9 (#233)
Browse files Browse the repository at this point in the history
* Update for .NET 9

* Fix Errors

* Update Unit Test forNUnit FluentAssertions

* Fix Failing Unit Tests

* Update build.yml

* Add `AfterAllTests()`

* Ensure IGitHubApiStatusService inherits from IDisposable

* Update tests for `IDisposable`

* Update for .NET 9 GA

* Update GitStatus.Mobile.csproj

* Update GitHubApiStatusServiceExtensionsTests.cs

* Update build.yml

* Add `partial`

* Update GitStatus.Mobile.csproj
  • Loading branch information
brminnick authored Nov 14, 2024
1 parent 9d85050 commit 26c5ae4
Show file tree
Hide file tree
Showing 53 changed files with 912 additions and 745 deletions.
81 changes: 41 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: '9.0.x'

- name: Install .NET MAUI Workload
run: |
Expand All @@ -32,18 +32,18 @@ jobs:
MobileProjectDirectory=`dirname $MobileProject`
echo $MobileProjectDirectory
dotnet build $MobileProjectDirectory -f:net8.0-android -c Release
dotnet build $MobileProjectDirectory -f:net9.0-android -c Release
iOS:
runs-on: macos-13
runs-on: macos-15

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: '9.0.x'

- name: Install .NET MAUI Workload
run: |
Expand All @@ -62,18 +62,18 @@ jobs:
MobileProjectDirectory=`dirname $MobileProject`
echo $MobileProjectDirectory
dotnet build $MobileProjectDirectory -f:net8.0-ios -c Release
dotnet build $MobileProjectDirectory -f:net9.0-ios -c Release
MacCatalyst:
runs-on: macos-13
runs-on: macos-15

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: '9.0.x'

- name: Install .NET MAUI Workload
run: |
Expand All @@ -92,42 +92,42 @@ jobs:
MobileProjectDirectory=`dirname $MobileProject`
echo $MobileProjectDirectory
dotnet build $MobileProjectDirectory -f:net8.0-maccatalyst -c Release
dotnet build $MobileProjectDirectory -f:net9.0-maccatalyst -c Release
Windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
java-version: '17'

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: '9.0.x'

- name: Install .NET MAUI Workload
run: |
dotnet workload install maui
- name: Build Windows App
run: |
dotnet build ./samples/GitStatus.Mobile/ -c Release -f net8.0-windows10.0.19041.0
dotnet build ./samples/GitStatus.Mobile/ -c Release -f net9.0-windows10.0.19041.0
API:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Build API App
run: |
Expand All @@ -143,12 +143,12 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Build Console App
run: |
Expand All @@ -164,12 +164,12 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Build Web App
run: |
Expand All @@ -185,12 +185,13 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET v8.0
uses: actions/setup-dotnet@v3
- name: Setup .NET v9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'


- name: Build Web App
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
UnitTests:
runs-on: macos-latest
runs-on: macos-15

env:
GitHubPersonalAccessToken: ${{ secrets.GitHubPersonalAccessToken }}
Expand All @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
7.0.x
6.0.x
Expand Down
95 changes: 72 additions & 23 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,90 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>NETSDK1023</NoWarn>
<IsTrimmable>false</IsTrimmable>
<LangVersion>latest</LangVersion>
<NuGetVersion>4.0.0</NuGetVersion>
<LangVersion>preview</LangVersion>
<Deterministic>true</Deterministic>
<ImplicitUsings>enable</ImplicitUsings>
<LatestSupportedTFM>net9.0</LatestSupportedTFM>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<LatestSupportedNetVersion>net8.0</LatestSupportedNetVersion>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>

<!-- MAUI Specific -->
<MauiPackageVersion>9.0.10</MauiPackageVersion>
<MauiStrictXamlCompilation>true</MauiStrictXamlCompilation>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
<MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>

<!-- Prevent NuGet Pacakge Vulnerabilities -->
<NuGetAudit>enable</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>

<!-- https://learn.microsoft.com/dotnet/core/deploying/native-aot/?tabs=net8plus%2Cwindows -->
<StripSymbols>false</StripSymbols>
<TrimmerSingleWarn>false</TrimmerSingleWarn>

<!-- WarningsAsErrors
CS0419: Ambiguous reference in cref attribute
CS1570: XML comment has badly formed XML 'Expected an end tag for element [parameter]
CS1571: XML comment on [construct] has a duplicate param tag for [parameter]
CS1572: XML comment has a param tag for '[parameter]', but there is no parameter by that name
CS1573: Parameter has no matching param tag in the XML comment
CS1574: XML comment has cref attribute that could not be resolved
CS1580: Invalid type for parameter 'parameter number' in XML comment cref attribute
CS1581: Invalid return type in XML comment cref attribute
CS0419: Ambiguous reference in cref attribute
CS0618: Is obsolete
CS1570: XML comment has badly formed XML 'Expected an end tag for element [parameter]
CS1571: XML comment on [construct] has a duplicate param tag for [parameter]
CS1572: XML comment has a param tag for '[parameter]', but there is no parameter by that name
CS1573: Parameter has no matching param tag in the XML comment
CS1574: XML comment has cref attribute that could not be resolved
CS1580: Invalid type for parameter 'parameter number' in XML comment cref attribute
CS1581: Invalid return type in XML comment cref attribute
CS1584: XML comment has syntactically incorrect cref attribute
CS1587: XML comment is not placed on a valid language element
CS1589: The syntax of a tag which referenced a file was incorrect
CS1590: Invalid XML include element Missing file attribute
CS1587: XML comment is not placed on a valid language element
CS1589: The syntax of a tag which referenced a file was incorrect
CS1590: Invalid XML include element Missing file attribute
CS1591: Missing XML comment for publicly visible type or member
CS1592: Badly formed XML in included comments file
CS1598: XML parser could not be loaded. The XML documentation file will not be generated.
CS1592: Badly formed XML in included comments file
CS1598: XML parser could not be loaded. The XML documentation file will not be generated.
CS1658: Identifier expected; 'true' is a keyword
CS1710: XML comment on 'type' has a duplicate typeparam tag for 'parameter'
CS1711: XML comment has a typeparam tag, but there is no type parameter by that name
CS1711: XML comment has a typeparam tag, but there is no type parameter by that name
CS1712: Type parameter has no matching typeparam tag in the XML comment
CS1723: XML comment has cref attribute that refers to a type parameter
CS1734: XML comment has a paramref tag, but there is no parameter by that name
xUnit1012: Null should not be used for type parameter
xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited -->
<WarningsAsErrors>nullable,CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734,xUnit1012,xUnit2021</WarningsAsErrors>
CS1734: XML comment has a paramref tag, but there is no parameter by that name
CsWinRT1028: Class implements WinRT interfaces but isn't marked partial
CsWinRT1030: Class implements WinRT interfaces that require unsafe code
XC0045: Binding: Property not found
XC0103: Consider attributing the markup extension with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any
NU1900 Error communicating with package source, while getting vulnerability information.
NU1901 Package with low severity detected
NU1902 Package with moderate severity detected
NU1903 Package with high severity detected
NU1904 Package with critical severity detected
NU1905 An audit source does not provide a vulnerability database
NUnit*: NUnit Analyzers
IL2***: Trim Warnings
IL3***: AOT Warnings-->
<WarningsAsErrors>
nullable,
CS0419,CS0618,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734,
CsWinRT1028,CsWinRT1030,
XC0045,XC0103,
NU1900,NU1901,NU1902,NU1903,NU1904,NU1905,
NUnit1001,NUnit1002,NUnit1003,NUnit1004,NUnit1005,NUnit1006,NUnit1007,NUnit1008,NUnit1009,NUnit1010,NUnit1011,NUnit1012,NUnit1013,NUnit1014,NUnit1015,NUnit1016,NUnit1017,NUnit1018,NUnit1019,NUnit1020,NUnit1021,NUnit1022,NUnit1023,NUnit1024,NUnit1025,NUnit1026,NUnit1027,NUnit1028,NUnit1029,NUnit1030,NUnit1031,NUnit1032,NUnit1033,
NUnit2001,NUnit2002,NUnit2003,NUnit2004,NUnit2005,NUnit2006,NUnit2007,NUnit2008,NUnit2009,NUnit2010,NUnit2011,NUnit2012,NUnit2013,NUnit2014,NUnit2015,NUnit2016,NUnit2017,NUnit2018,NUnit2019,NUnit2020,NUnit2021,NUnit2022,NUnit2023,NUnit2024,NUnit2025,NUnit2026,NUnit2027,NUnit2028,NUnit2029,NUnit2030,NUnit2031,NUnit2032,NUnit2033,NUnit2034,NUnit2035,NUnit2036,NUnit2037,NUnit2038,NUnit2039,NUnit2040,NUnit2041,NUnit2042,NUnit2043,NUnit2044,NUnit2045,NUnit2046,NUnit2047,NUnit2048,NUnit2049,NUnit2050,
NUnit3001,NUnit3002,NUnit3003,NUnit3004,
NUnit4001,
IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009,
IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019,
IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029,
IL2030,IL2031,IL2032,IL2033,IL2034,IL2035,IL2036,IL2037,IL2038,IL2039,
IL2040,IL2041,IL2042,IL2043,IL2044,IL2045,IL2046,IL2047,IL2048,IL2049,
IL2050,IL2051,IL2052,IL2053,IL2054,IL2055,IL2056,IL2057,IL2058,IL2059,
IL2060,IL2061,IL2062,IL2063,IL2064,IL2065,IL2066,IL2067,IL2068,IL2069,
IL2070,IL2071,IL2072,IL2073,IL2074,IL2075,IL2076,IL2077,IL2078,IL2079,
IL2080,IL2081,IL2082,IL2083,IL2084,IL2085,IL2086,IL2087,IL2088,IL2089,
IL2090,IL2091,IL2092,IL2093,IL2094,IL2095,IL2096,IL2097,IL2098,IL2099,
IL2100,IL2101,IL2102,IL2103,IL2104,IL2105,IL2106,IL2107,IL2108,IL2109,
IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119,
IL2120,IL2121,IL2122,
IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056
</WarningsAsErrors>
</PropertyGroup>
</Project>
</Project>
18 changes: 14 additions & 4 deletions GitHubApiStatus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Console", "Console", "{1D17
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitStatus.ConsoleApp", "samples\GitStatus.ConsoleApp\GitStatus.ConsoleApp.csproj", "{BE045971-4CE8-4C59-BAEB-0BF3A42A9C0A}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "GitStatus.Shared", "samples\GitStatus.Shared\GitStatus.Shared.shproj", "{EE691483-A8A2-4071-9C75-E70F0250E5D2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{6DE141A9-EDFE-464D-BB27-2CFB182118AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHubApiStatus.Extensions", "src\GitHubApiStatus.Extensions\GitHubApiStatus.Extensions.csproj", "{AE935942-772A-4A9D-A1E1-2BC99D41F4C9}"
Expand All @@ -38,6 +36,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitStatus.Mobile", "samples\GitStatus.Mobile\GitStatus.Mobile.csproj", "{F6B5ED4D-EEF5-46AC-94CA-064D292B0E00}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitStatus.Common", "GitStatus.Common\GitStatus.Common.csproj", "{927E2323-6227-4CE2-AF69-9A4290635040}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -144,6 +144,18 @@ Global
{F6B5ED4D-EEF5-46AC-94CA-064D292B0E00}.Release|iPhone.Build.0 = Release|Any CPU
{F6B5ED4D-EEF5-46AC-94CA-064D292B0E00}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F6B5ED4D-EEF5-46AC-94CA-064D292B0E00}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|Any CPU.Build.0 = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|iPhone.Build.0 = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|Any CPU.ActiveCfg = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|Any CPU.Build.0 = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|iPhone.ActiveCfg = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|iPhone.Build.0 = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{927E2323-6227-4CE2-AF69-9A4290635040}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -153,7 +165,6 @@ Global
{A52818B8-0C2C-49C5-9389-D8790237ADCE} = {E2BF43DD-5550-414E-9F01-7F7E5492CCB1}
{1D178B33-C69B-47E7-AF90-B460B34BCC37} = {E2BF43DD-5550-414E-9F01-7F7E5492CCB1}
{BE045971-4CE8-4C59-BAEB-0BF3A42A9C0A} = {1D178B33-C69B-47E7-AF90-B460B34BCC37}
{EE691483-A8A2-4071-9C75-E70F0250E5D2} = {E2BF43DD-5550-414E-9F01-7F7E5492CCB1}
{6DE141A9-EDFE-464D-BB27-2CFB182118AD} = {E2BF43DD-5550-414E-9F01-7F7E5492CCB1}
{A5FF2946-AE9A-4FE4-8650-75719BA23D5B} = {6DE141A9-EDFE-464D-BB27-2CFB182118AD}
{70DBA7CC-2319-4B3F-8F83-97B3368AC890} = {AF841AED-C887-4B39-868A-02242D30780B}
Expand All @@ -169,7 +180,6 @@ Global
samples\GitStatus.Shared\GitStatus.Shared.projitems*{9a30833a-01c9-44ed-b8e2-032a4846574f}*SharedItemsImports = 5
samples\GitStatus.Shared\GitStatus.Shared.projitems*{a5ff2946-ae9a-4fe4-8650-75719ba23d5b}*SharedItemsImports = 5
samples\GitStatus.Shared\GitStatus.Shared.projitems*{be045971-4ce8-4c59-baeb-0bf3a42a9c0a}*SharedItemsImports = 5
samples\GitStatus.Shared\GitStatus.Shared.projitems*{ee691483-a8a2-4071-9c75-e70f0250e5d2}*SharedItemsImports = 13
samples\GitStatus.Shared\GitStatus.Shared.projitems*{f6b5ed4d-eef5-46ac-94ca-064d292b0e00}*SharedItemsImports = 5
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions GitStatus.Common/Constants/GitHubConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace GitStatus.Common;

public static class GitHubConstants
{
public const string AuthScheme = "bearer";
public const string PersonalAccessToken = "";
public const string GitHubRestApiUrl = "https://api.github.com";
public const string GitHubGraphQLApiUrl = "https://api.github.com/graphql";
}
7 changes: 7 additions & 0 deletions GitStatus.Common/GitStatus.Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;$(LatestSupportedTFM)</TargetFrameworks>
</PropertyGroup>

</Project>
7 changes: 4 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sdk": {
"version": "8.0.300",
"rollForward": "latestFeature"
"version": "9.0.100-rc.2.24474.11",
"rollForward": "latestFeature",
"allowPrerelease": true
}
}
}
Loading

0 comments on commit 26c5ae4

Please sign in to comment.