mirror of
https://github.com/docker/docs.git
synced 2026-04-01 16:58:54 +07:00
- Make script/coverage runnable locally. - Move the goveralls push to travis instead of script/coverage. - Refactor code into a loop. - Properly handle packages with no tests. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
21 lines
449 B
Bash
Executable File
21 lines
449 B
Bash
Executable File
#!/bin/bash
|
|
|
|
MODE="mode: count"
|
|
ROOT=${TRAVIS_BUILD_DIR:-.}/../../..
|
|
|
|
# Grab the list of packages.
|
|
PACKAGES=`go list ./...`
|
|
|
|
# Create the empty coverage file.
|
|
echo $MODE > goverage.report
|
|
|
|
# Run coverage on every package.
|
|
for package in $PACKAGES; do
|
|
output="$ROOT/$package/coverage.out"
|
|
|
|
go test -test.short -covermode=count -coverprofile=$output $package
|
|
if [ -f "$output" ] ; then
|
|
cat "$output" | grep -v "$MODE" >> goverage.report
|
|
fi
|
|
done
|