-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmark the current HEAD as well as the master branch and compare performance.
- Loading branch information
Peter Van Bouwel
committed
Jan 28, 2025
1 parent
eccf964
commit 2521bab
Showing
3 changed files
with
74 additions
and
1 deletion.
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,52 @@ | ||
# As inspired by https://dev.to/vearutop/continuous-benchmarking-with-go-and-github-actions-41ok | ||
name: bench | ||
on: | ||
pull_request: | ||
env: | ||
GO111MODULE: "on" | ||
jobs: | ||
bench: | ||
strategy: | ||
matrix: | ||
go-version: [ 1.22.x ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg | ||
key: ${{ runner.os }}-go-pkg-${{ hashFiles('**/go.mod') }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/bin/benchstat | ||
key: ${{ runner.os }}-benchstat | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
cmd/bench-main.txt | ||
# Using base sha for PR or new commit hash for main push in benchmark result key. | ||
key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} | ||
- name: Benchmark | ||
run: | | ||
make setup-test-dependencies | ||
make start-test-s3-servers | ||
REF_NAME=${GITHUB_REF##*/} make bench-current | ||
make bench-main | ||
echo "\n\n\n" | ||
export SCRIPT_OUTPUT="$(make bench-report)" | ||
- name: Add benchmark report to PR | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `${{env.SCRIPT_OUTPUT}}` | ||
}) |
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 |
---|---|---|
|
@@ -5,4 +5,6 @@ | |
|
||
testing/venv/** | ||
testing/**.err | ||
testing/**.log | ||
testing/**.log | ||
|
||
cmd/bench-*.txt |
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