2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-25 07:12:17 +08:00

Run and compare benchmarks after successful ci-build

This commit is contained in:
Ken Hibino 2020-01-30 20:37:28 -08:00
parent 36af486303
commit 9ae4be8184
2 changed files with 17 additions and 0 deletions

View File

@ -7,3 +7,5 @@ env:
go: [1.12.x, 1.13.x]
services:
- redis-server
after_success:
- bash ./.travis/benchcmp.sh

15
.travis/benchcmp.sh Executable file
View File

@ -0,0 +1,15 @@
if [ "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" != "master" ]; then
REMOTE_URL="$(git config --get remote.origin.url)";
cd ${TRAVIS_BUILD_DIR}/.. && \
git clone ${REMOTE_URL} "${TRAVIS_REPO_SLUG}-bench" && \
cd "${TRAVIS_REPO_SLUG}-bench" && \
# Benchmark master
git checkout master && \
go test -run=XXX -bench=. ./... > master.txt && \
# Benchmark feature branch
git checkout ${TRAVIS_COMMIT} && \
go test -run=XXX -bench=. ./... > feature.txt && \
go get -u golang.org/x/tools/cmd/benchcmp && \
# compare two benchmarks
benchcmp master.txt feature.txt;
fi