2018-09-25 15:04:27 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -e +o pipefail
|
|
|
|
|
|
2018-09-27 22:04:04 +01:00
|
|
|
# bit too spammy
|
|
|
|
|
return
|
|
|
|
|
|
2018-09-25 15:04:27 -07:00
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
|
2019-02-27 15:02:50 +07:00
|
|
|
echo -e "NOTE: The CPU benchmarks are performed on Travis VMs and vary wildly between runs," > .benchmark.body
|
2018-09-25 15:04:27 -07:00
|
|
|
echo -e " you can't trust them. The memory benchmarks are OK\n\n" >> .benchmark.body
|
2018-09-27 10:41:02 -05:00
|
|
|
awk '/^benchmark.*old/ { printf "%s\n%s\n", "```", $0 };
|
2018-09-27 10:05:05 -05:00
|
|
|
/^$/ { print "```" };
|
|
|
|
|
/^Bench/ { print $0 };
|
|
|
|
|
END{ print "```" }' .benchmark.log >> .benchmark.body
|
2018-09-25 15:04:27 -07:00
|
|
|
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
|