Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
ci(travis): redo benchmarks with travis
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Jun 23, 2019
1 parent a33adb2 commit 4d3ce76
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 120 deletions.
119 changes: 0 additions & 119 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install:

script:
- bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh)

- ./bin/run-benchmarks.sh

cache:
directories:
Expand Down
7 changes: 7 additions & 0 deletions bin/benchmark-to-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
output="$1"
branch="$2"

git checkout "$2"

IPFS_LOGGING=critical go test -run=NONE -bench=. ./... | tee "$1"
1 change: 1 addition & 0 deletions bin/diff-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ echo "Result:"
{
parse < "$1"
parse < "$2"
echo "DONE"
} | jq -e -r -s 'group_by(.name)[] | {name: .[0].name, speedup: (.[1].time / .[0].time)} | select(.speedup < 0.90) | "\(.name)\t\(.speedup)x"'

if [[ $? -ne 4 ]]; then
Expand Down
40 changes: 40 additions & 0 deletions bin/run-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -eo pipefail

display_and_run() {
echo "***" "$@"
eval $(printf '%q ' "$@")
}

# reset workdir to state from git (to remove possible rewritten dependencies)
display_and_run git reset --hard

# Environment
echo "*** Setting up test environment"
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$TRAVIS_SUDO" == true ]]; then
# Ensure that IPv6 is enabled.
# While this is unsupported by TravisCI, it still works for localhost.
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
fi
else
# OSX has a default file limit of 256, for some tests we need a
# maximum of 8192.
ulimit -Sn 8192
fi

export GO111MODULE=on
display_and_run go mod download
git checkout -b after
git fetch origin master:refs/remotes/origin/before
git checkout remotes/origin/before
git checkout -b before
git checkout after
display_and_run ./bin/benchmark-to-file.sh benchmark-before.txt before
git checkout after
display_and_run ./bin/benchmark-to-file.sh benchmark-after.txt after
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
display_and_run ./bin/diff-benchmarks.sh benchmark-before.txt benchmark-after.txt
fi

0 comments on commit 4d3ce76

Please sign in to comment.