From 92e88c9f14c00c258d2ca47eaa02048b9088c562 Mon Sep 17 00:00:00 2001 From: Seamas McGettrick Date: Fri, 1 Sep 2023 00:21:21 -0500 Subject: [PATCH 1/3] Make Float.Tincan.QueuedLRS compatible with .NET 6/7 --- .github/workflows/deploy.yml | 18 ++++++++++--- .github/workflows/test.yml | 21 ++++++++++----- .../Float.TinCan.QueuedLRS.Tests.csproj | 27 +++++++++++++------ .../Float.TinCan.QueuedLRS.csproj | 4 ++- build.cake | 1 - global.json | 6 ----- readme.md | 13 ++++++--- 7 files changed, 59 insertions(+), 31 deletions(-) delete mode 100644 global.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9512bc8..b87e3a2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,31 @@ 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: Build + run: ./build.sh --task=Build --configuration=Release + - name: Update Version + run: sed -i "s/<\/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 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5380759..e9a53af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,6 @@ name: Test on: - push: - branches: [ main ] pull_request: branches: [ main ] @@ -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 diff --git a/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj b/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj index de09e01..79eec8e 100644 --- a/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj +++ b/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj @@ -1,7 +1,8 @@ - net6.0 + netcoreapp3.1;net6.0;net7.0 false + 9.0 @@ -9,16 +10,26 @@ ../stylecop.ruleset - - - - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + diff --git a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj index 2eb0225..6197182 100644 --- a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj +++ b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + netstandard2;net6.0;net7.0 Float.TinCan.QueuedLRS Float Allows xAPI statements to be queued offline and delivered to the LRS later. @@ -11,6 +11,8 @@ $(AssemblyName) false 9.0 + 1.0.0 + diff --git a/build.cake b/build.cake index a313ee9..ad122d5 100644 --- a/build.cake +++ b/build.cake @@ -92,7 +92,6 @@ Task("GitVersion") }); Task("Build") - .IsDependentOn("RestorePackages") .IsDependentOn("GitVersion") .Does(() => { diff --git a/global.json b/global.json deleted file mode 100644 index 676135e..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sdk": { - "version": "6" - } - } - \ No newline at end of file diff --git a/readme.md b/readme.md index f6c1b96..45374ff 100644 --- a/readme.md +++ b/readme.md @@ -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 @@ -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 @@ -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 From 156bdfb64d64d208cd6a8a38f3eae46b85d655ed Mon Sep 17 00:00:00 2001 From: Seamas McGettrick Date: Fri, 1 Sep 2023 00:28:28 -0500 Subject: [PATCH 2/3] Fix build warnings --- Float.TinCan.QueuedLRS.Tests/JSONStateResourceStore.Tests.cs | 2 +- Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs | 2 +- Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Float.TinCan.QueuedLRS.Tests/JSONStateResourceStore.Tests.cs b/Float.TinCan.QueuedLRS.Tests/JSONStateResourceStore.Tests.cs index 05c5e95..83bc0af 100644 --- a/Float.TinCan.QueuedLRS.Tests/JSONStateResourceStore.Tests.cs +++ b/Float.TinCan.QueuedLRS.Tests/JSONStateResourceStore.Tests.cs @@ -10,7 +10,7 @@ namespace Float.TinCan.QueuedLRS.Tests { - public class JSONStateResourceStoreTests : IDisposable + public sealed class JSONStateResourceStoreTests : IDisposable { readonly JSONStateResourceStore store; readonly string storeFile; diff --git a/Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs b/Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs index 75a664b..759b5ae 100644 --- a/Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs +++ b/Float.TinCan.QueuedLRS.Tests/JSONStatementStore.Tests.cs @@ -9,7 +9,7 @@ namespace Float.TinCan.QueuedLRS.Tests { - public class JSONStatementStoreTests : IDisposable + public sealed class JSONStatementStoreTests : IDisposable { readonly JSONStatementStore store; readonly string storeFile; diff --git a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj index 6197182..a8e7e1f 100644 --- a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj +++ b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj @@ -38,7 +38,7 @@ - + From a402487ced68e0756da3e1c183010ac2f77b7224 Mon Sep 17 00:00:00 2001 From: Seamas McGettrick Date: Thu, 14 Sep 2023 22:45:16 -0500 Subject: [PATCH 3/3] Update Float.TinCan to 1.0.3.30 --- .github/workflows/deploy.yml | 8 +++++--- .../Float.TinCan.QueuedLRS.Tests.csproj | 2 +- Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b87e3a2..6b277d9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -19,8 +19,10 @@ jobs: 3.1.x 6.0.x 7.0.x - - name: Build - run: ./build.sh --task=Build --configuration=Release + - 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>/${{ github.event.release.name }}<\/Version>/" ./Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj - name: Pack and Upload @@ -28,4 +30,4 @@ jobs: - name: Deploy to NuGet env: FLOAT_NUGET_TOKEN: ${{ secrets.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 \ No newline at end of file + 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 diff --git a/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj b/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj index 79eec8e..e9583e7 100644 --- a/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj +++ b/Float.TinCan.QueuedLRS.Tests/Float.TinCan.QueuedLRS.Tests.csproj @@ -30,7 +30,7 @@ - + diff --git a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj index a8e7e1f..7df768a 100644 --- a/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj +++ b/Float.TinCan.QueuedLRS/Float.TinCan.QueuedLRS.csproj @@ -31,7 +31,7 @@ readme.md - + runtime; build; native; contentfiles; analyzers; buildtransitive all