2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-04-22 16:50:18 +08:00

Add github workflow to benchmark incoming change against master

This commit is contained in:
Ken Hibino 2021-01-29 15:49:49 -08:00
parent 3c2b2cf4a3
commit 6f82a44337
2 changed files with 89 additions and 0 deletions

86
.github/workflows/benchstat.yml vendored Normal file
View File

@ -0,0 +1,86 @@
# This workflow runs benchmarks against the current branch, compares them to benchmarks against
# master, and uploads the results as an artifact.
# TODO: This workflow could be improved by only running on pull requests and then posting the results back
# as a comment in the pull request.
name: Benchstat
on: [push, pull_request]
jobs:
incoming:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:637
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- name: Checkout
uses: actions/checkout@v2
- name: Benchmark
run: |
for i in {1..5}; do
go test -run=^$ -bench=. ./... | tee -a bench.txt
done
- name: Upload Benchmark
uses: actions/upload-artifact@v2
with:
name: bench-incoming
path: bench.txt
current:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:637
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
- name: Benchmark
run: |
for i in {1..5}; do
go test -run=^$ -bench=. ./... | tee -a bench.txt
done
- name: Upload Benchmark
uses: actions/upload-artifact@v2
with:
name: bench-current
path: bench.txt
benchstat:
needs: [incoming, current]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- name: Install benchstat
run: go get -u golang.org/x/perf/cmd/benchstat
- name: Download Incoming
uses: actions/download-artifact@v2
with:
name: bench-incoming
- name: Download Current
uses: actions/download-artifact@v2
with:
name: bench-current
- name: Benchstat Results
run: benchstat bench-current/bench.txt bench-incoming/bench.txt | tee -a benchstat.txt
- name: Upload benchstat results
uses: actions/upload-artifact@v2
with:
name: benchstat
path: benchstat.txt

View File

@ -28,3 +28,6 @@ jobs:
- name: Test - name: Test
run: go test -race -v ./... run: go test -race -v ./...
- name: Bench Test
run: go test -run=^$ -bench=. -loglevel=debug ./...