From db1128d8df7b688c16207c333557ca2aa18f071e Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sat, 4 Jan 2025 00:43:21 -0500
Subject: [PATCH 1/6] chore: Simplify PR lint trigger (#1309)
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
---
.github/workflows/lint-pull-request.yml | 63 +++++++++++++++----------
1 file changed, 37 insertions(+), 26 deletions(-)
diff --git a/.github/workflows/lint-pull-request.yml b/.github/workflows/lint-pull-request.yml
index 48eb9a37c..4e9507808 100644
--- a/.github/workflows/lint-pull-request.yml
+++ b/.github/workflows/lint-pull-request.yml
@@ -1,11 +1,11 @@
name: Pull request
on:
- pull_request_target:
+ pull_request:
types:
- opened
- edited
- - synchronize
+ - unlabeled
permissions:
pull-requests: write
@@ -21,49 +21,60 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
-
- # Configure additional validation for the subject based on a regex.
- # We enforce that the subject starts with an uppercase character.
subjectPattern: ^([A-Z]).+$
-
- # If `subjectPattern` is configured, you can use this property to override
- # the default error message that is shown when the pattern doesn't match.
- # The variables `subject` and `title` can be used within the message.
subjectPatternError: >
- The subject "**{subject}**" in pull request "*{title}*"
- needs to start with an uppercase character.
-
- # If the PR contains one of these newline-delimited labels, the
- # validation is skipped. If you want to rerun the validation when
- # labels change, you might want to use the `labeled` and `unlabeled`
- # event triggers in your workflow.
+ The subject "**{subject}**" must start with an uppercase character.
+ Example: "Add feature" instead of "add feature"
ignoreLabels: |
bot
dependencies
- uses: marocchino/sticky-pull-request-comment@v2
- # When the previous steps fails, the workflow would stop. By adding this
- # condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
- ### ⚠️ Pull Request title needs adjustment
+ ### ⚠️ Invalid Pull Request title
- Your PR title doesn't match our naming convention: `type: Subject`
+ Your PR title must follow the format: `type: Subject` where:
+ - `type` is one of the conventional commit types (in lowercase)
+ - `Subject` starts with an uppercase letter
> [!CAUTION]
> ${{ steps.lint_pr_title.outputs.error_message }}
#### Valid examples
- - `feat: Add new RSI indicator`
- - `fix: Correct MACD calculation`
- - `chore: Update documentation`
- - `test: Add unit tests for EMA`
- - `refactor: Optimize moving average logic`
+ - `feat: Add API endpoint for market data`
+ - `fix: Resolve WebSocket connection issues`
+ - `chore: Update NuGet dependencies`
+
+
+ see more valid examples
+
+ #### Features & fixes
+ - `feat: Add API endpoint for market data`
+ - `fix: Resolve WebSocket connection issues`
+
+ #### Code quality
+ - `style: Format trading strategy classes`
+ - `refactor: Restructure trading engine components`
+ - `perf: Optimize trade order execution flow`
+
+ #### Documentation & testing
+ - `docs: Update API documentation`
+ - `test: Add unit tests for sign-in flow`
+
+ #### Infrastructure
+ - `build: Update .NET SDK version to 8.0`
+ - `ci: Add workflow for performance testing`
+ - `chore: Update NuGet dependencies`
+
+ #### Other
+ - `revert: Remove faulty market data provider`
- See the [Conventional Commits specification](https://www.conventionalcommits.org) for more information.
+ See [Conventional Commits](https://www.conventionalcommits.org) for more details.
+
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
From afb43005857e407d6ea7b6a734d5310e05488dad Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sun, 5 Jan 2025 16:11:27 -0500
Subject: [PATCH 2/6] chore: Use `auto/lf` line endings (#1313)
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
---
.gitattributes | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitattributes b/.gitattributes
index 462913965..9a5d6f371 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
# Normalize line endings.
-* text=lf
+* text=auto eol=lf
From 49d6ddddd98f7f9cadf3af5027bdd22cdfb46f6b Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sun, 5 Jan 2025 17:38:45 -0500
Subject: [PATCH 3/6] revert: Restore .NET Standard 2.0 (#1312)
We'd prematurely removed .NET Standard 2.0
We do plan on removing it for version 3 since it will limit use of newer SDK features with better overall performance.
---
.github/workflows/test-indicators.yml | 32 +++++++++-------------
.gitignore | 11 +++++---
docs/pages/home.md | 2 +-
src/Indicators.csproj | 2 +-
tests/indicators/_Initialize.cs | 39 +++++++++++++++++++++++++++
5 files changed, 60 insertions(+), 26 deletions(-)
diff --git a/.github/workflows/test-indicators.yml b/.github/workflows/test-indicators.yml
index 65b447340..c44e5832c 100644
--- a/.github/workflows/test-indicators.yml
+++ b/.github/workflows/test-indicators.yml
@@ -1,11 +1,11 @@
-name: Indicators
+name: Test Indicators
on:
push:
branches: ["main"]
-
pull_request:
branches: ["*"]
+ workflow_dispatch:
jobs:
test:
@@ -20,18 +20,17 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
- dotnet-version: ["9.x"]
- # TODO: restore when runners have 9.x on all
- # ["2.1.x", "6.x", "9.x"]
+ dotnet-version: ["6.0.x", "9.0.x"]
env:
# identifying primary configuration so only one reports coverage
- IS_PRIMARY: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '9.x' }}
+ IS_PRIMARY: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '9.0.x' }}
- # .NET SDK versions in the matrix that support `ga` quality spec
- # versions before 5.x do not support it
- SUPPORT_GA: ${{ contains(fromJson('["6.x", "9.x"]'), matrix.dotnet-version) }}
+ # Identifies the current target framework
+ TARGET_FRAMEWORK: >
+ ${{ matrix.dotnet-version == '6.0.x' && 'net6.0' ||
+ matrix.dotnet-version == '9.0.x' && 'net9.0' }}
steps:
@@ -39,19 +38,11 @@ jobs:
uses: actions/checkout@v4
- name: Setup .NET
- id: dotnet-new
uses: actions/setup-dotnet@v4
- if: env.SUPPORT_GA == 'true'
with:
- dotnet-version: ${{ matrix.dotnet-version }}
+ dotnet-version: "9.x"
dotnet-quality: "ga"
- - name: Setup .NET (older)
- uses: actions/setup-dotnet@v4
- if: env.SUPPORT_GA == 'false'
- with:
- dotnet-version: ${{ matrix.dotnet-version }}
-
- name: Build library
run: >
dotnet build
@@ -66,6 +57,7 @@ jobs:
run: >
dotnet test tests/indicators/Tests.Indicators.csproj
--configuration Release
+ --property:TestFramework="${{ env.TARGET_FRAMEWORK }}"
--no-build
--verbosity normal
--logger trx
@@ -84,8 +76,8 @@ jobs:
--logger trx
--results-directory ./test-other
- - name: Post test summary
- uses: dorny/test-reporter@v1
+ - name: Post test results
+ uses: dorny/test-reporter@v1.9.1
if: env.IS_PRIMARY == 'true' && always()
with:
name: Test results
diff --git a/.gitignore b/.gitignore
index 7a97cd5dc..b06c8feb4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -133,6 +133,9 @@ _TeamCity*
*.coverage
*.coveragexml
+# Visual Studio live unit testing
+*.lutconfig
+
# NCrunch
_NCrunch_*
.*crunch*.local.xml
@@ -218,7 +221,7 @@ ClientBin/
*.publishsettings
orleans.codegen.cs
-# Including strong name files can present a security risk
+# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
@@ -314,7 +317,7 @@ __pycache__/
# OpenCover UI analysis results
OpenCover/
-# Azure Stream Analytics local run output
+# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
@@ -323,11 +326,11 @@ ASALocalRun/
# NVidia Nsight GPU debugger configuration file
*.nvuser
-# MFractors (Xamarin productivity tool) working folder
+# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Jekyll site
_site/
# zip artifacts
-.DS_Store
\ No newline at end of file
+.DS_Store
diff --git a/docs/pages/home.md b/docs/pages/home.md
index 7915db21e..ce548079c 100644
--- a/docs/pages/home.md
+++ b/docs/pages/home.md
@@ -70,7 +70,7 @@ See the [guide]({{site.baseurl}}/guide/#content) and the [full list of indicator
Our [NuGet library](https://www.nuget.org/packages/Skender.Stock.Indicators) directly targets all current frameworks for peak performance, including the .NET Standard for older framework compatibility.
- .NET 9.0, 8.0, 6.0
-- .NET Standard 2.1
+- .NET Standard 2.1, 2.0
The compiled library package is [Common Language Specification (CLS) compliant](https://docs.microsoft.com/en-us/dotnet/standard/common-type-system) and can be used in other programming languages, including Python and everything in the .NET universe.
diff --git a/src/Indicators.csproj b/src/Indicators.csproj
index 98ef2f687..5ae3ef76b 100644
--- a/src/Indicators.csproj
+++ b/src/Indicators.csproj
@@ -1,7 +1,7 @@
- net9.0;net8.0;net6.0;netstandard2.1
+ net9.0;net8.0;net6.0;netstandard2.1;netstandard2.0
Dave Skender
Stock Indicators for .NET
diff --git a/tests/indicators/_Initialize.cs b/tests/indicators/_Initialize.cs
index 3b09c9e0f..bdbe00b75 100644
--- a/tests/indicators/_Initialize.cs
+++ b/tests/indicators/_Initialize.cs
@@ -1,5 +1,7 @@
using System.Globalization;
+using System.Reflection;
using System.Runtime.CompilerServices;
+using System.Runtime.Versioning;
// GLOBALS & INITIALIZATION OF TEST DATA
@@ -8,6 +10,9 @@
[assembly: InternalsVisibleTo("Tests.Performance")]
namespace Tests.Common;
+///
+/// Base class for all test classes, providing common test data and utilities.
+///
[TestClass]
public abstract class TestBase
{
@@ -27,3 +32,37 @@ public abstract class TestBase
internal static readonly IEnumerable zeroesQuotes = TestData.GetZeros();
internal static readonly IEnumerable<(DateTime, double)> tupleNanny = TestData.GetTupleNaN();
}
+
+///
+/// Test class for the startup of the test project.
+///
+[TestClass]
+public class Startup
+{
+ ///
+ /// Displays the assembly location, name, version, and target framework
+ /// as a sanity check for test runner targeting.
+ ///
+ [TestMethod]
+ [TestCategory("ShowMe")]
+ public void ShowFramework()
+ {
+ // Get the assembly of any type from your Indicators project
+ Assembly assembly = typeof(Indicator).Assembly;
+
+ Console.WriteLine($"Assembly Location: {assembly.Location}");
+ Console.WriteLine($"Assembly Name: {assembly.GetName().Name}");
+ Console.WriteLine($"Assembly Version: {assembly.GetName().Version}");
+
+ // Get the target framework the assembly was built for
+ TargetFrameworkAttribute targetFrameworkAttribute = assembly
+ .GetCustomAttribute();
+
+ string frameworkName
+ = targetFrameworkAttribute?.FrameworkName ?? "Unknown";
+
+ Console.WriteLine($"Target Framework: {frameworkName}");
+
+ frameworkName.Should().NotBe("Unknown");
+ }
+}
From 7029415d56e33827850d1e383122c771ec7f6ac0 Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sun, 5 Jan 2025 18:33:21 -0500
Subject: [PATCH 4/6] fix: Add language version (#1315)
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
---
src/Indicators.csproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Indicators.csproj b/src/Indicators.csproj
index 5ae3ef76b..12e488c58 100644
--- a/src/Indicators.csproj
+++ b/src/Indicators.csproj
@@ -2,6 +2,7 @@
net9.0;net8.0;net6.0;netstandard2.1;netstandard2.0
+ 13.0
Dave Skender
Stock Indicators for .NET
From 27ce78b7531b53d1828a4600f2bd8ef2674d6b6e Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sun, 5 Jan 2025 19:06:53 -0500
Subject: [PATCH 5/6] ci: Remove unneeded NuGet setup (#1316)
---
.github/workflows/deploy-package.yml | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/deploy-package.yml b/.github/workflows/deploy-package.yml
index 31435929f..0a754c26d 100644
--- a/.github/workflows/deploy-package.yml
+++ b/.github/workflows/deploy-package.yml
@@ -52,7 +52,7 @@ jobs:
with:
versionSpec: "5.x"
preferLatestVersion: true
-
+
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
@@ -89,7 +89,7 @@ jobs:
if [[ "${{ inputs.environment }}" == "nuget.org" ]]; then
echo "pkg_url=https://www.nuget.org/packages/${PACKAGE_NAME}/${{ steps.version_info.outputs.version }}" >> $GITHUB_OUTPUT
else
- echo "pkg_url=https://github.com/${{ github.repository }}/packages/nuget/${PACKAGE_NAME}/${{ steps.version_info.outputs.version }}" >> $GITHUB_OUTPUT
+ echo "pkg_url=https://github.com/${{ github.repository }}/pkgs/nuget/${PACKAGE_NAME}" >> $GITHUB_OUTPUT
fi
- name: Build library
@@ -149,13 +149,6 @@ jobs:
dotnet-version: "9.x"
dotnet-quality: "ga"
- - name: Setup NuGet
- uses: nuget/setup-nuget@v2
- with:
- nuget-api-key: ${{ secrets.NUGET_TOKEN }}
- nuget-version: '6.x'
-
-
- name: Download package
uses: actions/download-artifact@v4
with:
From d3593f59563d9cb43407dd5cda87ec559d84bac2 Mon Sep 17 00:00:00 2001
From: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Date: Sun, 5 Jan 2025 19:44:55 -0500
Subject: [PATCH 6/6] ci: Remove custom CodeQL (#1317)
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
---
.github/workflows/test-codeql.yml | 52 -------------------------------
1 file changed, 52 deletions(-)
delete mode 100644 .github/workflows/test-codeql.yml
diff --git a/.github/workflows/test-codeql.yml b/.github/workflows/test-codeql.yml
deleted file mode 100644
index 9a585cb6e..000000000
--- a/.github/workflows/test-codeql.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: CodeQL
-
-on:
- push:
- branches: ["main"]
-
- pull_request:
- branches: ["*"]
-
- schedule:
- - cron: '37 14 * * 3'
-
-jobs:
-
- analyze:
- name: analyze
- runs-on: 'ubuntu-latest'
-
- permissions:
- security-events: write
- packages: read
- actions: read
- contents: read
-
- steps:
-
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v3
- with:
- languages: csharp
- build-mode: manual
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 9.x
- dotnet-quality: "ga"
-
- - name: Build library
- run: >
- dotnet build
- --configuration Release
- --property:ContinuousIntegrationBuild=true
- -warnAsError
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v3
- with:
- category: "/language:csharp"