📉 gobenchdata
a tool for inspecting go test -bench
data, and a
GitHub Action for continuous benchmarking.
GitHub Action
A GitHub Action for uploading Go benchmark data to gh-pages
using gobenchdata
.
Setup
For example, in main.workflow
:
workflow "Benchmark" {
on = "push"
resolves = ["gobenchdata to gh-pages"]
}
action "filter" {
uses = "actions/bin/filter@master"
args = "branch master"
}
action "gobenchdata to gh-pages" {
uses = "bobheadxi/gobenchdata@master"
needs = ["filter"]
secrets = ["GITHUB_TOKEN"]
env = {
PRUNE = "20"
}
}
Learn more about GitHub Actions in the official documentation.
Configuration
Variable |
Default |
Purpose |
GITHUB_TOKEN |
set by GitHub |
token to provide access to repository |
GITHUB_ACTOR |
set by GitHub |
the user to make commits as |
GIT_COMMIT_MESSAGE |
"add new benchmark run" |
the commit message for the benchmark update |
GO_BENCHMARKS |
. |
benchmarks to run (argument for -bench ) |
GO_BENCHMARK_FLAGS |
|
additional flags for go test |
GO_BENCHMARK_PKGS |
./... |
packages to test (argument for go test ) |
FINAL_OUTPUT |
benchmarks.json |
destination path of benchmark data |
PRUNE |
0 |
number of past runs to keep (0 keeps everything) |
Visualisation
The gobenchdata
GitHub action eventually generates a JSON file with past benchmarks.
You can visualize these continuous benchmarks by creating a web app that reads
from the JSON benchmarks file, or by using gobenchdata-web
:
go get -u github.com/bobheadxi/x/gobenchdata-web
git checkout gh-pages
gobenchdata-web --title "my benchmarks" # generates a web app in your working directory
You test the web app locally using a tool like serve:
serve .
This feature is a work in progress. An example site published by this repository is
available at gobenchdata.bobheaxi.dev.
gobenchdata
CLI
gobenchdata
, which the GitHub Action leverages to manage benchmark data,
is also available as a CLI:
go get -u github.com/bobheadxi/gobenchdata
gobenchdata help
Usage documentation can be found in the
godocs.
Development and Contributions
Please report bugs and requests in the repository issues!
See CONTRIBUTING.md for more detailed development documentation.