Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 96f3f9c

Browse files
authored
Merge pull request #25 from mumoshu/codecov
repo: Enable Codecov integration
2 parents a143757 + 969c980 commit 96f3f9c

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/artifacts/template.json
22
/bin
3-
/assets
3+
/e2e/assets
44
*~
55
/config/templates.go
66
.idea/
77
.envrc
8+
coverage.txt
9+
profile.out

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ go:
33
- 1.7
44
go_import_path: github.com/coreos/kube-aws
55
script:
6-
- make test
6+
- make test-with-cover
7+
after_success:
8+
- bash <(curl -s https://codecov.io/bash)

Makefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ format:
99

1010
.PHONY: test
1111
test: build
12-
test -z "$$(find . -path ./vendor -prune -type f -o -name '*.go' -exec gofmt -d {} + | tee /dev/stderr)"
13-
go test -v $$(go list ./... | grep -v '/vendor/')
14-
go vet $$(go list ./... | grep -v '/vendor/')
12+
./test
13+
14+
.PHONY: test-with-cover
15+
test-with-cover: build
16+
./test with-cover

test

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
go test $(go list ./... | grep -v '/vendor/')
4+
default() {
5+
test -z "$(find . -path ./vendor -prune -type f -o -name '*.go' -exec gofmt -d {} + | tee /dev/stderr)"
6+
go test -v $(go list ./... | grep -v '/vendor/')
7+
go vet $(go list ./... | grep -v '/vendor/')
8+
}
9+
10+
with-cover() {
11+
test -z "$(find . -path ./vendor -prune -type f -o -name '*.go' -exec gofmt -d {} + | tee /dev/stderr)"
12+
for d in $(go list ./... | grep -v '/vendor/'); do
13+
go test -v --race -coverprofile=profile.out -covermode=atomic $d
14+
if [ -f profile.out ]; then
15+
cat profile.out >> coverage.txt
16+
rm profile.out
17+
fi
18+
done
19+
go vet $(go list ./... | grep -v '/vendor/')
20+
}
21+
22+
if [ -z ${1+x} ]; then
23+
default
24+
else
25+
"$@"
26+
fi

0 commit comments

Comments
 (0)