aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.benchmark.sh13
-rw-r--r--.travis.yml1
-rw-r--r--Makefile2
3 files changed, 15 insertions, 1 deletions
diff --git a/.benchmark.sh b/.benchmark.sh
new file mode 100644
index 000000000..97a3af949
--- /dev/null
+++ b/.benchmark.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+set -e +o pipefail
+
+if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
+ echo -e "NOTE: The CPU benchmarks are performed on Travis VMs and vary widly between runs," > .benchmark.body
+ echo -e " you can't trust them. The memory benchmarks are OK\n\n" >> .benchmark.body
+ cat .benchmark.log >> .benchmark.body
+ jq -n --arg body "$(cat .benchmark.body)" '{body: $body}' > .benchmark.json
+ curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
+ --data-binary "@.benchmark.json" \
+ "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments"
+fi
diff --git a/.travis.yml b/.travis.yml
index ef914d237..e056946a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,3 +46,4 @@ script:
after_success:
- bash <(curl -s https://codecov.io/bash)
+ - bash .benchmark.sh
diff --git a/Makefile b/Makefile
index 9c430a4f6..b9d36ea23 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ ifeq ($(TEST_TYPE),benchmark)
( cd request; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
( cd core; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
( cd coremain; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
- if command -v benchcmp; then benchcmp old new ; fi
+ if command -v benchcmp; then benchcmp old new > .benchmark.log ; cat .benchmark.log ; fi
git checkout -
endif