Skip to content

Commit

Permalink
Merge pull request helm#976 from adamreese/feat/parallel-coverage
Browse files Browse the repository at this point in the history
feat(ci): run test coverage in parallel
  • Loading branch information
adamreese authored Jul 22, 2016
2 parents 1c598c2 + 870918d commit 877d9b2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ hash godir 2>/dev/null || go get github.com/Masterminds/godir

generate_cover_data() {
for d in $(godir) ; do
local output="${coverdir}/${d//\//-}.cover"
go test -coverprofile="${output}" -covermode="$covermode" "$d"
(
local output="${coverdir}/${d//\//-}.cover"
go test -coverprofile="${output}" -covermode="$covermode" "$d"
) &
done

local fails
fails=0
for job in $(jobs -p); do
wait "${job}" || let "fails+=1"
done
if (( fails != 0 )); then
echo "FAILED"
exit ${fails}
fi

echo "mode: $covermode" >"$profile"
grep -h -v "^mode:" "$coverdir"/*.cover >>"$profile"
}
Expand All @@ -40,7 +52,7 @@ push_to_coveralls() {
generate_cover_data
go tool cover -func "${profile}"

case "$1" in
case "${1-}" in
--html)
go tool cover -html "${profile}"
;;
Expand Down

0 comments on commit 877d9b2

Please sign in to comment.