Skip to content

Update benchmark workflow #25

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
32 changes: 30 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,39 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: 'main'
path: 'main'
- name: Checkout repository
uses: actions/checkout@v3
with:
path: 'pr'

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Run benchmarks
run: go test -bench=. ./...
- name: Run benchmarks (main)
run: cd main && go test -bench=. ./... | tee benchmark_main.txt

- name: Run benchmarks (PR)
run: cd pr && go test -bench=. ./... | tee benchmark_pr.txt

- name: Compare benchmark result
uses: openpgpjs/github-action-pull-request-benchmark@v1
with:
name: 'Time benchmark'
# What benchmark tool the benchmarks.txt files came from
tool: 'go'
# Where the two output files from the benchmark tool are stored
pr-benchmark-file-path: pr/benchmark_pr.txt
base-benchmark-file-path: main/benchmark_main.txt
# A comment will be left on the latest PR commit if `alert-threshold` is exceeded
comment-on-alert: true
alert-threshold: '130%'
# Workflow will fail if `fail-threshold` is exceeded
fail-on-alert: true
fail-threshold: '150%'
# A token is needed to leave commit comments
github-token: ${{ secrets.GITHUB_TOKEN }}