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
ebffaadb
Commit
ebffaadb
authored
Jul 07, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ci): setup test coverage reports with coveralls.io
parent
b080e944
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
21 deletions
+43
-21
ci.sh
scripts/ci.sh
+15
-6
coverage.sh
scripts/coverage.sh
+28
-15
No files found.
scripts/ci.sh
View file @
ebffaadb
...
@@ -22,13 +22,22 @@ IFS=$'\n\t'
...
@@ -22,13 +22,22 @@ IFS=$'\n\t'
HELM_ROOT
=
"
${
BASH_SOURCE
[0]%/*
}
/.."
HELM_ROOT
=
"
${
BASH_SOURCE
[0]%/*
}
/.."
cd
"
$HELM_ROOT
"
cd
"
$HELM_ROOT
"
case
"
${
CIRCLE_NODE_INDEX
-0
}
"
in
run_unit_test
()
{
0
)
if
[[
"
${
CIRCLE_BRANCH
-
}
"
==
"master"
]]
;
then
echo
"Running 'make test-unit'"
echo
"Running unit tests with coverage'"
./scripts/coverage.sh
--coveralls
else
echo
"Running unit tests'"
make test-unit
make test-unit
;;
fi
1
)
}
run_style_check
()
{
echo
"Running 'make test-style'"
echo
"Running 'make test-style'"
make test-style
make test-style
;;
}
case
"
${
CIRCLE_NODE_INDEX
-0
}
"
in
0
)
run_unit_test
;;
1
)
run_style_check
;;
esac
esac
scripts/coverage.sh
View file @
ebffaadb
...
@@ -16,22 +16,35 @@
...
@@ -16,22 +16,35 @@
set
-euo
pipefail
set
-euo
pipefail
COVERDIR
=
${
COVERDIR
:-
.coverage
}
covermode
=
${
COVERMODE
:-
atomic
}
COVERMODE
=
${
COVERMODE
:-
atomic
}
coverdir
=
$(
mktemp
-d
/tmp/coverage.XXXXXXXXXX
)
PACKAGES
=(
$(
go list
$(
glide novendor
))
)
profile
=
"
${
coverdir
}
/cover.out"
if
[[
!
-d
"
$COVERDIR
"
]]
;
then
hash
goveralls 2>/dev/null
||
go get github.com/mattn/goveralls
mkdir
-p
"
$COVERDIR
"
fi
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
echo
"mode:
$covermode
"
>
"
$profile
"
go
test
-coverprofile
=
profile.out
-covermode
=
"
$COVERMODE
"
"
$d
"
grep
-h
-v
"^mode:"
"
$coverdir
"
/
*
.cover
>>
"
$profile
"
if
[
-f
profile.out
]
;
then
}
sed
"/mode:
$COVERMODE
/d"
profile.out
>>
"
${
COVERDIR
}
/coverage.out"
rm
profile.out
push_to_coveralls
()
{
fi
goveralls
-coverprofile
=
"
${
profile
}
"
-service
=
circle-ci
done
}
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