From 76513d3f4ef32768776b98e36075c6802829cb9d Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Fri, 20 Feb 2026 20:37:54 +0000 Subject: [PATCH] Migrate benchmark workflow from BenchmarkCI to AirspeedVelocity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the manual BenchmarkCI workflow (50+ lines) with the modern AirspeedVelocity action (3 lines). Changes: - Replaced benchmark.yml with AirspeedVelocity action - Deleted benchmark-comment.yml (no longer needed) Benefits: - Much simpler and easier to maintain - Consistent with other repos in the organization - Automatic PR comments with benchmark results - Better integration with GitHub Actions The AirspeedVelocity action handles all the complexity internally: - Running benchmarks on base and PR branches - Comparing results and generating reports - Posting formatted comments to PRs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/benchmark-comment.yml | 64 ------------------------ .github/workflows/benchmark.yml | 65 ++++++------------------- 2 files changed, 15 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/benchmark-comment.yml diff --git a/.github/workflows/benchmark-comment.yml b/.github/workflows/benchmark-comment.yml deleted file mode 100644 index ce0d6c4..0000000 --- a/.github/workflows/benchmark-comment.yml +++ /dev/null @@ -1,64 +0,0 @@ -# To workaroud https://github.com/actions/first-interaction/issues/10 in a secure way, -# we take the following steps to generate and comment a performance benchmark result: -# 1. first "performance tracking" workflow will generate the benchmark results in an unprivileged environment triggered on `pull_request` event -# 2. then this "performance tracking (comment)" workflow will show the result to us as a PR comment in a privileged environment -# Note that this workflow can only be modifed by getting checked-in to the default branch -# and thus is secure even though this workflow is granted with write permissions, etc. -# xref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - -name: Performance tracking (comment) - -on: - workflow_run: - workflows: - - performance tracking - types: - - completed - -jobs: - comment: - runs-on: ubuntu-latest - #runs-on: self-hosted - if: > - ${{ github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' }} - steps: - - uses: actions/checkout@v6 - - # restore records from the artifacts - - uses: dawidd6/action-download-artifact@v14 - with: - workflow: benchmark.yml - name: performance-tracking - workflow_conclusion: success - - name: output benchmark result - id: output-result-markdown - run: | - echo ::set-output name=body::$(cat ./benchmark-result.artifact) - - name: output pull request number - id: output-pull-request-number - run: | - echo ::set-output name=body::$(cat ./pull-request-number.artifact) - - # check if the previous comment exists - - name: find comment - uses: peter-evans/find-comment@v4 - id: fc - with: - issue-number: ${{ steps.output-pull-request-number.outputs.body }} - comment-author: 'github-actions[bot]' - body-includes: Benchmark Result - - # create/update comment - - name: create comment - if: ${{ steps.fc.outputs.comment-id == 0 }} - uses: peter-evans/create-or-update-comment@v5 - with: - issue-number: ${{ steps.output-pull-request-number.outputs.body }} - body: ${{ steps.output-result-markdown.outputs.body }} - - name: update comment - if: ${{ steps.fc.outputs.comment-id != 0 }} - uses: peter-evans/create-or-update-comment@v5 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - body: ${{ steps.output-result-markdown.outputs.body }} diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 4b9bdaf..1bee369 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,57 +1,22 @@ -name: Performance tracking +name: Benchmarks on: - pull_request: + pull_request_target: + branches: [master, main] +permissions: + pull-requests: write -env: - PYTHON: ~ +concurrency: + # group by workflow and ref; the last slightly strange component ensures that for pull + # requests, we limit to 1 concurrent job, but for the master branch we don't + group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main') || github.run_number }} + # Cancel intermediate builds, but only if it is a pull request build. + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - performance-tracking: + benchmark: runs-on: ubuntu-latest - #runs-on: self-hosted steps: - # setup - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@latest + - uses: MilesCranmer/AirspeedVelocity.jl@action-v1 with: - version: '1.10' - - uses: julia-actions/julia-buildpkg@latest - - name: install dependencies - run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"' - - # run the benchmark suite - - name: run benchmarks - run: | - julia -e ' - using BenchmarkCI - BenchmarkCI.judge() - BenchmarkCI.displayjudgement() - ' - - # generate and record the benchmark result as markdown - - name: generate benchmark result - run: | - body=$(julia -e ' - using BenchmarkCI - - let - judgement = BenchmarkCI._loadjudge(BenchmarkCI.DEFAULT_WORKSPACE) - title = "Benchmark Result" - ciresult = BenchmarkCI.CIResult(; judgement, title) - BenchmarkCI.printcommentmd(stdout::IO, ciresult) - end - ') - body="${body//'%'/'%25'}" - body="${body//$'\n'/'%0A'}" - body="${body//$'\r'/'%0D'}" - echo $body > ./benchmark-result.artifact - - # record the pull request number - - name: record pull request number - run: echo ${{ github.event.pull_request.number }} > ./pull-request-number.artifact - - # save as artifacts (performance tracking (comment) workflow will use it) - - uses: actions/upload-artifact@v6 - with: - name: performance-tracking - path: ./*.artifact + julia-version: '1' + tune: 'false'