diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml index c06bcf13..db01dc50 100644 --- a/.github/codeql/codeql-config.yml +++ b/.github/codeql/codeql-config.yml @@ -19,4 +19,4 @@ query-filters: - recommendation paths: - - src \ No newline at end of file + - lib diff --git a/.github/scanner.cmd b/.github/scanner.cmd index cf98f04d..c58241c7 100644 --- a/.github/scanner.cmd +++ b/.github/scanner.cmd @@ -14,18 +14,8 @@ REM Also clean TestResults and .sonarqube powershell -NoProfile -Command "Remove-Item -Path '%~dp0..\TestResults' -Recurse -Force -ErrorAction SilentlyContinue" powershell -NoProfile -Command "Remove-Item -Path '%~dp0..\.sonarqube' -Recurse -Force -ErrorAction SilentlyContinue" -REM Convert script path to WSL format -set "SCRIPT_PATH=%~dp0scanner.sh" -set "SCRIPT_PATH=%SCRIPT_PATH:\=/%" -REM Convert any drive letter (C:, D:, Z:, etc.) to /mnt/x format -for /f "tokens=1 delims=:" %%d in ("%SCRIPT_PATH%") do ( - set "DRIVE_LETTER=%%d" -) -call set "SCRIPT_PATH=%%SCRIPT_PATH:%DRIVE_LETTER%:=/mnt/%DRIVE_LETTER%%%" -REM Convert drive letter to lowercase -for %%l in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( - call set "SCRIPT_PATH=%%SCRIPT_PATH:/mnt/%%l=/mnt/%%l%%" -) +REM Convert script path to WSL format using PowerShell for reliable drive letter conversion +for /f "usebackq delims=" %%P in (`powershell -NoProfile -Command "$p='%~dp0scanner.sh'; $d=$p.Substring(0,1).ToLower(); '/mnt/' + $d + $p.Substring(2).Replace('\','/')"` ) do set "SCRIPT_PATH=%%P" REM Run scanner with tokens passed via environment (as root for tool access) wsl -d Debian -u root -- env SONAR_TOKEN="%SONAR_TOKEN%" CODACY_PROJECT_TOKEN="%CODACY_PROJECT_TOKEN%" QODANA_TOKEN="%QODANA_TOKEN%" bash "%SCRIPT_PATH%" %* diff --git a/.github/scanner.sh b/.github/scanner.sh index 5adea0ce..a31085a7 100644 --- a/.github/scanner.sh +++ b/.github/scanner.sh @@ -125,7 +125,7 @@ if [ "$SKIP_BUILD" = false ]; then # Copy coverage files to Qodana directory and convert Windows paths to Linux log_info "Copying coverage files for Qodana..." index=0 - find . -name "coverage.info" -type f | while read -r file; do + while read -r file; do # Convert Windows paths (Z:\github\...) to Linux paths (/mnt/z/github/...) sed -e 's|SF:Z:\\|SF:/mnt/z/|g' \ -e 's|SF:z:\\|SF:/mnt/z/|g' \ @@ -133,7 +133,7 @@ if [ "$SKIP_BUILD" = false ]; then "$file" > "$COVERAGE_DIR/coverage_$index.info" log_detail "Converted: $file -> coverage_$index.info (Windows→Linux paths)" ((index++)) || true - done + done < <(find . -name "coverage.info" -type f) fi # ============================================ @@ -203,7 +203,11 @@ if [ "$SKIP_QODANA" = false ]; then # Install dependencies required for Qodana (IntelliJ) on minimal Debian if ! dpkg -s libfreetype6 fontconfig &> /dev/null; then log_info "Installing missing dependencies (libfreetype6, fontconfig)..." - apt-get update && apt-get install -y libfreetype6 fontconfig + if [ "$EUID" -ne 0 ]; then + sudo apt-get update && sudo apt-get install -y libfreetype6 fontconfig + else + apt-get update && apt-get install -y libfreetype6 fontconfig + fi fi export CI=true diff --git a/.github/sonarscanner.sh b/.github/sonarscanner.sh index f8c78b05..f9ce1864 100644 --- a/.github/sonarscanner.sh +++ b/.github/sonarscanner.sh @@ -17,32 +17,27 @@ fi # Coverage output directory for Qodana COVERAGE_DIR=".qodana/code-coverage" -echo "==> Building solution..." -dotnet build --no-incremental - -echo "==> Running tests with coverage..." -mkdir -p "$COVERAGE_DIR" -dotnet test --no-build --collect:"XPlat Code Coverage" \ - -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov - -# Copy coverage to Qodana directory -find . -name "coverage.info" -exec cp {} "$COVERAGE_DIR/" \; - # Run SonarCloud echo "==> Starting SonarScanner analysis..." -# Re-run tests with OpenCover format for SonarCloud -dotnet test --no-build --collect:"XPlat Code Coverage" \ - -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover - dotnet sonarscanner begin \ /o:"mihakralj-quantalib" \ /k:"mihakralj_QuanTAlib" \ /d:sonar.token="$SONAR_TOKEN" \ /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" +echo "==> Building solution..." dotnet build --no-incremental +echo "==> Running tests with coverage..." +mkdir -p "$COVERAGE_DIR" +# Run tests with both formats if possible, or sequentially +dotnet test --no-build --collect:"XPlat Code Coverage" \ + -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov,opencover + +# Copy coverage to Qodana directory +find . -name "coverage.info" -exec cp {} "$COVERAGE_DIR/" \; + dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN" echo "==> SonarCloud: https://sonarcloud.io/project/overview?id=mihakralj_QuanTAlib" diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index a3077cfd..8c985075 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -71,14 +71,14 @@ jobs: run: | mkdir -p coverage count=1 - find . -name "coverage.opencover.xml" -type f | while read file; do + while read -r file; do dest="coverage/coverage_${count}.opencover.xml" cp "$file" "$dest" # Sanitize paths for Qodana (convert absolute to relative) # This strips the current working directory from the paths in the XML sed -i "s|$(pwd)/||g" "$dest" count=$((count+1)) - done + done < <(find . -name "coverage.opencover.xml" -type f) - name: Upload Coverage Artifacts uses: actions/upload-artifact@v4 @@ -315,8 +315,10 @@ jobs: needs: [Build_Test_Coverage, Sonar_Analysis, Qodana_Scan, Codecov_Upload, Codacy_Upload, Snyk_Scan, CodeQL_Analysis] if: | success() && - (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || endsWith(github.ref, '-dev'))) || - github.event_name == 'workflow_dispatch' + ( + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || endsWith(github.ref, '-dev'))) || + github.event_name == 'workflow_dispatch' + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Directory.Build.props b/Directory.Build.props index 55c6caa1..3a250da2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -45,7 +45,7 @@ - S1144,S1944,S2053,S2222,S2245,S2259,S2583,S2589,S3329,S3655,S3776,S3900,S3949,S3966,S4158,S4347,S5773,S6781 + $(NoWarn);S1144;S1944;S2053;S2222;S2245;S2259;S2583;S2589;S3329;S3655;S3776;S3900;S3949;S3966;S4158;S4347;S5773;S6781 @@ -53,8 +53,8 @@ - Z:\Quantower - $([System.IO.Directory]::GetDirectories("$(QuantowerRoot)\TradingPlatform", "v1*")[0]) + Z:\Quantower + $([System.IO.Directory]::GetDirectories("$(QuantowerRoot)\TradingPlatform", "v1*")[0]) diff --git a/GitVersion.yml b/GitVersion.yml index 0f955e79..c3eeb9bd 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,32 +1,32 @@ -workflow: GitHubFlow/v1 -assembly-versioning-scheme: MajorMinorPatch -assembly-file-versioning-scheme: MajorMinorPatch -tag-prefix: '[vV]' -major-version-bump-message: '\+semver:\s?(breaking|major)' -minor-version-bump-message: '\+semver:\s?(feature|minor)' -patch-version-bump-message: '\+semver:\s?(fix|patch)' -no-bump-message: '\+semver:\s?(none|skip)' -branches: - main: - mode: ContinuousDeployment - label: '' - increment: Patch - prevent-increment: - of-merged-branch: true - track-merge-target: false - is-release-branch: true - is-main-branch: true - pre-release-weight: 0 - develop: - mode: ContinuousDelivery - label: alpha - increment: Patch - track-merge-target: true - track-merge-message: true - regex: ^dev(elop)?(ment)?$|.*-dev$ - source-branches: - - main - pre-release-weight: 30000 -ignore: - sha: [] -merge-message-formats: {} +workflow: GitHubFlow/v1 +assembly-versioning-scheme: MajorMinorPatch +assembly-file-versioning-scheme: MajorMinorPatch +tag-prefix: '[vV]' +major-version-bump-message: '\+semver:\s?(breaking|major)' +minor-version-bump-message: '\+semver:\s?(feature|minor)' +patch-version-bump-message: '\+semver:\s?(fix|patch)' +no-bump-message: '\+semver:\s?(none|skip)' +branches: + main: + mode: ContinuousDeployment + label: '' + increment: Patch + prevent-increment: + of-merged-branch: true + track-merge-target: false + is-release-branch: true + is-main-branch: true + pre-release-weight: 0 + develop: + mode: ContinuousDelivery + label: alpha + increment: Patch + track-merge-target: true + track-merge-message: true + regex: ^dev(elop)?(ment)?$|.*-dev$ + source-branches: + - main + pre-release-weight: 30000 +ignore: + sha: [] +merge-message-formats: {} diff --git a/lib/QuanTAlib.Tests.csproj b/lib/QuanTAlib.Tests.csproj index d7f0ce66..b0c955ed 100644 --- a/lib/QuanTAlib.Tests.csproj +++ b/lib/QuanTAlib.Tests.csproj @@ -12,12 +12,12 @@ - + - + diff --git a/lib/quantalib.csproj b/lib/quantalib.csproj index cc450824..433600f1 100644 --- a/lib/quantalib.csproj +++ b/lib/quantalib.csproj @@ -1,6 +1,6 @@  - net10.0 + net10.0 QuanTAlib Library of TA Calculations, Charts and Strategies for Quantower Quantitative Technical Analysis Library in C# for Quantower diff --git a/quantower/Trends.csproj b/quantower/Trends.csproj index bf79456b..ec511f2e 100644 --- a/quantower/Trends.csproj +++ b/quantower/Trends.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Trends Indicator bin\$(Configuration)\