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

Main to dev #18

Merged
merged 12 commits into from
Jul 9, 2024
Merged
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ jobs:
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: 🔫 Build All
run: ./build.sh

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
files: tests/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:

- name: 🔫 Build and Pack
run: ./build.sh pack

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
files: tests/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}

- name: Push to nuget.org
run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.CONNECTORS_NUGET_TOKEN }} --skip-duplicate
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ tools

.DS_Store
*.snupkg
/tests/TestArchives/6d23a38c-f064-4ef1-ad89-b942396f53b9/Scratch
coverage.xml
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<ItemGroup>
<PackageVersion Include="altcover" Version="8.8.74" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="GraphQL.Client" Version="6.0.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
Expand All @@ -14,16 +15,15 @@
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageVersion Include="Serilog.Sinks.Seq" Version="5.2.2" />
<PackageVersion Include="SerilogTimings" Version="3.0.1" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="Speckle.Newtonsoft.Json" Version="13.0.2" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="7.0.5" />
<PackageVersion Include="System.DoubleNumerics" Version="3.1.3" />
<PackageVersion Include="Speckle.DoubleNumerics" Version="4.0.1-alpha.3" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.6" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="JunitXml.TestLogger" Version="3.0.124" />
<PackageVersion Include="Bullseye" Version="5.0.0" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
Expand All @@ -32,4 +32,4 @@
<GlobalPackageReference Include="MinVer" Version="5.0.0" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
</Project>
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

[![Twitter Follow](https://img.shields.io/twitter/follow/SpeckleSystems?style=social)](https://twitter.com/SpeckleSystems) [![Community forum users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fdiscourse.speckle.works&style=flat-square&logo=discourse&logoColor=white)](https://discourse.speckle.works) [![website](https://img.shields.io/badge/https://-speckle.systems-royalblue?style=flat-square)](https://speckle.systems) [![docs](https://img.shields.io/badge/docs-speckle.guide-orange?style=flat-square&logo=read-the-docs&logoColor=white)](https://speckle.guide/dev/)

[![codecov](https://codecov.io/gh/specklesystems/speckle-sharp-sdk/graph/badge.svg?token=TTM5OGr38m)](https://codecov.io/gh/specklesystems/speckle-sharp-sdk)

## **Disclaimer**

This is an early alpha release, not meant for use in production! We're working to stabilise the 2.0 API, and until then there will be breaking changes. You have been warned!
This is an early alpha release, not meant for use in production! We're working to stabilise the 3.0 API, and until then there will be breaking changes. You have been warned!

## Introduction

Expand Down
14 changes: 14 additions & 0 deletions Speckle.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Transports.MongoDB"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Serialization.Tests", "tests\Speckle.Core.Serialization.Tests\Speckle.Core.Serialization.Tests.csproj", "{AA1E1E51-49AE-4F71-84B1-938E19695BE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Tests.Integration", "tests\Speckle.Core.Tests.Integration\Speckle.Core.Tests.Integration.csproj", "{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B623BD21-5CAA-43F9-A539-1835276C220E}"
ProjectSection(SolutionItems) = preProject
.github\workflows\main.yml = .github\workflows\main.yml
.github\workflows\ci.yml = .github\workflows\ci.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -74,6 +82,10 @@ Global
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Release|Any CPU.Build.0 = Release|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A413E196-3696-4F48-B635-04B5F76BF9C9} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
Expand All @@ -84,5 +96,7 @@ Global
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7} = {58D37DA9-F948-48CA-9A73-F5BBBD533DBF}
{68078752-7C54-471A-9CB6-E8AEF34A9EFF} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
{AA1E1E51-49AE-4F71-84B1-938E19695BE0} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
{B623BD21-5CAA-43F9-A539-1835276C220E} = {DA2AED52-58F9-471E-8AD8-102FD36129E3}
EndGlobalSection
EndGlobal
11 changes: 7 additions & 4 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ void RemoveDirectory(string d)

Target(RESTORE, () => RunAsync("dotnet", "restore Speckle.Sdk.sln --locked-mode"));

Target(BUILD, DependsOn(RESTORE), () => RunAsync("dotnet", $"build Speckle.Sdk.sln -c Release --no-restore"));
Target(BUILD, DependsOn(RESTORE), () => RunAsync("dotnet", "build Speckle.Sdk.sln -c Release --no-restore"));

Target(
TEST,
DependsOn(BUILD),
Glob.Files(".", "**/*.Tests.Unit.csproj"),
Glob.Files(".", "**/*.Tests.Unit.csproj").Concat(Glob.Files(".", "**/*.Tests.csproj")),
async file =>
{
await RunAsync("dotnet", $"test {file} -c Release --no-build --verbosity=normal");
await RunAsync(
"dotnet",
$"test {file} -c Release --no-build --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage"
);
}
);

Target(PACK, DependsOn(BUILD), () => RunAsync("dotnet", "pack Speckle.Sdk.sln -c Release -o output --no-build"));
Target(PACK, DependsOn(TEST), () => RunAsync("dotnet", "pack Speckle.Sdk.sln -c Release -o output --no-build"));

Target("default", DependsOn(FORMAT, TEST), () => Console.WriteLine("Done!"));

Expand Down
13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
coverage:
status:
project:
default:
informational: true
target: auto
threshold: 1%
base: auto
patch:
default:
informational: true
github_checks:
annotations: false
97 changes: 57 additions & 40 deletions src/Speckle.Core/Api/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,55 @@ namespace Speckle.Core.Api;
/// <summary>
/// Base class for GraphQL API exceptions
/// </summary>
public class SpeckleGraphQLException<T> : SpeckleException
public class SpeckleGraphQLException<T> : SpeckleGraphQLException
{
private readonly GraphQLRequest _request;
public GraphQLResponse<T>? Response { get; }

public SpeckleGraphQLException(string message, GraphQLRequest request, GraphQLResponse<T>? response)
: base(message)
{
_request = request;
Response = response;
}
public new GraphQLResponse<T>? Response => (GraphQLResponse<T>?)base.Response;

public SpeckleGraphQLException(string message, Exception inner, GraphQLRequest request, GraphQLResponse<T>? response)
: this(message, inner)
{
_request = request;
Response = response;
}
public SpeckleGraphQLException(
string message,
GraphQLRequest request,
GraphQLResponse<T>? response,
Exception? innerException = null
)
: base(message, request, response, innerException) { }

public SpeckleGraphQLException() { }

public SpeckleGraphQLException(string message)
public SpeckleGraphQLException(string? message)
: base(message) { }

public SpeckleGraphQLException(string message, Exception innerException)
public SpeckleGraphQLException(string? message, Exception? innerException)
: base(message, innerException) { }
}

public class SpeckleGraphQLException : SpeckleException
{
private readonly GraphQLRequest _request;
public IGraphQLResponse? Response { get; }

public IEnumerable<string> ErrorMessages =>
Response?.Errors != null ? Response.Errors.Select(e => e.Message) : Enumerable.Empty<string>();

public IDictionary<string, object>? Extensions => Response?.Extensions;
}

public class SpeckleGraphQLException : SpeckleGraphQLException<object>
{
public SpeckleGraphQLException(string message, GraphQLRequest request, GraphQLResponse<object>? response)
: base(message, request, response) { }
public SpeckleGraphQLException(
string? message,
GraphQLRequest request,
IGraphQLResponse? response,
Exception? innerException = null
)
: base(message, innerException)
{
_request = request;
Response = response;
}

public SpeckleGraphQLException() { }

public SpeckleGraphQLException(string message)
public SpeckleGraphQLException(string? message)
: base(message) { }

public SpeckleGraphQLException(string message, Exception innerException)
public SpeckleGraphQLException(string? message, Exception? innerException)
: base(message, innerException) { }
}

Expand All @@ -61,44 +66,56 @@ public SpeckleGraphQLException(string message, Exception innerException)
/// https://www.apollographql.com/docs/apollo-server/v2/data/errors/#unauthenticated
/// https://www.apollographql.com/docs/apollo-server/v2/data/errors/#forbidden
/// </summary>
public class SpeckleGraphQLForbiddenException<T> : SpeckleGraphQLException<T>
public class SpeckleGraphQLForbiddenException : SpeckleGraphQLException
{
public SpeckleGraphQLForbiddenException(GraphQLRequest request, GraphQLResponse<T> response)
: base("Your request was forbidden", request, response) { }
public SpeckleGraphQLForbiddenException(
GraphQLRequest request,
IGraphQLResponse response,
Exception? innerException = null
)
: base("Your request was forbidden", request, response, innerException) { }

public SpeckleGraphQLForbiddenException() { }

public SpeckleGraphQLForbiddenException(string message)
public SpeckleGraphQLForbiddenException(string? message)
: base(message) { }

public SpeckleGraphQLForbiddenException(string message, Exception innerException)
public SpeckleGraphQLForbiddenException(string? message, Exception? innerException)
: base(message, innerException) { }
}

public class SpeckleGraphQLInternalErrorException<T> : SpeckleGraphQLException<T>
public class SpeckleGraphQLInternalErrorException : SpeckleGraphQLException
{
public SpeckleGraphQLInternalErrorException(GraphQLRequest request, GraphQLResponse<T> response)
: base("Your request failed on the server side", request, response) { }
public SpeckleGraphQLInternalErrorException(
GraphQLRequest request,
IGraphQLResponse response,
Exception? innerException = null
)
: base("Your request failed on the server side", request, response, innerException) { }

public SpeckleGraphQLInternalErrorException() { }

public SpeckleGraphQLInternalErrorException(string message)
public SpeckleGraphQLInternalErrorException(string? message)
: base(message) { }

public SpeckleGraphQLInternalErrorException(string message, Exception innerException)
public SpeckleGraphQLInternalErrorException(string? message, Exception? innerException)
: base(message, innerException) { }
}

public class SpeckleGraphQLStreamNotFoundException<TStreamData> : SpeckleGraphQLException<TStreamData>
public class SpeckleGraphQLStreamNotFoundException : SpeckleGraphQLException
{
public SpeckleGraphQLStreamNotFoundException(GraphQLRequest request, GraphQLResponse<TStreamData> response)
: base("Stream not found", request, response) { }
public SpeckleGraphQLStreamNotFoundException(
GraphQLRequest request,
IGraphQLResponse response,
Exception? innerException = null
)
: base("Stream not found", request, response, innerException) { }

public SpeckleGraphQLStreamNotFoundException() { }

public SpeckleGraphQLStreamNotFoundException(string message)
public SpeckleGraphQLStreamNotFoundException(string? message)
: base(message) { }

public SpeckleGraphQLStreamNotFoundException(string message, Exception innerException)
public SpeckleGraphQLStreamNotFoundException(string? message, Exception? innerException)
: base(message, innerException) { }
}
Loading