From 609d5490a6dc924e69b9b560a6f0f6353ac19e9a Mon Sep 17 00:00:00 2001 From: AMPW-german Date: Sun, 28 Jun 2026 19:10:58 +0200 Subject: [PATCH 1/4] Update v0.3.1 Append framework to the DLL --- GEffectsLogic/GEffectsLogic.csproj | 16 +++++++++++----- GEffectsLogic/GEffectsLogicInstance.cs | 8 +++++--- GraphicLogicTest/MainWindow.xaml.cs | 8 ++++---- GraphicLogicTest/SimulationViewModel.cs | 1 - .../Views/GLoCPlot/GLoCPlot.axaml.cs | 8 ++++---- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/GEffectsLogic/GEffectsLogic.csproj b/GEffectsLogic/GEffectsLogic.csproj index a8429f5..087af1e 100644 --- a/GEffectsLogic/GEffectsLogic.csproj +++ b/GEffectsLogic/GEffectsLogic.csproj @@ -1,15 +1,17 @@  - net481;net10.0 - latest - enable + net481;net10.0 + GEffectsLogic + GEffectsLogic + latest + enable Debug;Release;PerfDebug False - 0.3.0 + 0.3.1 $(VersionPrefix) - 0.3.0.0 + 0.3.1.0 $(VersionPrefix).0 nogit @@ -21,6 +23,10 @@ GNU GPL v3.0 + + GEffectsLogic-$(TargetFramework) + + none diff --git a/GEffectsLogic/GEffectsLogicInstance.cs b/GEffectsLogic/GEffectsLogicInstance.cs index 36bd110..87903fd 100644 --- a/GEffectsLogic/GEffectsLogicInstance.cs +++ b/GEffectsLogic/GEffectsLogicInstance.cs @@ -94,14 +94,16 @@ public virtual void Update(double deltaTime, double currentGx, double currentGy, #if PERFDEBUG var sw = Stopwatch.StartNew(); #endif - List dtList = new(); + List dtList = []; - if (deltaTime > 1) { + if (deltaTime > 1) + { int stepCount = (int)deltaTime * 2; dtList.AddRange(Enumerable.Repeat(deltaTime / stepCount, stepCount)); if (!stable) Logger.Log($"High deltaTime detected: {deltaTime}s - splitting it into {stepCount} steps of {deltaTime / stepCount}s each", UniqueID, Logger.LogLevel.Warning); } - else if (deltaTime <= 0) { + else if (deltaTime <= 0) + { Logger.Log($"Negative deltaTime detected: {deltaTime}s", UniqueID, Logger.LogLevel.Error); } else diff --git a/GraphicLogicTest/MainWindow.xaml.cs b/GraphicLogicTest/MainWindow.xaml.cs index b144fa6..57991b8 100644 --- a/GraphicLogicTest/MainWindow.xaml.cs +++ b/GraphicLogicTest/MainWindow.xaml.cs @@ -1,5 +1,7 @@ using Avalonia.Controls; using Avalonia.Interactivity; +using GraphicLogicTest.Logging; +using GraphicLogicTest.Views.GLoCPlot; using GraphicLogicTest.Views.SimulationView; using LiveChartsCore; using LiveChartsCore.Defaults; @@ -13,8 +15,6 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; -using GraphicLogicTest.Logging; -using GraphicLogicTest.Views.GLoCPlot; namespace GraphicLogicTest { @@ -31,9 +31,9 @@ public MainWindow() _ = new TestLogging(); GEffectsLogic.Logging.Logger.Instance = new LogicLogging(); GEffectsLogic.LogicSettings.DebugMode = true; - + _simulationViewModel = new SimulationViewModel(); - + InitializeComponent(); DataContext = this; RegisterWindowViews(); diff --git a/GraphicLogicTest/SimulationViewModel.cs b/GraphicLogicTest/SimulationViewModel.cs index ba123d4..5ee13a3 100644 --- a/GraphicLogicTest/SimulationViewModel.cs +++ b/GraphicLogicTest/SimulationViewModel.cs @@ -1,7 +1,6 @@ using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Threading; -using GraphicLogicTest.Logging; using System.Collections.ObjectModel; using System.ComponentModel; using System.Reflection; diff --git a/GraphicLogicTest/Views/GLoCPlot/GLoCPlot.axaml.cs b/GraphicLogicTest/Views/GLoCPlot/GLoCPlot.axaml.cs index be95934..8bf2620 100644 --- a/GraphicLogicTest/Views/GLoCPlot/GLoCPlot.axaml.cs +++ b/GraphicLogicTest/Views/GLoCPlot/GLoCPlot.axaml.cs @@ -1,4 +1,3 @@ -using System.Collections.ObjectModel; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; @@ -8,6 +7,7 @@ using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Painting; using SkiaSharp; +using System.Collections.ObjectModel; namespace GraphicLogicTest.Views.GLoCPlot { @@ -19,7 +19,7 @@ public partial class GLoCPlot : UserControl public string EndG { get; set; } = "9"; public string Iterations { get; set; } = "10"; - private ObservableCollection GLoCPoints = new(); + private ObservableCollection GLoCPoints = []; public List Series { get; private set; } @@ -57,8 +57,8 @@ private void AddGAccelerationLine(double startG, double endG, double endTime) Name = "GAcceleration", Values = new ObservableCollection() { - new ObservablePoint(0.0, startG), - new ObservablePoint(endTime, endG) + new(0.0, startG), + new(endTime, endG) }, GeometrySize = 0, Stroke = new SolidColorPaint(SKColors.DarkViolet), From dac05bcb694428cc6c2b490f9b2b5fac4ac2ef95 Mon Sep 17 00:00:00 2001 From: AMPW-german Date: Mon, 29 Jun 2026 21:49:46 +0200 Subject: [PATCH 2/4] Add pdb and deps.json to pipeline artifacts --- .github/workflows/dotnet.yml | 7 +++++-- GEffectsLogic/GEffectsLogic.csproj | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 5fc7318..05a6791 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,12 +1,11 @@ # This workflow will build and test a .NET project and publish DLL artifacts. -name: .NET +name: Build on: push: branches: [ "main" ] pull_request: - branches: [ "main" ] jobs: build-artifacts: @@ -36,10 +35,14 @@ jobs: mkdir -p artifacts/net481/debug cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.dll artifacts/net10.0/release/ + cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.deps.json artifacts/net10.0/release/ + cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.pdb artifacts/net10.0/release/ cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.dll artifacts/net10.0/debug/ + cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.deps.json artifacts/net10.0/debug/ cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.pdb artifacts/net10.0/debug/ cp GEffectsLogic/bin/Release/net481/GEffectsLogic.dll artifacts/net481/release/ + cp GEffectsLogic/bin/Release/net481/GEffectsLogic.pdb artifacts/net481/release/ cp GEffectsLogic/bin/Debug/net481/GEffectsLogic.dll artifacts/net481/debug/ cp GEffectsLogic/bin/Debug/net481/GEffectsLogic.pdb artifacts/net481/debug/ diff --git a/GEffectsLogic/GEffectsLogic.csproj b/GEffectsLogic/GEffectsLogic.csproj index 087af1e..46da681 100644 --- a/GEffectsLogic/GEffectsLogic.csproj +++ b/GEffectsLogic/GEffectsLogic.csproj @@ -44,7 +44,7 @@ -perfDebug - + portable From 049bde8e876e10d2a39f63a58c52c3eff8ab6f2c Mon Sep 17 00:00:00 2001 From: AMPW-german Date: Wed, 1 Jul 2026 20:23:37 +0200 Subject: [PATCH 3/4] Add release pipeline job --- .github/workflows/dotnet.yml | 191 ++++++++++++++++++++++++++--- GEffectsLogic/GEffectsLogic.csproj | 2 +- 2 files changed, 177 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 05a6791..bfaf047 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,6 +1,7 @@ -# This workflow will build and test a .NET project and publish DLL artifacts. +name: GEffectsLogic CI -name: Build +permissions: + contents: write on: push: @@ -9,8 +10,12 @@ on: jobs: build-artifacts: - runs-on: ubuntu-latest - + runs-on: ubuntu-slim + outputs: + versionprefix_changed: ${{ steps.versionprefix.outputs.changed }} + version: ${{ steps.versionprefix.outputs.version }} + artifact_name: ${{ steps.artifact-name.outputs.name }} + steps: - uses: actions/checkout@v4 @@ -22,6 +27,26 @@ jobs: - name: Restore dependencies run: dotnet restore + - name: Detect VersionPrefix change on main push + id: versionprefix + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + shell: bash + run: | + version=v$(grep -oPm1 '(?<=)[^<]+' GEffectsLogic/GEffectsLogic.csproj) + echo "version=$version" >> "$GITHUB_OUTPUT" + + before="${{ github.event.before }}" + if [ -z "$before" ] || [ "$before" = "0000000000000000000000000000000000000000" ]; then + echo "changed=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + if git diff "$before" "${{ github.sha }}" -- GEffectsLogic/GEffectsLogic.csproj | grep -q 'VersionPrefix'; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + - name: Build all configurations run: | dotnet build GEffectsLogic/GEffectsLogic.csproj -c Release --no-restore @@ -34,22 +59,39 @@ jobs: mkdir -p artifacts/net481/release mkdir -p artifacts/net481/debug - cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.dll artifacts/net10.0/release/ - cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.deps.json artifacts/net10.0/release/ - cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic.pdb artifacts/net10.0/release/ - cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.dll artifacts/net10.0/debug/ - cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.deps.json artifacts/net10.0/debug/ - cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic.pdb artifacts/net10.0/debug/ + cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic-net10.0.dll artifacts/net10.0/release/ + cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic-net10.0.deps.json artifacts/net10.0/release/ + cp GEffectsLogic/bin/Release/net10.0/GEffectsLogic-net10.0.pdb artifacts/net10.0/release/ + cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic-net10.0.dll artifacts/net10.0/debug/ + cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic-net10.0.deps.json artifacts/net10.0/debug/ + cp GEffectsLogic/bin/Debug/net10.0/GEffectsLogic-net10.0.pdb artifacts/net10.0/debug/ + + cp GEffectsLogic/bin/Release/net481/GEffectsLogic-net481.dll artifacts/net481/release/ + cp GEffectsLogic/bin/Release/net481/GEffectsLogic-net481.pdb artifacts/net481/release/ + cp GEffectsLogic/bin/Debug/net481/GEffectsLogic-net481.dll artifacts/net481/debug/ + cp GEffectsLogic/bin/Debug/net481/GEffectsLogic-net481.pdb artifacts/net481/debug/ + + - name: Compute artifact name + id: artifact-name + shell: bash + run: | + version="${{ steps.versionprefix.outputs.version }}" + short_hash="${GITHUB_SHA::7}" - cp GEffectsLogic/bin/Release/net481/GEffectsLogic.dll artifacts/net481/release/ - cp GEffectsLogic/bin/Release/net481/GEffectsLogic.pdb artifacts/net481/release/ - cp GEffectsLogic/bin/Debug/net481/GEffectsLogic.dll artifacts/net481/debug/ - cp GEffectsLogic/bin/Debug/net481/GEffectsLogic.pdb artifacts/net481/debug/ + if [ "$CONFIGURATION" = "Debug" ]; then + artifact_name="GEffectsLogic-${version}-${short_hash}-debug" + elif [ "$GITHUB_EVENT_NAME" = "push" ] && [ "$GITHUB_REF" = "refs/heads/main" ] && [ "${{ steps.versionprefix.outputs.changed }}" = "true" ]; then + artifact_name="GEffectsLogic-${version}" + else + artifact_name="GEffectsLogic-${version}-${short_hash}" + fi + + echo "name=$artifact_name" >> "$GITHUB_OUTPUT" - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: GEffectsLogic + name: ${{ steps.artifact-name.outputs.name }} path: artifacts/ test: @@ -72,3 +114,122 @@ jobs: - name: Test (Debug) run: dotnet test GEffectLogicTests/GEffectLogicTests.csproj -c Debug --no-build --verbosity normal + + release-artifacts: + runs-on: ubuntu-slim + needs: build-artifacts + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build-artifacts.outputs.versionprefix_changed == 'true' }} + steps: + - name: Verify version change + shell: bash + run: | + new_version="${{ needs.build-artifacts.outputs.version }}" + current_version=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")') + + echo "csproj version: $new_version" + echo "latest release version: $current_version" + + if [ "$new_version" = "$current_version" ]; then + echo "VersionPrefix has not changed since the last release. Skipping release." + exit 1 + fi + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build-artifacts.outputs.artifact_name }} + path: release-assets + + - name: Zip release payload + shell: bash + run: | + artifact_name="${{ needs.build-artifacts.outputs.artifact_name }}" + cd release-assets + zip -r "../${artifact_name}.zip" . + + - name: Create GitHub release + id: github-release + shell: bash + run: | + json_payload=$(jq -n \ + --arg tag_name "${{ needs.build-artifacts.outputs.version }}" \ + --arg name "${{ needs.build-artifacts.outputs.version }}" \ + '{ tag_name: $tag_name, name: $name, draft: true, prerelease: false, generate_release_notes: true }') + + echo "Creating release with payload: $json_payload" + response_file=$(mktemp) + http_status=$(curl -sS -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + https://api.github.com/repos/${{ github.repository }}/releases \ + -d "$json_payload" \ + -o "$response_file" \ + -w "%{http_code}") + + if [ "$http_status" -ne 201 ]; then + echo "Failed to create release. Expected HTTP 201, got HTTP $http_status." >&2 + cat "$response_file" >&2 + exit 1 + fi + + upload_url=$(jq -r '.upload_url' "$response_file") + if [ -z "$upload_url" ] || [ "$upload_url" = "null" ]; then + echo "Release created but upload_url is missing in response." >&2 + cat "$response_file" >&2 + exit 1 + fi + + upload_url="${upload_url%\{*}" + asset_name="${{ needs.build-artifacts.outputs.artifact_name }}.zip" + asset_path="$asset_name" + + if [ ! -f "$asset_path" ]; then + echo "Expected release asset file '$asset_path' was not found." >&2 + exit 1 + fi + + echo "Uploading release asset: $asset_name" + upload_response_file=$(mktemp) + upload_status=$(curl -sS -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/zip" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + --data-binary @"$asset_path" \ + "${upload_url}?name=${asset_name}" \ + -o "$upload_response_file" \ + -w "%{http_code}") + + if [ "$upload_status" -ne 201 ]; then + echo "Failed to upload release asset. Expected HTTP 201, got HTTP $upload_status." >&2 + cat "$upload_response_file" >&2 + exit 1 + fi + + release_id=$(jq -r '.id' "$response_file") + if [ -z "$release_id" ] || [ "$release_id" = "null" ]; then + echo "Release created but id is missing in response." >&2 + cat "$response_file" >&2 + exit 1 + fi + + publish_payload='{"draft":false}' + publish_response_file=$(mktemp) + publish_status=$(curl -sS -L -X PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + -H "X-GitHub-Api-Version: 2026-03-10" \ + https://api.github.com/repos/${{ github.repository }}/releases/$release_id \ + -d "$publish_payload" \ + -o "$publish_response_file" \ + -w "%{http_code}") + + if [ "$publish_status" -ne 200 ]; then + echo "Failed to publish release. Expected HTTP 200, got HTTP $publish_status." >&2 + cat "$publish_response_file" >&2 + exit 1 + fi + + echo "Release created and asset uploaded successfully." \ No newline at end of file diff --git a/GEffectsLogic/GEffectsLogic.csproj b/GEffectsLogic/GEffectsLogic.csproj index 46da681..5f26935 100644 --- a/GEffectsLogic/GEffectsLogic.csproj +++ b/GEffectsLogic/GEffectsLogic.csproj @@ -9,7 +9,7 @@ Debug;Release;PerfDebug False - 0.3.1 + 0.3.2 $(VersionPrefix) 0.3.1.0 $(VersionPrefix).0 From 92008d9e6042f35d5f83a11a239362215f1f700f Mon Sep 17 00:00:00 2001 From: AMPW-german Date: Wed, 1 Jul 2026 20:40:35 +0200 Subject: [PATCH 4/4] Fix pipeline artifact naming --- .github/workflows/dotnet.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bfaf047..f5eaeb9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -29,7 +29,6 @@ jobs: - name: Detect VersionPrefix change on main push id: versionprefix - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} shell: bash run: | version=v$(grep -oPm1 '(?<=)[^<]+' GEffectsLogic/GEffectsLogic.csproj) @@ -78,12 +77,14 @@ jobs: version="${{ steps.versionprefix.outputs.version }}" short_hash="${GITHUB_SHA::7}" - if [ "$CONFIGURATION" = "Debug" ]; then - artifact_name="GEffectsLogic-${version}-${short_hash}-debug" - elif [ "$GITHUB_EVENT_NAME" = "push" ] && [ "$GITHUB_REF" = "refs/heads/main" ] && [ "${{ steps.versionprefix.outputs.changed }}" = "true" ]; then - artifact_name="GEffectsLogic-${version}" + if [ "$GITHUB_EVENT_NAME" = "push" ] && [ "$GITHUB_REF" = "refs/heads/main" ]; then + if [ "${{ steps.versionprefix.outputs.changed }}" = "true" ]; then + artifact_name="GEffectsLogic-${version}" + else + artifact_name="GEffectsLogic-${version}-${short_hash}" + fi else - artifact_name="GEffectsLogic-${version}-${short_hash}" + artifact_name="GEffectsLogic-${version}-${short_hash}-debug" fi echo "name=$artifact_name" >> "$GITHUB_OUTPUT"