aboutsummaryrefslogtreecommitdiff
path: root/.benchmark.sh
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2018-09-25 15:04:27 -0700
committerGravatar GitHub <noreply@github.com> 2018-09-25 15:04:27 -0700
commita0396e267321ac7e0854b90fd9d882fe41be9048 (patch)
treee9960a294a98aa2bc5c8cb9d330f6f14f69f1190 /.benchmark.sh
parent8d4378d7123079c58b32365c4f7dccca4870a236 (diff)
downloadcoredns-a0396e267321ac7e0854b90fd9d882fe41be9048.tar.gz
coredns-a0396e267321ac7e0854b90fd9d882fe41be9048.tar.zst
coredns-a0396e267321ac7e0854b90fd9d882fe41be9048.zip
Add benchmark result to GitHub PR (#2123)
* Add benchmark result to GitHub PR Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Post benchmark to comments Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Test Stuff Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update using jq. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to '.benchmark.sh')
-rw-r--r--.benchmark.sh13
1 files changed, 13 insertions, 0 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