Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
e66e1443
Commit
e66e1443
authored
Jul 07, 2016
by
Adam Reese
Committed by
GitHub
Jul 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #940 from adamreese/feat/coveralls
feat(ci): setup test coverage reports with coveralls.io
parents
b080e944
ebffaadb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
23 deletions
+45
-23
ci.sh
scripts/ci.sh
+17
-8
coverage.sh
scripts/coverage.sh
+28
-15
No files found.
scripts/ci.sh
View file @
e66e1443
...
...
@@ -22,13 +22,22 @@ IFS=$'\n\t'
HELM_ROOT
=
"
${
BASH_SOURCE
[0]%/*
}
/.."
cd
"
$HELM_ROOT
"
case
"
${
CIRCLE_NODE_INDEX
-0
}
"
in
0
)
echo
"Running 'make test-unit'"
run_unit_test
()
{
if
[[
"
${
CIRCLE_BRANCH
-
}
"
==
"master"
]]
;
then
echo
"Running unit tests with coverage'"
./scripts/coverage.sh
--coveralls
else
echo
"Running unit tests'"
make test-unit
;;
1
)
echo
"Running 'make test-style'"
make test-style
;;
fi
}
run_style_check
()
{
echo
"Running 'make test-style'"
make test-style
}
case
"
${
CIRCLE_NODE_INDEX
-0
}
"
in
0
)
run_unit_test
;;
1
)
run_style_check
;;
esac
scripts/coverage.sh
View file @
e66e1443
...
...
@@ -16,22 +16,35 @@
set
-euo
pipefail
COVERDIR
=
${
COVERDIR
:-
.coverage
}
COVERMODE
=
${
COVERMODE
:-
atomic
}
PACKAGES
=(
$(
go list
$(
glide novendor
))
)
covermode
=
${
COVERMODE
:-
atomic
}
coverdir
=
$(
mktemp
-d
/tmp/coverage.XXXXXXXXXX
)
profile
=
"
${
coverdir
}
/cover.out"
if
[[
!
-d
"
$COVERDIR
"
]]
;
then
mkdir
-p
"
$COVERDIR
"
fi
hash
goveralls 2>/dev/null
||
go get github.com/mattn/goveralls
echo
"mode:
${
COVERMODE
}
"
>
"
${
COVERDIR
}
/coverage.out"
generate_cover_data
()
{
for
d
in
$(
godir
)
;
do
local
output
=
"
${
coverdir
}
/
${
d
//\//-
}
.cover"
go
test
-coverprofile
=
"
${
output
}
"
-covermode
=
"
$covermode
"
"
$d
"
done
for
d
in
"
${
PACKAGES
[@]
}
"
;
do
go
test
-coverprofile
=
profile.out
-covermode
=
"
$COVERMODE
"
"
$d
"
if
[
-f
profile.out
]
;
then
sed
"/mode:
$COVERMODE
/d"
profile.out
>>
"
${
COVERDIR
}
/coverage.out"
rm
profile.out
fi
done
echo
"mode:
$covermode
"
>
"
$profile
"
grep
-h
-v
"^mode:"
"
$coverdir
"
/
*
.cover
>>
"
$profile
"
}
push_to_coveralls
()
{
goveralls
-coverprofile
=
"
${
profile
}
"
-service
=
circle-ci
}
generate_cover_data
go tool cover
-func
"
${
profile
}
"
case
"
$1
"
in
--html
)
go tool cover
-html
"
${
profile
}
"
;;
--coveralls
)
push_to_coveralls
;;
esac
go tool cover
-html
"
${
COVERDIR
}
/coverage.out"
-o
"
${
COVERDIR
}
/coverage.html"
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