Codebase list golang-github-go-kit-kit / aac4204
Give up on Circle, try Drone Peter Bourgon 8 years ago
4 changed file(s) with 21 addition(s) and 47 deletion(s). Raw diff Collapse all Expand all
0 profile.cov
1 cover.out
20 examples/addsvc/addsvc
31 examples/addsvc/client/addcli/addcli
42 examples/stringsvc1/stringsvc1
53 examples/stringsvc2/stringsvc2
64 examples/stringsvc3/stringsvc3
5 gover.coverprofile
76
87 # Compiled Object files, Static and Dynamic libs (Shared Objects)
98 *.o
+0
-22
bin/coverage-circle.bash less more
0 #!/bin/bash
1
2 set -e
3
4 echo "mode: count" >| profile.cov
5
6 for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
7 do
8 if ls $dir/*.go &> /dev/null; then
9 go test -covermode=count -coverprofile=$dir/profile.tmp $dir
10 if [ -f $dir/profile.tmp ]
11 then
12 cat $dir/profile.tmp | tail -n +2 >> profile.cov
13 rm $dir/profile.tmp
14 fi
15 fi
16 done
17
18 go tool cover -func profile.cov
19
20 goveralls -coverprofile=profile.cov -service=circle-ci -repotoken=$COVERALLS_TOKEN
21
+0
-9
circle.yml less more
0 test:
1 pre:
2 - go get github.com/axw/gocov/gocov
3 - go get github.com/mattn/goveralls
4 - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
5 override:
6 - go get -v -u -d github.com/go-kit/kit/...
7 - bin/coverage-circle.bash
8
11
22 # This script runs the cover tool on all packages with test files. If you set a
33 # WEB environment variable, it will additionally open the web-based coverage
4 # visualizer for each package.
4 # visualizer for each package. If you set a COVERALLS environment variable,
5 # it will report the reults to Coveralls.io.
6
7 set -ex
58
69 function go_files { find . -name '*_test.go' ; }
710 function filter { grep -v '/_' ; }
1821
1922 PATHS=${1:-$(unique_directories)}
2023
21 function package_names {
22 for d in $PATHS
24 function report {
25 for path in $PATHS
2326 do
24 echo github.com/go-kit/kit/$d
27 go test -coverprofile=$path/cover.coverprofile ./$path
2528 done
2629 }
2730
28 function report {
29 package_names | while read pkg
30 do
31 go test -coverprofile=cover.out $pkg
32 if [ -n "${WEB+x}" ]
33 then
34 go tool cover -html=cover.out
35 fi
36 done
37 rm cover.out
31 function combine {
32 gover
33 }
34
35 function clean {
36 find . -name cover.coverprofile | xargs rm
3837 }
3938
4039 report
40 combine
41 clean
4142
43 if [ -n "${WEB+x}" ]
44 then
45 go tool cover -html=$path/cover.coverprofile
46 fi
47