From 0c3b9444859cdb50e241f3e19f3d9949959732f7 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Wed, 21 Jan 2026 23:27:03 -0600 Subject: [PATCH] feat: streamline release workflow and remove unnecessary warnings in test files --- .github/workflows/Release.yml | 33 +++++++++++++++++++----------- lib/feeds/gbm/gbm.cs | 2 -- lib/filters/bessel/Bessel.Tests.cs | 1 - lib/filters/ssf/Ssf.Tests.cs | 1 - lib/trends_FIR/pwma/Pwma.Tests.cs | 1 - lib/trends_FIR/sma/Sma.Tests.cs | 1 - lib/trends_IIR/dema/Dema.Tests.cs | 1 - lib/trends_IIR/ema/Ema.Tests.cs | 1 - lib/trends_IIR/rma/Rma.Tests.cs | 1 - 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 2fb1b515..d36ff7b5 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -2,14 +2,6 @@ name: Release Workflow on: workflow_dispatch: - # inputs: - # release_type: - # description: "Release type" - # type: choice - # options: - # - development - # - production - # default: development permissions: {} @@ -90,8 +82,25 @@ jobs: ls -lh lib/bin/Release/*.nupkg || true + - name: Detect release type + id: release_type + run: | + BRANCH="${GITHUB_REF_NAME}" + PRERELEASE_TAG="${{ steps.gitversion.outputs.PreReleaseTag }}" + + echo "Branch: $BRANCH" + echo "PreReleaseTag: $PRERELEASE_TAG" + + if [ "$BRANCH" = "main" ]; then + echo "type=production" >> $GITHUB_OUTPUT + echo "Detected: PRODUCTION release (main branch)" + else + echo "type=development" >> $GITHUB_OUTPUT + echo "Detected: DEVELOPMENT release (branch=$BRANCH)" + fi + - name: Create Development Release - if: inputs.release_type == 'development' + if: steps.release_type.outputs.type == 'development' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -108,7 +117,7 @@ jobs: quantower/bin/Release/**/*.dll - name: Push to MyGet - if: inputs.release_type == 'development' + if: steps.release_type.outputs.type == 'development' continue-on-error: true env: MYGET_API_KEY: ${{ secrets.MYGET_DEPLOY_KEY_QUANTALIB }} @@ -124,7 +133,7 @@ jobs: --api-key "$MYGET_API_KEY" - name: Create Production Release - if: inputs.release_type == 'production' + if: steps.release_type.outputs.type == 'production' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -135,7 +144,7 @@ jobs: quantower/bin/Release/**/*.dll - name: Push to NuGet - if: inputs.release_type == 'production' + if: steps.release_type.outputs.type == 'production' env: NUGET_API_KEY: ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }} run: | diff --git a/lib/feeds/gbm/gbm.cs b/lib/feeds/gbm/gbm.cs index 26ec0a33..94368f33 100644 --- a/lib/feeds/gbm/gbm.cs +++ b/lib/feeds/gbm/gbm.cs @@ -11,7 +11,6 @@ namespace QuanTAlib; /// [SkipLocalsInit] #pragma warning disable S101 // Rename class 'GBM' to match pascal case naming rules -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public sealed class GBM : IFeed #pragma warning restore S101 { @@ -406,4 +405,3 @@ public sealed class GBM : IFeed _lastTime = currentTime - timeStep; // Last bar time, not next bar time } } -#pragma warning restore S2245 diff --git a/lib/filters/bessel/Bessel.Tests.cs b/lib/filters/bessel/Bessel.Tests.cs index fbe55d49..beaca57a 100644 --- a/lib/filters/bessel/Bessel.Tests.cs +++ b/lib/filters/bessel/Bessel.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class BesselTests { [Fact] diff --git a/lib/filters/ssf/Ssf.Tests.cs b/lib/filters/ssf/Ssf.Tests.cs index 6f78738d..c962462c 100644 --- a/lib/filters/ssf/Ssf.Tests.cs +++ b/lib/filters/ssf/Ssf.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class SsfTests { [Fact] diff --git a/lib/trends_FIR/pwma/Pwma.Tests.cs b/lib/trends_FIR/pwma/Pwma.Tests.cs index 346d3e1b..0bddb2d5 100644 --- a/lib/trends_FIR/pwma/Pwma.Tests.cs +++ b/lib/trends_FIR/pwma/Pwma.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class PwmaTests { [Fact] diff --git a/lib/trends_FIR/sma/Sma.Tests.cs b/lib/trends_FIR/sma/Sma.Tests.cs index ea1eaaae..24b7a054 100644 --- a/lib/trends_FIR/sma/Sma.Tests.cs +++ b/lib/trends_FIR/sma/Sma.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class SmaTests { [Fact] diff --git a/lib/trends_IIR/dema/Dema.Tests.cs b/lib/trends_IIR/dema/Dema.Tests.cs index 5d70de04..183b1280 100644 --- a/lib/trends_IIR/dema/Dema.Tests.cs +++ b/lib/trends_IIR/dema/Dema.Tests.cs @@ -1,7 +1,6 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class DemaTests { [Fact] diff --git a/lib/trends_IIR/ema/Ema.Tests.cs b/lib/trends_IIR/ema/Ema.Tests.cs index b281653f..1c9b3c38 100644 --- a/lib/trends_IIR/ema/Ema.Tests.cs +++ b/lib/trends_IIR/ema/Ema.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // GBM provides deterministic random walks for testing; System.Random usage is controlled public class EmaTests { [Fact] diff --git a/lib/trends_IIR/rma/Rma.Tests.cs b/lib/trends_IIR/rma/Rma.Tests.cs index 562c805f..d78d8653 100644 --- a/lib/trends_IIR/rma/Rma.Tests.cs +++ b/lib/trends_IIR/rma/Rma.Tests.cs @@ -1,6 +1,5 @@ namespace QuanTAlib.Tests; -#pragma warning disable S2245 // Random is acceptable for simulation/testing purposes public class RmaTests { [Fact]