Extracted the ZIP artifact and in that folder ran:
dotnet nuget push "*.nupkg" -s ~/dev/nuget # choose whatever folder you want to use as a local NuGet source
Added NuGet locals and cleared their cache:
dotnet nuget add source ~/dev/nuget # same folder as before
Created a new dotnet project to test our engine:
dotnet new console -n dotnet-test
Installed our package in the test project:
dotnet nuget locals all --clear # just to ensure we don't use stale data
dotnet add package Yggdrasil.Engine --prerelease
Ran test project:
using System.Text.Json;
using Yggdrasil;
class Program
{
static void Main(string[] args)
{
JsonSerializerOptions options = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
var testDataObject = new
{
Version = 2,
Features = new[] {
new {
Name = "test.flag",
Type = "release",
Enabled = true,
ImpressionData = true,
Strategies = new [] {
new {
Name = "default",
Parameters = new Dictionary<string, string>()
}
}
}
}
};
var testData = JsonSerializer.Serialize(testDataObject, options);
var engine = new YggdrasilEngine();
engine.TakeState(testData);
var featureName = "test.flag";
var result = engine.IsEnabled(featureName, new Context());
Console.WriteLine(result);
}
}
https://linear.app/unleash/issue/2-1629/yggdrasilnet-package-and-publish
Adds a workflow to publish the dotnet engine.
Note: Not uploading to NuGet yet, since we need to set up a token for that.Now publishing to NuGet: https://www.nuget.org/packages/Unleash.YggdrasilCurrent package size is at:
Which includes:
Weirdly,
aarch64-unknown-linux-gnu
was the most problematic to get right.Manual test
Edit: Now that we have the package available in NuGet you can simply:
But if you're curious, here's how I manually tested this on my M1 Mac before the NuGet deployment:
Downloaded NuGet package artifact from the action: https://github.com/Unleash/yggdrasil/actions/runs/9615428370/job/26522725796?pr=128#step:9:21
Extracted the ZIP artifact and in that folder ran: