feat(ci): add benchci for better visualization (#149)

This adds a small in-repo tool and updates the ci.yml file in order
to make benchmark and most importantly allocation results visible in a
PR. It also drops the 3rdparty action we had commented out.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
This commit is contained in:
Marvin Drees
2026-07-03 01:21:49 +02:00
committed by GitHub
parent e5f8ac0687
commit 104a2b0b26
3 changed files with 311 additions and 14 deletions
+14 -14
View File
@@ -104,7 +104,7 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -115,20 +115,20 @@ jobs:
- name: Run benchmarks
run: go test -bench=. -benchmem -count=5 -shuffle=on -run='^$' -timeout=15m ./... | tee bench-results.txt
# Fails for a weird reason, will be investigated in the future
# - name: Report benchmark regressions
# uses: benchmark-action/github-action-benchmark@a887eba2af2000fda74e733fcf952aa823b65916 # v1.21.0
# with:
# tool: go
# output-file-path: bench-results.txt
# summary-always: true
# comment-on-alert: true
# alert-threshold: "120%"
# fail-on-alert: false
# auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate benchmark report
run: |
go run ./internal/benchci -current bench-results.txt -out bench-report.md
cat bench-report.md >> "$GITHUB_STEP_SUMMARY"
- name: Upload benchmark results
- name: Upload generated benchmark report
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bench-report
path: bench-report.md
retention-days: 30
- name: Upload raw benchmark results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: