Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ env:

jobs:
build:
name: Build-windows-latest
runs-on: windows-latest
name: Build-${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: "Checkout"
uses: actions/checkout@v4
Expand All @@ -47,9 +50,39 @@ jobs:
- name: "Publish Artefacts"
uses: actions/upload-artifact@v4.6.2
with:
name: windows-latest
name: ${{matrix.os}}
path: "./Artefacts"

coverage:
name: "Generate Code Coverage Report"
needs: build
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Download Artefact"
uses: actions/download-artifact@v4.3.0
with:
name: "windows-latest"
path: "Artefacts"
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: Artefacts/**/coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '10 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
push-github-packages:
name: "Push GitHub Packages"
needs: build
Expand Down Expand Up @@ -78,7 +111,7 @@ jobs:
if: github.event_name == 'release'
environment:
name: "NuGet"
url: https://www.nuget.org/packages/Licensing
url: https://www.nuget.org/packages/VerdantApp.Licensing
runs-on: windows-latest
steps:
- name: "Download Artefact"
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Bond.CSharp" Version="13.0.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Grpc.Tools" Version="2.72.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.6.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
Expand All @@ -14,7 +14,7 @@
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="TIKSN-Framework" Version="5.4.4" />
<PackageVersion Include="TIKSN-Framework" Version="5.5.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
</ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# VerdantApp Licensing

[![Licensing NuGet Package](https://img.shields.io/nuget/v/VerdantApp.Licensing.svg)](https://www.nuget.org/packages/VerdantApp.Licensing/) [![Licensing NuGet Package Downloads](https://img.shields.io/nuget/dt/VerdantApp.Licensing)](https://www.nuget.org/packages/VerdantApp.Licensing) [![GitHub Actions Status](https://github.com/VerdantApp/Licensing/workflows/Build/badge.svg?branch=main)](https://github.com/VerdantApp/Licensing/actions)

[![GitHub Actions Build History](https://buildstats.info/github/chart/VerdantApp/Licensing?branch=main&includeBuildsFromPullRequest=false)](https://github.com/VerdantApp/Licensing/actions)

[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
9 changes: 8 additions & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bond.CSharp" />
<PackageReference Include="Grpc.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="TIKSN-Framework" />
</ItemGroup>

<ItemGroup>
<Protobuf Include="schema.proto" GrpcServices="None" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Source/Licensing/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[assembly: CLSCompliant(true)]
[assembly: CLSCompliant(false)]
1 change: 0 additions & 1 deletion Source/Licensing/SystemEntitlements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace VerdantApp.Licensing;
/// <param name="SystemId">System ID.</param>
/// <param name="EnvironmentName">Deployment environment name.</param>
/// <param name="Countries">Supported Countries.</param>
[CLSCompliant(false)]
public record SystemEntitlements(
Ulid SystemId,
EnvironmentName EnvironmentName,
Expand Down
10 changes: 4 additions & 6 deletions Source/Licensing/SystemEntitlementsConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace VerdantApp.Licensing;

using System.Globalization;
using Google.Protobuf;
using LanguageExt;
using LanguageExt.Common;
using TIKSN.Deployment;
Expand All @@ -22,7 +23,6 @@ public class SystemEntitlementsConverter : IEntitlementsConverter<SystemEntitlem
/// Initializes a new instance of the <see cref="SystemEntitlementsConverter"/> class.
/// </summary>
/// <param name="regionFactory"><see cref="RegionInfo"/> Factory.</param>
[CLSCompliant(false)]
public SystemEntitlementsConverter(
IRegionFactory regionFactory)
=> this.regionFactory = regionFactory ?? throw new ArgumentNullException(nameof(regionFactory));
Expand All @@ -32,7 +32,6 @@ public SystemEntitlementsConverter(
/// </summary>
/// <param name="entitlements">Domain Model.</param>
/// <returns>Validation of Data Model.</returns>
[CLSCompliant(false)]
public Validation<Error, SystemLicenseEntitlements> Convert(
SystemEntitlements entitlements)
{
Expand All @@ -50,7 +49,7 @@ public Validation<Error, SystemLicenseEntitlements> Convert(
errors.Add(Error.New(1366359375, "Invalid System ID"));
}

result.SystemId = new ArraySegment<byte>(entitlements.SystemId.ToByteArray());
result.SystemId = ByteString.CopyFrom(entitlements.SystemId.ToByteArray());

if (string.IsNullOrWhiteSpace(entitlements.EnvironmentName.ToString()))
{
Expand All @@ -69,7 +68,7 @@ public Validation<Error, SystemLicenseEntitlements> Convert(
{
entitlements.Countries.ForEach(x => this.ValidateCountryCode(x, errors.Add));

result.CountryCodes = [.. entitlements.Countries.Select(x => x.TwoLetterISORegionName)];
result.CountryCodes.AddRange(entitlements.Countries.Select(x => x.TwoLetterISORegionName));
}

if (errors.Count > 0)
Expand All @@ -85,7 +84,6 @@ public Validation<Error, SystemLicenseEntitlements> Convert(
/// </summary>
/// <param name="entitlementsData">Data Model.</param>
/// <returns>Validation of Domain Model.</returns>
[CLSCompliant(false)]
public Validation<Error, SystemEntitlements> Convert(
SystemLicenseEntitlements entitlementsData)
{
Expand All @@ -98,7 +96,7 @@ public Validation<Error, SystemEntitlements> Convert(
return errors.ToSeq();
}

var systemId = new Ulid(entitlementsData.SystemId);
var systemId = new Ulid(entitlementsData.SystemId.ToByteArray());

if (InvalidSystemIds.Contains(systemId))
{
Expand Down
9 changes: 0 additions & 9 deletions Source/Licensing/schema.bond

This file was deleted.

9 changes: 9 additions & 0 deletions Source/Licensing/schema.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

option csharp_namespace = "VerdantApp.Licensing";

message SystemLicenseEntitlements {
bytes SystemId = 1;
string EnvironmentName = 2;
repeated string CountryCodes = 3;
}
Loading