Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
e86a535c
Unverified
Commit
e86a535c
authored
Aug 13, 2019
by
Steven Allen
Committed by
GitHub
Aug 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #175 from ipfs/ci/circle
ci: switch to circle
parents
e72b2894
43cd2cad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
0 deletions
+134
-0
.circleci/config.yml
.circleci/config.yml
+134
-0
No files found.
.circleci/config.yml
0 → 100644
View file @
e86a535c
version
:
2.1
orbs
:
ci-go
:
ipfs/ci-go@0.1
commands
:
benchcmp
:
parameters
:
before
:
description
:
"
File
containing
the
old
benchmarks."
type
:
string
after
:
description
:
"
File
containing
the
new
benchmarks."
type
:
string
tolerance
:
description
:
"
Tolerable
slowdown
(%)."
type
:
integer
default
:
25
environment
:
BEFORE
:
<< parameters.before >>
AFTER
:
<< parameters.after >>
steps
:
-
run
:
name
:
"
Comparing
benchmarks."
command
:
|
parse() {
sed -n \
-e 's/ *\t */\t/g' \
-e '/^Benchmark/p' |
awk 'BEGIN{print "{\"results\": ["} {print " {\"name\": \"",$1,"\", \"time\": ",$3," },"} END{print "]}"}' OFS="" ORS=" "|
sed -e 's/, ]/ ]/g' |
jq '.results[] | {name: .name, time: .time }'
}
benchcmp "$BEFORE" "$AFTER"
echo ""
echo "Result:"
{
parse < "$BEFORE"
parse < "$AFTER"
} | jq -e -r -s 'group_by(.name)[] | {name: .[0].name, speedup: (.[0].time / .[1].time)} | select(.speedup < (100 - << parameters.tolerance >>)/100) | "\(.name)\t\(.speedup)x"'
if [[ $? -ne 4 ]]; then
echo ""
echo "FAIL"
exit 1
else
echo "PASS"
fi
benchmark
:
parameters
:
output
:
description
:
"
File
to
write
the
results
to."
type
:
string
branch
:
description
:
"
Branch
to
benchmark."
type
:
string
default
:
HEAD
command
:
description
:
"
Benchmark
command."
type
:
string
default
:
go test -run=NONE -bench=. ./...
steps
:
-
run
:
name
:
Check out << parameters.branch >>
command
:
|
mkdir /tmp/benchmark
git --work-tree=/tmp/benchmark checkout << parameters.branch >>
-
run
:
name
:
"
Benchmarking"
command
:
|
{
<< parameters.command >>
} | tee << parameters.output >>
working_directory
:
/tmp/benchmark
environment
:
IPFS_LOGGING
:
critical
-
run
:
when
:
always
name
:
Cleanup
command
:
rm -rf /tmp/benchmark
jobs
:
benchmark
:
parameters
:
tolerance
:
description
:
"
Tolerable
slowdown
(%)."
type
:
integer
default
:
25
baseline
:
description
:
"
Baseline
branch
to
which
to
compare
(if
any)."
type
:
string
default
:
"
"
command
:
description
:
"
Benchmark
command."
type
:
string
default
:
go test -run=NONE -bench=. ./...
executor
:
ci-go/default
steps
:
-
checkout
-
ci-go/restore-cache
-
benchmark
:
command
:
<< parameters.command >>
branch
:
master
output
:
~/benchmark-before.txt
-
benchmark
:
command
:
<< parameters.command >>
output
:
~/benchmark-after.txt
-
benchcmp
:
before
:
~/benchmark-before.txt
after
:
~/benchmark-after.txt
tolerance
:
<< parameters.tolerance >>
-
when
:
condition
:
<< parameters.baseline >>
steps
:
-
benchmark
:
command
:
<< parameters.command >>
branch
:
<< parameters.baseline >>
output
:
~/benchmark-baseline.txt
-
benchcmp
:
before
:
~/benchmark-baseline.txt
after
:
~/benchmark-after.txt
tolerance
:
<< parameters.tolerance >>
-
ci-go/save-cache
workflows
:
version
:
2
test
:
jobs
:
-
ci-go/build
-
ci-go/lint
-
ci-go/test
-
benchmark
:
require
:
ci-go/test
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment