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

Make Float.Tincan.QueuedLRS compatible with .NET 6/7 #32

Merged
merged 3 commits into from
Sep 15, 2023
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
20 changes: 16 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
name: Deploy

on:
workflow_dispatch:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: |
3.1.x
6.0.x
7.0.x
- name: Set Assembly Version
run: ./build.sh --task=GitVersion --configuration=Release
- name: Build Library
run: dotnet build --configuration Release --no-restore
- name: Update Version
run: sed -i "s/<Version><\/Version>/<Version>${{ github.event.release.name }}<\/Version>/" ./Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj
- name: Pack and Upload
run: dotnet pack --configuration Release --no-restore
- name: Deploy to NuGet
env:
FLOAT_NUGET_TOKEN: ${{ secrets.FLOAT_NUGET_TOKEN }}
run: ./build.sh --task=Deploy --configuration=Release --nugetUrl="https://api.nuget.org/v3/index.json" --nugetToken="${FLOAT_NUGET_TOKEN}"
run: dotnet nuget push ./Float.TinCan.QueuedLRS/bin/Release/Float.TinCan.QueuedLRS.${{ github.event.release.name }}.nupkg --api-key "${FLOAT_NUGET_TOKEN}" --source https://api.nuget.org/v3/index.json
21 changes: 14 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -12,14 +10,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: |
3.1.x
6.0.x
7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --no-build --blame-hang-timeout 10s
run: dotnet test --configuration Release --no-build --verbosity normal --logger:"trx;"
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
**/TestResults/*.trx
29 changes: 20 additions & 9 deletions Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="../stylecop.json" />
</ItemGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>../stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="NunitXml.TestLogger" Version="3.0.117" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Float.TinCan" Version="1.0.3.29" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="coverlet.msbuild" Version="3.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NunitXml.TestLogger" Version="3.0.117" />
<PackageReference Include="Float.TinCan" Version="1.0.3.30" />
<PackageReference Include="Moq" Version="4.18.2" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Float.TinCan.QueuedLRS.Tests
{
public class JSONStateResourceStoreTests : IDisposable
public sealed class JSONStateResourceStoreTests : IDisposable
{
readonly JSONStateResourceStore store;
readonly string storeFile;
Expand Down
2 changes: 1 addition & 1 deletion Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Float.TinCan.QueuedLRS.Tests
{
public class JSONStatementStoreTests : IDisposable
public sealed class JSONStatementStoreTests : IDisposable
{
readonly JSONStatementStore store;
readonly string storeFile;
Expand Down
8 changes: 5 additions & 3 deletions Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2;net6.0;net7.0</TargetFrameworks>
<AssemblyName>Float.TinCan.QueuedLRS</AssemblyName>
<AssemblyAuthor>Float</AssemblyAuthor>
<AssemblyDescription>Allows xAPI statements to be queued offline and delivered to the LRS later.</AssemblyDescription>
Expand All @@ -11,6 +11,8 @@
<Title>$(AssemblyName)</Title>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>9.0</LangVersion>
<ReleaseVersion>1.0.0</ReleaseVersion>
<Version></Version>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\stylecop.json" />
Expand All @@ -29,14 +31,14 @@
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Float.TinCan" Version="1.0.3.29" />
<PackageReference Include="Float.TinCan" Version="1.0.3.30" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="../readme.md" Pack="true" PackagePath="\"/>
<None Include="../readme.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
1 change: 0 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Task("GitVersion")
});

Task("Build")
.IsDependentOn("RestorePackages")
.IsDependentOn("GitVersion")
.Does(() =>
{
Expand Down
6 changes: 0 additions & 6 deletions global.json

This file was deleted.

13 changes: 9 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

The `QueuedLRS` is an LRS queue for holding or batching statements before passing onto another `ILRS` implementation (e.g. `RemoteLRS`). Statements are queued locally until the target LRS confirms successful receipt of the statements. Any queued statements are also written to disk so that the queue can persist across sessions.

The queue will store statements indefinitely until the queue has been flushed. At that point, a batch of statements will be forwarded to the target LRS. If the statements were successfully received, then those statements are removed from the local queue. If an error occurs, those statements will be kept in the queue and sent again later.
The queue will store statements indefinitely until the queue has been flushed. At that point, a batch of statements will be forwarded to the target LRS. If the statements were successfully received, then those statements are removed from the local queue. If an error occurs, those statements will be kept in the queue and sent again later.

`QueuedLRS` is a great option for a mobile application looking to store statements offline and send to an LRS when an internet connection is available.

## Building

First you must restore the nuget libraries

dotnet restore

This project can be built using [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/) or [Cake](https://cakebuild.net/). It is recommended that you build this project by invoking the bootstrap script:

./build.sh
Expand All @@ -24,6 +28,7 @@ There are a number of optional arguments that can be provided to the bootstrappe
## Installing

### NuGet

This library is available as a NuGet via nuget.org.

## Usage
Expand Down Expand Up @@ -58,9 +63,9 @@ Additionally, the queue is automatically flushed when querying statements from t

The queue is automatically flushed when any of the defined triggers (`IQueueFlushTrigger`) is fired. Applications can define their own triggers, but three triggers are included by default:

* **PeriodicTrigger** — sends statements to the LRS periodically (e.g. every 1 minute)
* **CompletedStatementTrigger** — sends statements to the LRS when a statement is stored that has the `completed` verb
* **InternetConnectionTrigger** — sends statements to the LRS when an network connection becomes available after previously being unavailable
- **PeriodicTrigger** — sends statements to the LRS periodically (e.g. every 1 minute)
- **CompletedStatementTrigger** — sends statements to the LRS when a statement is stored that has the `completed` verb
- **InternetConnectionTrigger** — sends statements to the LRS when an network connection becomes available after previously being unavailable

### Statement Validation

Expand Down