Skip to content

Commit

Permalink
ci(bench): Add benchmark-action (#900)
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson authored Dec 7, 2024
1 parent 05ed51d commit 6408c34
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: go benchmarks
on:
push:
branches:
- main
pull_request:

jobs:
benchmark:
name: benchmark regression check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Run benchmark
run: make bench.txt
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'go'
output-file-path: bench.txt
external-data-json-path: ./cache/benchmark-data.json
fail-on-alert: true
comment-on-alert: true
comment-always: true
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: "200%"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ endif
test:
go test $(TEST_ARGS) -coverprofile=c.out ./...

bench.txt:
go test -benchmem -run=xxx -bench . ./... | tee $@

bin/fscli_%v7$(call extension,$(GOOS)): $(shell find . -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) \
GOARCH=$(shell echo $* | cut -f2 -d- ) \
Expand Down

0 comments on commit 6408c34

Please sign in to comment.