Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(bench): Add benchmark-action #2283

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@v5
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:
Comment on lines +24 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about this action. Sounds interesting!

(sorry for the random comment, I'm still subscribed to this repo, just a bit of a fly on the wall here ❤️)

Copy link
Owner Author

@hairyhenderson hairyhenderson Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋😁

I've been toying around with it a bit in a few repos... It can generate some graphs (like https://hairyhenderson.github.io/go-codeowners/dev/bench), but I don't like how they look. I've been thinking of pushing the data into a public Grafana dashboard; maybe a Christmas vacation side-project 😂

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same(ish); we've been discussing for a while that we would really love to have metrics of CI over time; (performance) regressions always tend to sneak in really granularly, and honestly, GitHub actions does not provide any good tooling on itself to keep eyes on those.

The BuildKit team started some work on a "bench" repository for BuildKit to compare things between versions;

(for sure "borrow" anything from that if its of use! we may be doing so as well for the engine 😄)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We also have some internal tools that collect data, which I think is also a combination of grafana and other bits and bops, but not yet in a good shape for this exact purpose)

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%"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ report.xml
*.out
.netlify
docs/.hugo_build.lock
bench.txt
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ test:
$(GO) test -race -coverprofile=c.out ./...
endif

bench.txt: go.mod go.sum $(GO_FILES)
$(GO) test -benchmem -run=xxx -bench . ./... | tee $@

.SECONDEXPANSION:
testbin/%.test.exe: $$(shell $$(GO) list -f '{{.Dir}}' $$(subst testbin/,,$$(subst .test.exe,,$$@)))
@GOOS=windows GOARCH=amd64 $(GO) test -c -o $@ $<
Expand Down
Loading