-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add benchmark action that leaves comment on PR (#588)
* better benchmarks benchmark each detector with negative and positive inputs * add benchmark action that leaves comment on PR
- Loading branch information
1 parent
c6c5e4f
commit 7798415
Showing
2 changed files
with
283 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Run benchmarks | ||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
benchmark: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5.0.2 | ||
with: | ||
go-version-file: 'go.mod' | ||
- run: go install golang.org/x/perf/cmd/benchstat@latest | ||
// Base for comparison is master branch. | ||
- name: Checkout code | ||
uses: actions/checkout@v4.1.7 | ||
with: | ||
ref: master | ||
- run: go test -run=none -bench=. --count=7 > /tmp/prev & | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4.1.7 | ||
- run: go test -run=none -bench=. --count=7 > /tmp/curr & | ||
|
||
// Wait for both benchmarks to complete before comparing. | ||
- run: wait | ||
- run: RESULT="$(benchstat /tmp/prev /tmp/curr)" | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: $RESULT | ||
}) |
Oops, something went wrong.