From 88f4ee1825d24e8f2c6b799ef84f813deda91a6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 18:38:37 +0000 Subject: [PATCH 1/3] feat: add benchmarks to api-reference on version deploy Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/00d2cb8d-24e6-447f-9432-1196121e727c Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .github/workflows/publish-documentation.yml | 26 +++++++++++++++++++++ api-reference/guide/benchmarks.md | 11 +++++++++ api-reference/guide/toc.yml | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 api-reference/guide/benchmarks.md diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 474910ff..9ef4b305 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -96,6 +96,32 @@ jobs: run: | cp -r api-reference/guide api-reference/${{ env.friendly-version }}/guide + - name: 'Run benchmarks for v${{ env.friendly-version }}' + shell: bash + env: + benchmarks-artifacts: /tmp/benchmarks + run: | + dotnet run \ + --project benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj \ + --configuration Release \ + --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK || 'net10.0' }} \ + -- --filter ${{ vars.BENCHMARKDOTNET_FILTER || '*' }} \ + --exporters GitHub \ + --memory \ + --iterationTime 100 \ + --join \ + --artifacts ${{ env.benchmarks-artifacts }}/ + + - name: 'Inject benchmark results into guide for v${{ env.friendly-version }}' + shell: bash + env: + benchmarks-artifacts: /tmp/benchmarks + run: | + find ${{ env.benchmarks-artifacts }} -name "*-report-github.md" | sort | xargs cat > /tmp/benchmark_results.md + awk '/{benchmarks_section}/{while((getline line < "/tmp/benchmark_results.md") > 0) print line; close("/tmp/benchmark_results.md"); next} {print}' \ + "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" > /tmp/benchmarks.md + mv /tmp/benchmarks.md "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" + - name: 'Discover all versions' id: discover-versions shell: bash diff --git a/api-reference/guide/benchmarks.md b/api-reference/guide/benchmarks.md new file mode 100644 index 00000000..47b453f9 --- /dev/null +++ b/api-reference/guide/benchmarks.md @@ -0,0 +1,11 @@ +--- +title: Benchmarks +--- +# Benchmarks + +Performance benchmarks for **PolylineAlgorithm for .NET** measured using [BenchmarkDotNet](https://benchmarkdotnet.org/). + +> [!NOTE] +> Benchmarks are generated automatically during the release process. Results may vary depending on hardware and runtime version. + +{benchmarks_section} diff --git a/api-reference/guide/toc.yml b/api-reference/guide/toc.yml index 015a9943..e9d9e716 100644 --- a/api-reference/guide/toc.yml +++ b/api-reference/guide/toc.yml @@ -8,3 +8,5 @@ href: sample.md - name: FAQ href: faq.md +- name: Benchmarks + href: benchmarks.md From deafa009cf61664cb55920e1cd02528d64dbae53 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 18:42:49 +0000 Subject: [PATCH 2/3] fix: use standard env var name, xargs -r, and Any CPU platform in benchmark steps Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/1c7e3b25-3784-4e15-8f10-1bed76e67480 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .github/workflows/publish-documentation.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 9ef4b305..0b2ce18f 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -99,25 +99,26 @@ jobs: - name: 'Run benchmarks for v${{ env.friendly-version }}' shell: bash env: - benchmarks-artifacts: /tmp/benchmarks + BENCHMARKS_ARTIFACTS: /tmp/benchmarks run: | dotnet run \ --project benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj \ --configuration Release \ + /p:Platform="Any CPU" \ --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK || 'net10.0' }} \ -- --filter ${{ vars.BENCHMARKDOTNET_FILTER || '*' }} \ --exporters GitHub \ --memory \ --iterationTime 100 \ --join \ - --artifacts ${{ env.benchmarks-artifacts }}/ + --artifacts $BENCHMARKS_ARTIFACTS/ - name: 'Inject benchmark results into guide for v${{ env.friendly-version }}' shell: bash env: - benchmarks-artifacts: /tmp/benchmarks + BENCHMARKS_ARTIFACTS: /tmp/benchmarks run: | - find ${{ env.benchmarks-artifacts }} -name "*-report-github.md" | sort | xargs cat > /tmp/benchmark_results.md + find "$BENCHMARKS_ARTIFACTS" -name "*-report-github.md" | sort | xargs -r cat > /tmp/benchmark_results.md awk '/{benchmarks_section}/{while((getline line < "/tmp/benchmark_results.md") > 0) print line; close("/tmp/benchmark_results.md"); next} {print}' \ "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" > /tmp/benchmarks.md mv /tmp/benchmarks.md "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" From a8bb4ff38176eff915d8b2e1aacf804434deb4bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 18:51:17 +0000 Subject: [PATCH 3/3] refactor: move benchmark run from pull-request to release workflow, consume artifacts in publish-docs Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/a0437570-56e0-443f-8b45-75faef614455 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .github/workflows/publish-documentation.yml | 26 ++++--------- .github/workflows/pull-request.yml | 41 ++------------------- .github/workflows/release.yml | 37 ++++++++++++++++++- 3 files changed, 46 insertions(+), 58 deletions(-) diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 0b2ce18f..7f01504d 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -96,29 +96,17 @@ jobs: run: | cp -r api-reference/guide api-reference/${{ env.friendly-version }}/guide - - name: 'Run benchmarks for v${{ env.friendly-version }}' - shell: bash - env: - BENCHMARKS_ARTIFACTS: /tmp/benchmarks - run: | - dotnet run \ - --project benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj \ - --configuration Release \ - /p:Platform="Any CPU" \ - --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK || 'net10.0' }} \ - -- --filter ${{ vars.BENCHMARKDOTNET_FILTER || '*' }} \ - --exporters GitHub \ - --memory \ - --iterationTime 100 \ - --join \ - --artifacts $BENCHMARKS_ARTIFACTS/ + - name: 'Download benchmark results' + uses: actions/download-artifact@v8 + with: + pattern: benchmark-* + path: /tmp/benchmarks + merge-multiple: true - name: 'Inject benchmark results into guide for v${{ env.friendly-version }}' shell: bash - env: - BENCHMARKS_ARTIFACTS: /tmp/benchmarks run: | - find "$BENCHMARKS_ARTIFACTS" -name "*-report-github.md" | sort | xargs -r cat > /tmp/benchmark_results.md + find /tmp/benchmarks -name "*-report-github.md" | sort | xargs -r cat > /tmp/benchmark_results.md awk '/{benchmarks_section}/{while((getline line < "/tmp/benchmark_results.md") > 0) print line; close("/tmp/benchmark_results.md"); next} {print}' \ "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" > /tmp/benchmarks.md mv /tmp/benchmarks.md "api-reference/${{ env.friendly-version }}/guide/benchmarks.md" diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index bffc605e..c99f254d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -18,8 +18,8 @@ permissions: id-token: write contents: write -concurrency: - group: pull-request-${{ github.head_ref || github.ref }} +concurrency: + group: pull-request-${{ github.head_ref || github.ref }} cancel-in-progress: true env: @@ -189,7 +189,7 @@ jobs: - name: Pack with .NET run: | dotnet pack ${{ vars.SRC_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} /p:Platform="${{ env.build-platform }}" /p:PackageVersion=${{ env.release-version }} /p:Version=${{ env.assembly-version }} /p:AssemblyInformationalVersion=${{ env.assembly-informational-version }} /p:FileVersion=${{ env.file-version }} --output ${{ runner.temp }}/${{ env.nuget-packages-directory }} - + - name: Upload Package uses: actions/upload-artifact@v7 with: @@ -239,38 +239,3 @@ jobs: - name: 'Check for vulnerable packages' run: dotnet list src/PolylineAlgorithm/PolylineAlgorithm.csproj package --vulnerable --include-transitive - - benchmark: - if: ${{ needs.workflow-variables.outputs.is-release == 'true' || vars.BENCHMARKDOTNET_RUN_OVERRIDE == 'true' }} - name: Benchmark with .NET CLI on ${{ matrix.os }} - needs: [workflow-variables, build] - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} - steps: - - name: 'Checkout ${{ github.head_ref || github.ref }}' - uses: actions/checkout@v6 - - name: Install .NET SDK - uses: actions/setup-dotnet@v5 - with: - dotnet-version: | - 8.x - 10.x - - name: Download Build - uses: actions/download-artifact@v8 - with: - name: build - - name: Benchmark - working-directory: ${{ vars.BENCHMARKDOTNET_WORKING_DIRECTORY }} - run: dotnet run --configuration ${{ env.build-configuration }} /p:Platform=${{ env.build-platform }} --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK }} --runtimes ${{ vars.BENCHMARKDOTNET_RUNTIMES }} --filter ${{ vars.BENCHMARKDOTNET_FILTER }} --artifacts ${{ runner.temp }}/benchmarks/ --exporters GitHub --memory --iterationTime 100 --join - - name: Upload Benchmark Results - uses: actions/upload-artifact@v7 - with: - name: benchmark-${{ matrix.os }} - path: | - ${{ runner.temp }}/benchmarks/**/*-report-github.md - - name: Write Benchmark Summary - shell: bash - run: cat **/*-report-github.md > $GITHUB_STEP_SUMMARY - working-directory: ${{ runner.temp }}/benchmarks/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 466b6240..b0bd5699 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -290,9 +290,44 @@ jobs: ${{ runner.temp }}/${{ env.nuget-packages-directory }}/**/*.nupkg ${{ runner.temp }}/${{ env.nuget-packages-directory }}/**/*.snupkg + benchmark: + name: Benchmark with .NET CLI on ${{ matrix.os }} + needs: [workflow-variables, build, validate-release] + if: ${{ needs.workflow-variables.outputs.is-release == 'true' || vars.BENCHMARKDOTNET_RUN_OVERRIDE == 'true' }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: 'Checkout ${{ github.head_ref || github.ref }}' + uses: actions/checkout@v6 + - name: Install .NET SDK + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.x + 10.x + - name: Download Build + uses: actions/download-artifact@v8 + with: + name: build + - name: Benchmark + working-directory: ${{ vars.BENCHMARKDOTNET_WORKING_DIRECTORY }} + run: dotnet run --configuration ${{ env.build-configuration }} /p:Platform=${{ env.build-platform }} --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK }} --runtimes ${{ vars.BENCHMARKDOTNET_RUNTIMES }} --filter ${{ vars.BENCHMARKDOTNET_FILTER }} --artifacts ${{ runner.temp }}/benchmarks/ --exporters GitHub --memory --iterationTime 100 --join + - name: Upload Benchmark Results + uses: actions/upload-artifact@v7 + with: + name: benchmark-${{ matrix.os }} + path: | + ${{ runner.temp }}/benchmarks/**/*-report-github.md + - name: Write Benchmark Summary + shell: bash + run: cat **/*-report-github.md > $GITHUB_STEP_SUMMARY + working-directory: ${{ runner.temp }}/benchmarks/ + publish-documentation: name: 'Publish documentation' - needs: [pack, validate-release, workflow-variables] + needs: [pack, benchmark, validate-release, workflow-variables] if: ${{ needs.workflow-variables.outputs.is-release == 'true' }} uses: ./.github/workflows/publish-documentation.yml permissions: