Codebase list golang-github-go-kit-kit / b6c20f2
.travis.yml: run Coveralls, as Drone is gone Also, update the script used to do so. Peter Bourgon 6 years ago
3 changed file(s) with 41 addition(s) and 51 deletion(s). Raw diff Collapse all Expand all
00 language: go
11
2 script: go test -race -v ./...
2 before_install:
3 - go get github.com/mattn/goveralls
4 - go get github.com/modocache/gover
5
6 script:
7 - go test -race -v ./...
8 - ./coveralls.bash
39
410 go:
5 - 1.7.x
6 - 1.8.x
7 - tip
11 - 1.7.x
12 - 1.8.x
13 - tip
+0
-47
coverage.bash less more
0 #!/usr/bin/env bash
1
2 # This script runs the cover tool on all packages with test files. If you set a
3 # WEB environment variable, it will additionally open the web-based coverage
4 # visualizer for each package.
5
6 set -e
7
8 function go_files { find . -name '*_test.go' ; }
9 function filter { grep -v '/_' ; }
10 function remove_relative_prefix { sed -e 's/^\.\///g' ; }
11
12 function directories {
13 go_files | filter | remove_relative_prefix | while read f
14 do
15 dirname $f
16 done
17 }
18
19 function unique_directories { directories | sort | uniq ; }
20
21 PATHS=${1:-$(unique_directories)}
22
23 function report {
24 for path in $PATHS
25 do
26 go test -coverprofile=$path/cover.coverprofile ./$path
27 done
28 }
29
30 function combine {
31 gover
32 }
33
34 function clean {
35 find . -name cover.coverprofile | xargs rm
36 }
37
38 report
39 combine
40 clean
41
42 if [ -n "${WEB+x}" ]
43 then
44 go tool cover -html=gover.coverprofile
45 fi
46
0 #!/usr/bin/env bash
1
2 if ! type -P gover
3 then
4 echo gover missing: go get github.com/modocache/gover
5 exit 1
6 fi
7
8 if ! type -P goveralls
9 then
10 echo goveralls missing: go get github.com/mattn/goveralls
11 exit 1
12 fi
13
14 if [[ "$COVERALLS_TOKEN" == "" ]]
15 then
16 echo COVERALLS_TOKEN not set
17 exit 1
18 fi
19
20 go list ./... | grep -v '/examples/' | cut -d'/' -f 4- | while read d
21 do
22 cd $d
23 go test -covermode count -coverprofile coverage.coverprofile
24 cd -
25 done
26
27 gover
28 goveralls -coverprofile gover.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN
29 find . -name '*.coverprofile' -delete
30