Skip to content

Commit f0ac704

Browse files
committed
Improve local CI experience
1 parent 0236290 commit f0ac704

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

ci/bench/entrypoint.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
source ci/lib.sh || exit 1
44

55
mkdir -p profs
6+
67
go test --vet=off --run=^$ -bench=. \
8+
-cpuprofile=profs/cpu \
9+
-memprofile=profs/mem \
10+
-blockprofile=profs/block \
11+
-mutexprofile=profs/mutex \
712
./...
8-
# -cpuprofile=profs/cpu \
9-
# -memprofile=profs/mem \
10-
# -blockprofile=profs/block \
11-
# -mutexprofile=profs/mutex \
1213

1314
set +x
1415
echo "profiles are in ./profs

ci/run.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ function docker_run() {
1818
"${IMAGE}"
1919
}
2020

21+
function help() {
22+
set +x
23+
echo
24+
echo "$0 [-h] <step>"
25+
cat << EOF
26+
27+
If you do not pass in an explicit step, all steps will be ran in order.
28+
Pass "analyze" as the step to be put into an interactive container to analyze
29+
profiles.
30+
EOF
31+
exit 1
32+
}
33+
2134
# Use this to analyze benchmark profiles.
2235
if [[ ${1-} == "analyze" ]]; then
2336
docker run \
@@ -29,7 +42,15 @@ if [[ ${1-} == "analyze" ]]; then
2942
golang:1.12
3043
fi
3144

45+
if [[ ${1-} == "-h" || ${1-} == "--help" || ${1-} == "help" ]]; then
46+
help
47+
fi
48+
3249
if [[ $# -gt 0 ]]; then
50+
if [[ ! -d "ci/$*" ]]; then
51+
help
52+
fi
53+
3354
docker_run "ci/$*"
3455
exit 0
3556
fi

ci/test/entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ go tool cover -func=profs/coverage
1616
if [[ $CI ]]; then
1717
bash <(curl -s https://codecov.io/bash) -f profs/coverage
1818
else
19-
go tool cover -html=profs/coverage -o=coverage.html
19+
go tool cover -html=profs/coverage -o=profs/coverage.html
2020

2121
set +x
2222
echo
23-
echo "please open coverage.html to see detailed test coverage stats"
24-
echo "profiles are in ./prof/"
23+
echo "please open profs/coverage.html to see detailed test coverage stats"
2524
fi

0 commit comments

Comments
 (0)