Skip to content

Commit 1282c04

Browse files
authored
Merge pull request #66 from thunderstore-io/net7-upgrade
Upgrade to .NET 7
2 parents cee9e38 + e399c41 commit 1282c04

File tree

10 files changed

+44
-36
lines changed

10 files changed

+44
-36
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ name: Publish
22

33
on:
44
release:
5-
types: [released]
5+
types: [released, prereleased]
66

77
jobs:
88
nuget:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: actions/setup-dotnet@v1
12+
- uses: actions/setup-dotnet@v3
1313
with:
14-
dotnet-version: '6.0.x'
14+
dotnet-version: '7'
1515

1616
- name: Fetch Latest .nupkg
1717
uses: dsaltares/fetch-gh-release-asset@0efe227dedb360b09ea0e533795d584b61c461a9

.github/workflows/release.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ jobs:
2727
platform-binary:
2828
needs: validate-tag
2929
if: github.event.base_ref == 'refs/heads/master'
30-
name: Create binary ${{ matrix.os }}
30+
name: Create binary ${{ matrix.target }}
3131
runs-on: ${{ matrix.os }}
3232
strategy:
3333
matrix:
3434
kind: ['linux', 'windows', 'macOS']
3535
include:
3636
- kind: linux
37-
os: ubuntu-latest
3837
target: linux-x64
38+
os: ubuntu-latest
3939
- kind: windows
40-
os: windows-latest
4140
target: win-x64
41+
os: windows-latest
4242
- kind: macOS
43-
os: macos-latest
4443
target: osx-x64
44+
os: macos-latest
4545
steps:
4646
- uses: actions/checkout@v2
47-
- uses: actions/setup-dotnet@v1
47+
- uses: actions/setup-dotnet@v3
4848
with:
49-
dotnet-version: '6.0.x'
49+
dotnet-version: '7'
5050
- id: tag
5151
uses: dawidd6/action-get-tag@v1
5252
- name: Install dependencies
@@ -56,15 +56,15 @@ jobs:
5656
shell: bash
5757
run: |
5858
release_name="tcli-${{ steps.tag.outputs.tag }}-${{ matrix.target }}"
59-
dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -o "$release_name" -p:PublishReadyToRun=true
59+
dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -f net7.0 -o "${release_name}"
6060
6161
if [ "${{ matrix.target }}" == "win-x64" ]; then
62-
7z a -tzip "${release_name}.zip" "./${release_name}/*"
62+
7z a -tzip "${release_name}.zip" "./${release_name}"
6363
else
64-
tar czvf "${release_name}.tar.gz" "$release_name"
64+
tar czvf "${release_name}.tar.gz" "./${release_name}"
6565
fi
6666
67-
rm -r "$release_name"
67+
rm -r ${release_name}
6868
6969
- name: Publish to GitHub
7070
uses: softprops/action-gh-release@v1
@@ -82,20 +82,23 @@ jobs:
8282
runs-on: ubuntu-latest
8383
steps:
8484
- uses: actions/checkout@v2
85-
- uses: actions/setup-dotnet@v1
85+
- uses: actions/setup-dotnet@v3
8686
with:
87-
dotnet-version: '6.0.x'
87+
dotnet-version: '7'
8888
- id: tag
8989
uses: dawidd6/action-get-tag@v1
9090
- name: Install dependencies
9191
run: dotnet restore
9292

9393
- name: Build
9494
shell: bash
95-
run: dotnet pack ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -o "." -p:SelfContained=false -p:PublishTrimmed=false -p:PublishSingleFile=false -p:StartupObject="" -p:RuntimeIdentifier="" -p:PublishReadyToRun=false -p:PackAsTool=true
95+
run: dotnet pack ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -o "." -p:PublishSelfContained=false -p:PublishSingleFile=false -p:PublishTrimmed=false -p:PublishReadyToRun=false
9696

9797
- name: Publish to GitHub
9898
uses: softprops/action-gh-release@v1
9999
with:
100100
files: "tcli*"
101+
name: "Thunderstore CLI ${{ steps.tag.outputs.tag }}"
102+
body_path: ${{ github.workspace }}/.github/RELEASE_TEMPLATE.md
101103
draft: true
104+
prerelease: ${{ startsWith(steps.tag.outputs.tag, '0.') }}

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v2
11-
- uses: actions/setup-dotnet@v1
11+
- uses: actions/setup-dotnet@v3
1212
with:
13-
dotnet-version: '6.0.x'
13+
dotnet-version: '7'
1414
- uses: actions/setup-python@v2
1515
with:
1616
python-version: '3.8'
@@ -31,9 +31,9 @@ jobs:
3131
OS: ${{ matrix.os }}
3232
steps:
3333
- uses: actions/checkout@v2
34-
- uses: actions/setup-dotnet@v1
34+
- uses: actions/setup-dotnet@v3
3535
with:
36-
dotnet-version: '6.0.x'
36+
dotnet-version: '7'
3737
- name: Install dependencies
3838
run: dotnet restore
3939
- name: Build

ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
5+
<RollForward>Major</RollForward>
6+
<LangVersion>11</LangVersion>
57
<IsPackable>false</IsPackable>
6-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
7-
<LangVersion>latest</LangVersion>
8-
<EnablePreviewFeatures>true</EnablePreviewFeatures>
98
</PropertyGroup>
109

1110
<ItemGroup>
1211
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
1312
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
14-
<PackageReference Include="Samboy063.Tomlet" Version="3.1.3" />
13+
<PackageReference Include="Samboy063.Tomlet" Version="5.0.0" />
1514
<PackageReference Include="xunit" Version="2.4.1" />
1615
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1716
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

ThunderstoreCLI/Configuration/Config.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using ThunderstoreCLI.API;
23
using ThunderstoreCLI.Models;
34

@@ -128,7 +129,7 @@ public static Config Parse(IConfigProvider[] configProviders)
128129
return result;
129130
}
130131

131-
public static void Merge<T>(T target, T source, bool overwrite)
132+
public static void Merge<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(T target, T source, bool overwrite)
132133
{
133134
if (source == null)
134135
return;

ThunderstoreCLI/Models/BaseJson.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static class BaseJson
4242

4343
public static class BaseJsonExtensions
4444
{
45-
public static string SerializeList<T>(this List<T> list, JsonSerializerSettings? options = null)
45+
public static string SerializeList<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this List<T> list, JsonSerializerSettings? options = null)
4646
where T : BaseJson<T>
4747
{
4848
return JsonConvert.SerializeObject(list, options);

ThunderstoreCLI/Models/ISerialize.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ public interface ISerialize<[DynamicallyAccessedMembers(DynamicallyAccessedMembe
66
where T : ISerialize<T>
77
{
88
public string Serialize();
9+
#if NET7_0
910
public static abstract T? Deserialize(string input);
1011
public static abstract ValueTask<T?> DeserializeAsync(string input);
1112
public static abstract ValueTask<T?> DeserializeAsync(Stream input);
13+
#endif
1214
}

ThunderstoreCLI/Models/Interaction/BaseInteraction.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
13
namespace ThunderstoreCLI.Models.Interaction;
24

35
public enum InteractionOutputType
@@ -11,7 +13,7 @@ public static class InteractionOptions
1113
public static InteractionOutputType OutputType { get; set; } = InteractionOutputType.HUMAN;
1214
}
1315

14-
public abstract class BaseInteraction<T> : BaseJson<T>
16+
public abstract class BaseInteraction<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T> : BaseJson<T>
1517
where T : BaseInteraction<T>
1618
{
1719
public abstract string GetHumanString();

ThunderstoreCLI/ThunderstoreCLI.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
6-
<LangVersion>preview</LangVersion>
7-
<EnablePreviewFeatures>true</EnablePreviewFeatures>
5+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
6+
<LangVersion>11</LangVersion>
7+
<RollForward>Major</RollForward>
88
<RootNamespace>ThunderstoreCLI</RootNamespace>
99
<AssemblyName>tcli</AssemblyName>
1010
<StartupObject>ThunderstoreCLI.Program</StartupObject>
1111
<Company>Thunderstore</Company>
1212
<Product>Thunderstore CLI</Product>
1313
<PackageProjectUrl>https://thunderstore.io/</PackageProjectUrl>
1414
<Description>Thunderstore CLI is a command-line utility for building and uploading packages to Thunderstore</Description>
15-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
16-
<PublishSingleFile>true</PublishSingleFile>
1715
<PublishTrimmed>true</PublishTrimmed>
18-
<SelfContained>true</SelfContained>
16+
<TrimMode>partial</TrimMode>
1917
<PublishReadyToRun>true</PublishReadyToRun>
18+
<PublishSingleFile>true</PublishSingleFile>
19+
<PublishSelfContained>true</PublishSelfContained>
2020
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
2121
<Nullable>enable</Nullable>
2222
<DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
23-
<LangVersion>latest</LangVersion>
23+
<PackAsTool>true</PackAsTool>
2424
<ToolCommandName>$(AssemblyName)</ToolCommandName>
2525
<ImplicitUsings>enable</ImplicitUsings>
2626
</PropertyGroup>
@@ -33,7 +33,7 @@
3333
<PrivateAssets>all</PrivateAssets>
3434
</PackageReference>
3535
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
36-
<PackageReference Include="Samboy063.Tomlet" Version="3.1.3" />
36+
<PackageReference Include="Samboy063.Tomlet" Version="5.0.0" />
3737
</ItemGroup>
3838

3939
<!-- https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md -->

ThunderstoreCLI/Utils/Spinner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public async Task Start()
6666
if (completed == _tasks.Length)
6767
{
6868
Write.Empty();
69+
await Task.WhenAll(_tasks);
6970
return;
7071
}
7172

0 commit comments

Comments
 (0)