Skip to content

Commit

Permalink
Add benchmarks results
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchen committed Aug 22, 2024
1 parent 8e408c0 commit e897a9f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,16 @@ jobs:
- name: Benchmark
run: make bench

- name: Upload benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "go"
output-file-path: benchmark.out
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: "200%"
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: "@ktrz"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Develop tools
.idea/
.vscode/


/benchmark.out
/profile.out
/coverage.out
33 changes: 15 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,21 @@ test:
.PHONY: bench
# runs benchmarks.
bench:
for d in $(BENCHFOLDER); do \
$(GO) test -benchmem -bench . -v -covermode=count -coverprofile=profile.out $$d > benchmark.out; \
cat benchmark.out; \
if grep -q "^--- FAIL" benchmark.out; then \
rm tmp.out; \
exit 1; \
elif grep -q "build failed" benchmark.out; then \
rm tmp.out; \
exit 1; \
elif grep -q "setup failed" benchmark.out; then \
rm tmp.out; \
exit 1; \
fi; \
if [ -f profile.out ]; then \
cat profile.out | grep -v "mode:" >> coverage.out; \
rm profile.out; \
fi; \
done
$(GO) test -benchmem -bench . -v -coverprofile=profile.out $(BENCHFOLDER) > benchmark.out; \
cat benchmark.out; \
if grep -q "^--- FAIL" benchmark.out; then \
rm benchmark.out; \
exit 1; \
elif grep -q "build failed" benchmark.out; then \
rm benchmark.out; \
exit 1; \
elif grep -q "setup failed" benchmark.out; then \
rm benchmark.out; \
exit 1; \
fi; \
if [ -f profile.out ]; then \
rm profile.out; \
fi; \

.PHONY: fmt
# Ensure consistent code formatting.
Expand Down

0 comments on commit e897a9f

Please # to comment.