Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce benchmarks action
Browse files Browse the repository at this point in the history
As suggested here: timbray#119 (comment)
yosiat committed Oct 12, 2022
1 parent 33c3d57 commit 56af859
Showing 2 changed files with 60 additions and 0 deletions.
Empty file added .github/benchmarks/.keep
Empty file.
60 changes: 60 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Benchmarks

on:
push:
branches: ["main"]

pull_request:
branches: ["main"]

permissions:
contents: write
deployments: write

jobs:
benchmark:
name: Benchmarks
strategy:
matrix:
go-version: ["1.18"]
platform: ["ubuntu-latest"]

runs-on: ${{ matrix.platform }}
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Run benchmark
run: go test -benchmem -run="^$" -bench "^Benchmark" . github.com/timbray/quamina | tee .github/benchmarks/output.txt

- name: Download previous benchmark data
uses: actions/cache@v1
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Go Benchmark
tool: "go"

# Compare results against json from cache
output-file-path: .github/benchmarks/output.txt
external-data-json-path: ./cache/benchmark-data.json

# Alert on regression of more than 20% and commit this
alert-threshold: "20%"
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true

# Disable github pages, for now.
auto-push: false

0 comments on commit 56af859

Please sign in to comment.