Skip to content

ci: publish benchmarks (#2866) #147

ci: publish benchmarks (#2866)

ci: publish benchmarks (#2866) #147

Workflow file for this run

---
name: "Main"
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
# NOTE! Do NOT add any other "on", because this workflow has permission to write to the repo!
permissions:
# permission to update benchmark contents in gh-pages branch
contents: "write"
jobs:
benchmarks:
name: "Run Go benchmarks on Main"
runs-on: "depot-ubuntu-24.04-arm-8" # same as build-test.yaml
timeout-minutes: 15
steps:
- uses: "actions/checkout@v6"
with:
fetch-depth: 0
- uses: "actions/[email protected]"
with:
go-version-file: "./go.mod"
cache-dependency-path: "./go.sum"
check-latest: true
- name: "Run benchmark on Main"
run: |
set -o pipefail
go run mage.go benchmark:all | tee bench_output.txt
- name: "Get JSON for benchmark"
uses: "benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b" # v1.20.7
with:
# What benchmark tool the output.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: "bench_output.txt"
# Updates the file content instead of generating a Git commit in GitHub Pages branch
external-data-json-path: "./cache/benchmark-data.json"
# Workflow will fail when an alert happens
fail-on-alert: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
comment-on-alert: true
- name: "Publish to gh-pages. See https://authzed.github.io/spicedb/dev/bench/"
uses: "benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b" # v1.20.7
with:
# What benchmark tool the output.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: "bench_output.txt"
gh-pages-branch: "gh-pages"
auto-push: "true"
# auto-push requires token
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Save benchmark JSON"
uses: "actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb" # v5.0.1
with:
path: "./cache/benchmark-data.json"
# Save with commit hash to avoid "cache already exists"
key: "${{ github.sha }}-${{ runner.os }}-go-benchmark"