From 2cf7416da871f3e63b7de86e6a3866962d888f8b Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 24 Nov 2022 22:14:14 -0600 Subject: [PATCH 1/3] Upgrade to .NET 7 --- .github/workflows/publish.yml | 6 ++-- .github/workflows/release.yml | 29 ++++++++++--------- .github/workflows/test.yml | 8 ++--- .../ThunderstoreCLI.Tests.csproj | 7 ++--- ThunderstoreCLI/ThunderstoreCLI.csproj | 15 +++++----- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index af3760c..38aefe1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,16 +2,16 @@ name: Publish on: release: - types: [released] + types: [released, prereleased] jobs: nuget: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7' - name: Fetch Latest .nupkg uses: dsaltares/fetch-gh-release-asset@0efe227dedb360b09ea0e533795d584b61c461a9 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94e9af3..0007180 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,26 +27,26 @@ jobs: platform-binary: needs: validate-tag if: github.event.base_ref == 'refs/heads/master' - name: Create binary ${{ matrix.os }} + name: Create binary ${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: matrix: kind: ['linux', 'windows', 'macOS'] include: - kind: linux - os: ubuntu-latest target: linux-x64 + os: ubuntu-latest - kind: windows - os: windows-latest target: win-x64 + os: windows-latest - kind: macOS - os: macos-latest target: osx-x64 + os: macos-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7' - id: tag uses: dawidd6/action-get-tag@v1 - name: Install dependencies @@ -56,15 +56,15 @@ jobs: shell: bash run: | release_name="tcli-${{ steps.tag.outputs.tag }}-${{ matrix.target }}" - dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -o "$release_name" -p:PublishReadyToRun=true + dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -o "${release_name}" if [ "${{ matrix.target }}" == "win-x64" ]; then - 7z a -tzip "${release_name}.zip" "./${release_name}/*" + 7z a -tzip "${release_name}.zip" "./${release_name}" else - tar czvf "${release_name}.tar.gz" "$release_name" + tar czvf "${release_name}.tar.gz" "./${release_name}" fi - rm -r "$release_name" + rm -r ${release_name} - name: Publish to GitHub uses: softprops/action-gh-release@v1 @@ -82,9 +82,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7' - id: tag uses: dawidd6/action-get-tag@v1 - name: Install dependencies @@ -92,10 +92,13 @@ jobs: - name: Build shell: bash - 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 + run: dotnet pack ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -o "." -p:PublishSelfContained=false -p:PublishSingleFile=false -p:PublishTrimmed=false -p:PublishReadyToRun=false - name: Publish to GitHub uses: softprops/action-gh-release@v1 with: files: "tcli*" + name: "Thunderstore CLI ${{ steps.tag.outputs.tag }}" + body_path: ${{ github.workspace }}/.github/RELEASE_TEMPLATE.md draft: true + prerelease: ${{ startsWith(steps.tag.outputs.tag, '0.') }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1486f95..52e5b17 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7' - uses: actions/setup-python@v2 with: python-version: '3.8' @@ -31,9 +31,9 @@ jobs: OS: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7' - name: Install dependencies run: dotnet restore - name: Build diff --git a/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj b/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj index d7207eb..0606282 100644 --- a/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj +++ b/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj @@ -1,17 +1,14 @@ - net6.0 + net7.0 false - win-x64 - latest - true - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/ThunderstoreCLI/ThunderstoreCLI.csproj b/ThunderstoreCLI/ThunderstoreCLI.csproj index a7f72f1..c132a8f 100644 --- a/ThunderstoreCLI/ThunderstoreCLI.csproj +++ b/ThunderstoreCLI/ThunderstoreCLI.csproj @@ -2,9 +2,8 @@ Exe - net6.0 - preview - true + net7.0 + Major ThunderstoreCLI tcli ThunderstoreCLI.Program @@ -12,15 +11,15 @@ Thunderstore CLI https://thunderstore.io/ Thunderstore CLI is a command-line utility for building and uploading packages to Thunderstore - win-x64 - true true - true + partial true + true + true true enable None - latest + true $(AssemblyName) enable @@ -33,7 +32,7 @@ all - + From ca1894356a2c0dc5174e992aee9460d246b5ef64 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 26 Nov 2022 03:16:45 -0600 Subject: [PATCH 2/3] Multitarget NET 6 --- .github/workflows/release.yml | 2 +- ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj | 4 +++- ThunderstoreCLI/Configuration/Config.cs | 3 ++- ThunderstoreCLI/Models/BaseJson.cs | 2 +- ThunderstoreCLI/Models/ISerialize.cs | 2 ++ ThunderstoreCLI/Models/Interaction/BaseInteraction.cs | 4 +++- ThunderstoreCLI/ThunderstoreCLI.csproj | 3 ++- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0007180..f38d3b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: shell: bash run: | release_name="tcli-${{ steps.tag.outputs.tag }}-${{ matrix.target }}" - dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -o "${release_name}" + dotnet publish ThunderstoreCLI/ThunderstoreCLI.csproj -c Release -r "${{ matrix.target }}" -f net7.0 -o "${release_name}" if [ "${{ matrix.target }}" == "win-x64" ]; then 7z a -tzip "${release_name}.zip" "./${release_name}" diff --git a/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj b/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj index 0606282..4994f5b 100644 --- a/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj +++ b/ThunderstoreCLI.Tests/ThunderstoreCLI.Tests.csproj @@ -1,7 +1,9 @@ - net7.0 + net7.0;net6.0 + Major + 11 false diff --git a/ThunderstoreCLI/Configuration/Config.cs b/ThunderstoreCLI/Configuration/Config.cs index 4c36610..254f9cc 100644 --- a/ThunderstoreCLI/Configuration/Config.cs +++ b/ThunderstoreCLI/Configuration/Config.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using ThunderstoreCLI.API; using ThunderstoreCLI.Models; @@ -128,7 +129,7 @@ public static Config Parse(IConfigProvider[] configProviders) return result; } - public static void Merge(T target, T source, bool overwrite) + public static void Merge<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(T target, T source, bool overwrite) { if (source == null) return; diff --git a/ThunderstoreCLI/Models/BaseJson.cs b/ThunderstoreCLI/Models/BaseJson.cs index 06115e7..829a3d2 100644 --- a/ThunderstoreCLI/Models/BaseJson.cs +++ b/ThunderstoreCLI/Models/BaseJson.cs @@ -42,7 +42,7 @@ public static class BaseJson public static class BaseJsonExtensions { - public static string SerializeList(this List list, JsonSerializerSettings? options = null) + public static string SerializeList<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this List list, JsonSerializerSettings? options = null) where T : BaseJson { return JsonConvert.SerializeObject(list, options); diff --git a/ThunderstoreCLI/Models/ISerialize.cs b/ThunderstoreCLI/Models/ISerialize.cs index 736b9c9..8cdd635 100644 --- a/ThunderstoreCLI/Models/ISerialize.cs +++ b/ThunderstoreCLI/Models/ISerialize.cs @@ -6,7 +6,9 @@ public interface ISerialize<[DynamicallyAccessedMembers(DynamicallyAccessedMembe where T : ISerialize { public string Serialize(); +#if NET7_0 public static abstract T? Deserialize(string input); public static abstract ValueTask DeserializeAsync(string input); public static abstract ValueTask DeserializeAsync(Stream input); +#endif } diff --git a/ThunderstoreCLI/Models/Interaction/BaseInteraction.cs b/ThunderstoreCLI/Models/Interaction/BaseInteraction.cs index a7e22ba..e734375 100644 --- a/ThunderstoreCLI/Models/Interaction/BaseInteraction.cs +++ b/ThunderstoreCLI/Models/Interaction/BaseInteraction.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace ThunderstoreCLI.Models.Interaction; public enum InteractionOutputType @@ -11,7 +13,7 @@ public static class InteractionOptions public static InteractionOutputType OutputType { get; set; } = InteractionOutputType.HUMAN; } -public abstract class BaseInteraction : BaseJson +public abstract class BaseInteraction<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T> : BaseJson where T : BaseInteraction { public abstract string GetHumanString(); diff --git a/ThunderstoreCLI/ThunderstoreCLI.csproj b/ThunderstoreCLI/ThunderstoreCLI.csproj index c132a8f..7176c8a 100644 --- a/ThunderstoreCLI/ThunderstoreCLI.csproj +++ b/ThunderstoreCLI/ThunderstoreCLI.csproj @@ -2,7 +2,8 @@ Exe - net7.0 + net7.0;net6.0 + 11 Major ThunderstoreCLI tcli From e399c41e828240e8672561f8c935c9d57b73a355 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 26 Nov 2022 03:21:54 -0600 Subject: [PATCH 3/3] Fix spinner test failure --- ThunderstoreCLI/Utils/Spinner.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ThunderstoreCLI/Utils/Spinner.cs b/ThunderstoreCLI/Utils/Spinner.cs index 22c1ab5..3031e64 100644 --- a/ThunderstoreCLI/Utils/Spinner.cs +++ b/ThunderstoreCLI/Utils/Spinner.cs @@ -66,6 +66,7 @@ public async Task Start() if (completed == _tasks.Length) { Write.Empty(); + await Task.WhenAll(_tasks); return; }