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

Codeflow to Main #65

Merged
merged 16 commits into from
Oct 19, 2024
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
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests
on:
push:
branches: [ "main", release-*, develop ]
pull_request:
branches: [ "main", release-*, develop ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of commits
submodules: 'true'

- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Run FishyFlip.Tests
run: dotnet test src/FishyFlip.Tests/FishyFlip.Tests.csproj -- --report-trx --results-directory ../../dotnet-test-results

- name: Run WhiteWindLib.Tests
run: dotnet test src/WhiteWindLib.Tests/WhiteWindLib.Tests.csproj -- --report-trx --results-directory ../../dotnet-test-results

- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: dotnet-test-results
path: dotnet-test-results
if: ${{ always() }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

dotnet-test-results/
whitewindlib.runsettings
fishyflip.runsettings
external/Drastic.FlipperKit/build/
Expand Down
7 changes: 5 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Memory.Data" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="Drastic.Utilities" Version="1.0.10" />
<PackageVersion Include="PublishSPAforGitHubPages.Build" Version="2.1.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="MSTest" Version="3.3.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.12.4" />
<PackageVersion Include="GitVersion.MSBuild" Version="6.0.2" />
<PackageVersion Include="IdentityModel" Version="7.0.0" />
<PackageVersion Include="ConsoleAppFramework" Version="5.2.3" />
<PackageVersion Include="ConsoleAppFramework" Version="5.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
</ItemGroup>
<ItemGroup Condition="$(UseMaui) == true">
<PackageVersion Include="Microsoft.Maui.Controls" Version="8.0.21" />
Expand Down
18 changes: 18 additions & 0 deletions samples/Jetstream/Jetstream.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\FishyFlip\FishyFlip.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions samples/Jetstream/Jetstream.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishyFlip", "..\..\src\FishyFlip\FishyFlip.csproj", "{48260865-FB6C-4F37-B80B-4CF1F8B52E66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jetstream", "Jetstream.csproj", "{D80F3939-6001-4EFE-B574-26771F9B7523}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Release|Any CPU.Build.0 = Release|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions samples/Jetstream/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// <copyright file="Program.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using FishyFlip;
using Microsoft.Extensions.Logging.Debug;

Console.WriteLine("Hello, Jetstream!");

var debugLog = new DebugLoggerProvider();

// You can set a custom url with WithInstanceUrl
var jetstreamBuilder = new ATJetStreamBuilder()
.WithLogger(debugLog.CreateLogger("FishyFlipDebug"));
var atWebProtocol = jetstreamBuilder.Build();

atWebProtocol.OnConnectionUpdated += (sender, args) =>
{
Console.WriteLine($"Connection Updated: {args.State}");
};

atWebProtocol.OnRecordReceived += (sender, args) =>
{
Console.WriteLine($"Record Received: {args.Record.Type}");
};

await atWebProtocol.ConnectAsync();

var key = Console.ReadKey();

await atWebProtocol.CloseAsync();
23 changes: 23 additions & 0 deletions samples/PasswordAuth/PasswordAuth.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConsoleAppFramework">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\FishyFlip\FishyFlip.csproj" />
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions samples/PasswordAuth/PasswordAuth.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PasswordAuth", "PasswordAuth.csproj", "{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishyFlip", "..\..\src\FishyFlip\FishyFlip.csproj", "{7E7D4B52-3C34-430A-AA04-E3E77852F052}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Release|Any CPU.Build.0 = Release|Any CPU
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
43 changes: 43 additions & 0 deletions samples/PasswordAuth/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using ConsoleAppFramework;
using FishyFlip;
using Microsoft.Extensions.Logging.Debug;

var app = ConsoleApp.Create();
app.Add<AppCommands>();
app.Run(args);

/// <summary>
/// App Commands.
/// </summary>
#pragma warning disable SA1649 // File name should match first type name
public class AppCommands
#pragma warning restore SA1649 // File name should match first type name
{
/// <summary>
/// Authenticate with the ATProtocol using a password.
/// </summary>
/// <param name="identifier">The user's identifier.</param>
/// <param name="password">The user's password.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>Task.</returns>
[Command("authenticate")]
public async Task AuthenticateAsync([Argument] string identifier, [Argument] string password, CancellationToken cancellationToken = default)
{
var protocol = new ATProtocolBuilder()
.WithLogger(new DebugLoggerProvider().CreateLogger("FishyFlip"))
.Build();

var session = await protocol.AuthenticateWithPasswordAsync(identifier, password, cancellationToken);
if (session is null)
{
Console.WriteLine("Failed to authenticate.");
return;
}

Console.WriteLine("Authenticated.");
Console.WriteLine($"Session Did: {session.Did}");
Console.WriteLine($"Session Email: {session.Email}");
Console.WriteLine($"Session Handle: {session.Handle}");
Console.WriteLine($"Session Token: {session.AccessJwt}");
}
}
Loading