From e2a593acb23921a8aa91931d27c44cddb2541e4e Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Wed, 27 Nov 2024 17:59:34 +0100 Subject: [PATCH] fix(ci): Bump to net8.0 and drop unused net7.0 target for grasshopper (#3659) * fix(ci): install net7.0 explicitly on CI * test: Bump everything to net8 or drop * test: Global.json points to net8 with `latestFeature`. This prevents using net9 accidentally * fix: Typo in target framework * fix: TargetFramework instead of plural * fix: Use net8:0 image to build on mac * Added deprecation warning to comments API * reverted inputs change * Removed inputs --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> --- .circleci/scripts/config-template.yml | 9 +- ...ckle.Automate.Sdk.Tests.Integration.csproj | 2 +- .../ConnectorGrasshopper8.csproj | 31 ++-- .../ConnectorGrasshopperUtils.csproj | 6 +- Core/Core/Api/GraphQL/Inputs/CommentInputs.cs | 17 --- .../Api/GraphQL/Resources/CommentResource.cs | 136 +----------------- .../GraphQL/Resources/CommentResourceTests.cs | 97 ------------- .../Resources/SubscriptionResourceTests.cs | 19 --- .../Fixtures.cs | 8 -- .../Speckle.Core.Tests.Integration.csproj | 2 +- .../Speckle.Core.Tests.Unit.csproj | 2 +- .../DesktopUI2.Launcher.csproj | 2 +- .../DesktopUI2.WPF/DesktopUI2.WPF.csproj | 2 +- .../Objects.Tests.Unit.csproj | 2 +- global.json | 4 +- 15 files changed, 37 insertions(+), 302 deletions(-) delete mode 100644 Core/Core/Api/GraphQL/Inputs/CommentInputs.cs delete mode 100644 Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs diff --git a/.circleci/scripts/config-template.yml b/.circleci/scripts/config-template.yml index cf4a02f4d4..d450b0a006 100644 --- a/.circleci/scripts/config-template.yml +++ b/.circleci/scripts/config-template.yml @@ -77,6 +77,7 @@ jobs: # Each project will have individual jobs for each specific task it has to name: Install dotnet command: | curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 7.0.410 curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.206 $HOME/.dotnet/dotnet --version - run: @@ -200,9 +201,9 @@ jobs: # Each project will have individual jobs for each specific task it has to shell: bash.exe command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi - unless: # Build Unsigned Installers for untagged, or wip/alpha/feature/etc. tags (non-stable, non-rc) - condition: + condition: and: - - << pipeline.git.tag >> + - << pipeline.git.tag >> - not: matches: pattern: "^.*-(?!rc).*$" @@ -221,7 +222,7 @@ jobs: # Each project will have individual jobs for each specific task it has to - when: # Setup certificates and build installers signed for tagged builds that aren't prerelease condition: and: - - << pipeline.git.tag >> + - << pipeline.git.tag >> - not: matches: pattern: "^.*-(?!rc).*$" @@ -445,7 +446,7 @@ jobs: # Each project will have individual jobs for each specific task it has to build-connector-dotnet-mac: docker: - - image: mcr.microsoft.com/dotnet/sdk:7.0 + - image: mcr.microsoft.com/dotnet/sdk:8.0 parameters: slnname: type: string diff --git a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/Speckle.Automate.Sdk.Tests.Integration.csproj b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/Speckle.Automate.Sdk.Tests.Integration.csproj index 0d5b566f3c..e8f8fb0476 100644 --- a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/Speckle.Automate.Sdk.Tests.Integration.csproj +++ b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/Speckle.Automate.Sdk.Tests.Integration.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/ConnectorGrasshopper/ConnectorGrasshopper8/ConnectorGrasshopper8.csproj b/ConnectorGrasshopper/ConnectorGrasshopper8/ConnectorGrasshopper8.csproj index 800716423f..ac359e101f 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopper8/ConnectorGrasshopper8.csproj +++ b/ConnectorGrasshopper/ConnectorGrasshopper8/ConnectorGrasshopper8.csproj @@ -2,38 +2,41 @@ ConnectorGrasshopper SpeckleConnectorGrasshopper - net7.0-windows;net48 + net48 .gha Debug;Release;Debug Mac;Release Mac true - $(DefineConstants);RHINO8;GRASSHOPPER;RHINO6_OR_GREATER;RHINO7_OR_GREATER;RHINO8_OR_GREATER + + $(DefineConstants);RHINO8;GRASSHOPPER;RHINO6_OR_GREATER;RHINO7_OR_GREATER;RHINO8_OR_GREATER true true true - + - + $(DefineConstants);MAC - + - - - + + + - - - - + + + + - - + + diff --git a/ConnectorGrasshopper/ConnectorGrasshopperUtils/ConnectorGrasshopperUtils.csproj b/ConnectorGrasshopper/ConnectorGrasshopperUtils/ConnectorGrasshopperUtils.csproj index 1da71c5e0e..4e5a52284a 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperUtils/ConnectorGrasshopperUtils.csproj +++ b/ConnectorGrasshopper/ConnectorGrasshopperUtils/ConnectorGrasshopperUtils.csproj @@ -1,14 +1,10 @@ - net462;net7.0 + net462 ConnectorGrasshopperUtils none - - - - diff --git a/Core/Core/Api/GraphQL/Inputs/CommentInputs.cs b/Core/Core/Api/GraphQL/Inputs/CommentInputs.cs deleted file mode 100644 index df810adeb6..0000000000 --- a/Core/Core/Api/GraphQL/Inputs/CommentInputs.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - -namespace Speckle.Core.Api.GraphQL.Inputs; - -public sealed record CreateCommentInput( - CommentContentInput content, - string projectId, - string resourceIdString, - string? screenshot, - object? viewerState -); - -public sealed record EditCommentInput(CommentContentInput content, string commentId); - -public sealed record CreateCommentReplyInput(CommentContentInput content, string threadId); - -public sealed record CommentContentInput(IReadOnlyCollection? blobIds, object? doc); diff --git a/Core/Core/Api/GraphQL/Resources/CommentResource.cs b/Core/Core/Api/GraphQL/Resources/CommentResource.cs index bd23ae8e5c..72722468f4 100644 --- a/Core/Core/Api/GraphQL/Resources/CommentResource.cs +++ b/Core/Core/Api/GraphQL/Resources/CommentResource.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; using System.Threading.Tasks; using GraphQL; using Speckle.Core.Api.GraphQL.Inputs; @@ -9,6 +10,8 @@ namespace Speckle.Core.Api.GraphQL.Resources; public sealed class CommentResource { + internal const string OBSOLETE_MESSAGE = + "This function is longer compatible with server >=2.22, update nuget reference to Speckle.Sdk for comment mutations"; private readonly ISpeckleGraphQLClient _client; internal CommentResource(ISpeckleGraphQLClient client) @@ -105,98 +108,12 @@ query CommentThreads($projectId: String!, $cursor: String, $limit: Int!, $filter return response.project.commentThreads; } - /// - /// This function only exists here to be able to integration tests the queries. - /// The process of creating a comment is more complex and javascript specific than we can expose to our SDKs at this time. - /// - /// - /// - /// - /// - internal async Task Create(CreateCommentInput input, CancellationToken cancellationToken = default) - { - //language=graphql - const string QUERY = """ - mutation Mutation($input: CreateCommentInput!) { - data:commentMutations { - create(input: $input) { - archived - authorId - createdAt - hasParent - id - rawText - resources { - resourceId - resourceType - } - screenshot - updatedAt - viewedAt - viewerResources { - modelId - objectId - versionId - } - data - } - } - } - """; - GraphQLRequest request = new(QUERY, variables: new { input }); - var res = await _client - .ExecuteGraphQLRequest>(request, cancellationToken) - .ConfigureAwait(false); - return res.data.create; - } - - /// - /// - /// - /// - /// - internal async Task Edit(EditCommentInput input, CancellationToken cancellationToken = default) - { - //language=graphql - const string QUERY = """ - mutation Mutation($input: EditCommentInput!) { - data:commentMutations { - edit(input: $input) { - archived - authorId - createdAt - hasParent - id - rawText - resources { - resourceId - resourceType - } - screenshot - updatedAt - viewedAt - viewerResources { - modelId - objectId - versionId - } - data - } - } - } - """; - GraphQLRequest request = new(QUERY, variables: new { input }); - var res = await _client - .ExecuteGraphQLRequest>(request, cancellationToken) - .ConfigureAwait(false); - return res.data.edit; - } - /// /// /// /// /// + [Obsolete(OBSOLETE_MESSAGE)] public async Task Archive(string commentId, bool archive = true, CancellationToken cancellationToken = default) { //language=graphql @@ -218,6 +135,7 @@ mutation Mutation($commentId: String!, $archive: Boolean!) { /// /// /// + [Obsolete(OBSOLETE_MESSAGE)] public async Task MarkViewed(string commentId, CancellationToken cancellationToken = default) { //language=graphql @@ -234,46 +152,4 @@ mutation Mutation($commentId: String!) { .ConfigureAwait(false); return res.data.markViewed; } - - /// - /// - /// - /// - /// - internal async Task Reply(CreateCommentReplyInput input, CancellationToken cancellationToken = default) - { - //language=graphql - const string QUERY = """ - mutation Mutation($input: CreateCommentReplyInput!) { - data:commentMutations { - reply(input: $input) { - archived - authorId - createdAt - hasParent - id - rawText - resources { - resourceId - resourceType - } - screenshot - updatedAt - viewedAt - viewerResources { - modelId - objectId - versionId - } - data - } - } - } - """; - GraphQLRequest request = new(QUERY, variables: new { input }); - var res = await _client - .ExecuteGraphQLRequest>(request, cancellationToken) - .ConfigureAwait(false); - return res.data.reply; - } } diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs b/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs deleted file mode 100644 index cdf25948ea..0000000000 --- a/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/CommentResourceTests.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Speckle.Core.Api; -using Speckle.Core.Api.GraphQL.Inputs; -using Speckle.Core.Api.GraphQL.Models; -using Speckle.Core.Api.GraphQL.Resources; - -namespace Speckle.Core.Tests.Integration.API.GraphQL.Resources; - -[TestOf(typeof(CommentResource))] -public class CommentResourceTests -{ - private Client _testUser; - private CommentResource Sut => _testUser.Comment; - private Project _project; - private Model _model; - private string _versionId; - private Comment _comment; - - [SetUp] - public async Task Setup() - { - _testUser = await Fixtures.SeedUserWithClient(); - _project = await _testUser.Project.Create(new("Test project", "", null)); - _model = await _testUser.Model.Create(new("Test Model 1", "", _project.id)); - _versionId = await Fixtures.CreateVersion(_testUser, _project.id, _model.name); - _comment = await CreateComment(); - } - - [Test] - public async Task GetProjectComments() - { - var comments = await Sut.GetProjectComments(_project.id); - Assert.That(comments.items.Count, Is.EqualTo(1)); - Assert.That(comments.totalCount, Is.EqualTo(1)); - - Comment comment = comments.items[0]; - Assert.That(comment, Is.Not.Null); - Assert.That(comment, Has.Property(nameof(Comment.authorId)).EqualTo(_testUser.Account.userInfo.id)); - - Assert.That(comment, Has.Property(nameof(Comment.id)).EqualTo(_comment.id)); - Assert.That(comment, Has.Property(nameof(Comment.authorId)).EqualTo(_comment.authorId)); - Assert.That(comment, Has.Property(nameof(Comment.archived)).EqualTo(_comment.archived)); - Assert.That(comment, Has.Property(nameof(Comment.archived)).EqualTo(false)); - Assert.That(comment, Has.Property(nameof(Comment.createdAt)).EqualTo(_comment.createdAt)); - } - - [Test] - public async Task MarkViewed() - { - var viewed = await Sut.MarkViewed(_comment.id); - Assert.That(viewed, Is.True); - viewed = await Sut.MarkViewed(_comment.id); - Assert.That(viewed, Is.True); - } - - [Test] - public async Task Archive() - { - var archived = await Sut.Archive(_comment.id); - Assert.That(archived, Is.True); - - archived = await Sut.Archive(_comment.id); - Assert.That(archived, Is.True); - } - - [Test] - public async Task Edit() - { - var blobs = await Fixtures.SendBlobData(_testUser.Account, _project.id); - var blobIds = blobs.Select(b => b.id).ToList(); - EditCommentInput input = new(new(blobIds, null), _comment.id); - - var editedComment = await Sut.Edit(input); - - Assert.That(editedComment, Is.Not.Null); - Assert.That(editedComment, Has.Property(nameof(Comment.id)).EqualTo(_comment.id)); - Assert.That(editedComment, Has.Property(nameof(Comment.authorId)).EqualTo(_comment.authorId)); - Assert.That(editedComment, Has.Property(nameof(Comment.createdAt)).EqualTo(_comment.createdAt)); - Assert.That(editedComment, Has.Property(nameof(Comment.updatedAt)).GreaterThanOrEqualTo(_comment.updatedAt)); - } - - [Test] - public async Task Reply() - { - var blobs = await Fixtures.SendBlobData(_testUser.Account, _project.id); - var blobIds = blobs.Select(b => b.id).ToList(); - CreateCommentReplyInput input = new(new(blobIds, null), _comment.id); - - var editedComment = await Sut.Reply(input); - - Assert.That(editedComment, Is.Not.Null); - } - - private async Task CreateComment() - { - return await Fixtures.CreateComment(_testUser, _project.id, _model.id, _versionId); - } -} diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs b/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs index 6e1e845c84..b8eb96281c 100644 --- a/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs +++ b/Core/Tests/Speckle.Core.Tests.Integration/Api/GraphQL/Resources/SubscriptionResourceTests.cs @@ -98,23 +98,4 @@ public async Task ProjectVersionsUpdated_SubscriptionIsCalled() Assert.That(subscriptionMessage, Is.Not.Null); Assert.That(subscriptionMessage.id, Is.EqualTo(created)); } - - [Test] - public async Task ProjectCommentsUpdated_SubscriptionIsCalled() - { - string resourceIdString = $"{_testProject.id},{_testModel.id},{_testVersion}"; - ProjectCommentsUpdatedMessage subscriptionMessage = null; - - using var sub = Sut.CreateProjectCommentsUpdatedSubscription(new(_testProject.id, resourceIdString)); - sub.Listeners += (_, message) => subscriptionMessage = message; - - await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup - - var created = await Fixtures.CreateComment(_testUser, _testProject.id, _testModel.id, _testVersion); - - await Task.Delay(WAIT_PERIOD); // Give time for subscription to be triggered - - Assert.That(subscriptionMessage, Is.Not.Null); - Assert.That(subscriptionMessage.id, Is.EqualTo(created.id)); - } } diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Fixtures.cs b/Core/Tests/Speckle.Core.Tests.Integration/Fixtures.cs index 7150dc38b8..0d1886a7d0 100644 --- a/Core/Tests/Speckle.Core.Tests.Integration/Fixtures.cs +++ b/Core/Tests/Speckle.Core.Tests.Integration/Fixtures.cs @@ -157,14 +157,6 @@ private static Blob GenerateBlob(string content) return new Blob(filePath); } - internal static async Task CreateComment(Client client, string projectId, string modelId, string versionId) - { - var blobs = await SendBlobData(client.Account, projectId); - var blobIds = blobs.Select(b => b.id).ToList(); - CreateCommentInput input = new(new(blobIds, null), projectId, $"{projectId},{modelId},{versionId}", null, null); - return await client.Comment.Create(input); - } - internal static async Task SendBlobData(Account account, string projectId) { using ServerTransport remote = new(account, projectId); diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Speckle.Core.Tests.Integration.csproj b/Core/Tests/Speckle.Core.Tests.Integration/Speckle.Core.Tests.Integration.csproj index c22e29ae77..fd4af0354c 100644 --- a/Core/Tests/Speckle.Core.Tests.Integration/Speckle.Core.Tests.Integration.csproj +++ b/Core/Tests/Speckle.Core.Tests.Integration/Speckle.Core.Tests.Integration.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable disable false diff --git a/Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj b/Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj index b47f69346f..0f978a0be7 100644 --- a/Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj +++ b/Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable disable false diff --git a/DesktopUI2/DesktopUI2.Launcher/DesktopUI2.Launcher.csproj b/DesktopUI2/DesktopUI2.Launcher/DesktopUI2.Launcher.csproj index b0d59a0999..547c35e8a7 100644 --- a/DesktopUI2/DesktopUI2.Launcher/DesktopUI2.Launcher.csproj +++ b/DesktopUI2/DesktopUI2.Launcher/DesktopUI2.Launcher.csproj @@ -2,7 +2,7 @@ WinExe - net7.0 + net8.0 enable diff --git a/DesktopUI2/DesktopUI2.WPF/DesktopUI2.WPF.csproj b/DesktopUI2/DesktopUI2.WPF/DesktopUI2.WPF.csproj index 158e4c8f15..7ef780e1d2 100644 --- a/DesktopUI2/DesktopUI2.WPF/DesktopUI2.WPF.csproj +++ b/DesktopUI2/DesktopUI2.WPF/DesktopUI2.WPF.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows + net8.0-windows enable true true diff --git a/Objects/Tests/Objects.Tests.Unit/Objects.Tests.Unit.csproj b/Objects/Tests/Objects.Tests.Unit/Objects.Tests.Unit.csproj index 808077f3d7..07473c1d4b 100644 --- a/Objects/Tests/Objects.Tests.Unit/Objects.Tests.Unit.csproj +++ b/Objects/Tests/Objects.Tests.Unit/Objects.Tests.Unit.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false true diff --git a/global.json b/global.json index 08f229ce09..36394634bd 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "7.0.0", - "rollForward": "latestMajor", + "version": "8.0.0", + "rollForward": "latestFeature", "allowPrerelease": false } }