ソースを参照

Measure coverage of tests using codecov.io. (#123)

* Measure coverage of tests using codecov.io.

* Add codecov badge to README.md

* Recurse into packages when testing with coverage.

* Push testing kind of commands down to test.sh
Alexey Alexandrov 8 年 前
コミット
aaa60b14bd
共有4 個のファイルを変更した24 個の追加4 個の削除を含む
  1. 1
    0
      .gitignore
  2. 4
    4
      .travis.yml
  3. 1
    0
      README.md
  4. 18
    0
      test.sh

+ 1
- 0
.gitignore ファイルの表示

@@ -4,3 +4,4 @@
4 4
 *.exe
5 5
 .*.swp
6 6
 core
7
+coverage.txt

+ 4
- 4
.travis.yml ファイルの表示

@@ -15,7 +15,7 @@ script:
15 15
   - golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi
16 16
   - go tool vet -all .
17 17
   - gosimple ./...
18
-  - staticcheck ./...
19
-  - unused ./...
20
-  - go test -v ./...
21
-  - go test -v -race ./...
18
+  - ./test.sh
19
+
20
+after_success:
21
+  - bash <(curl -s https://codecov.io/bash)

+ 1
- 0
README.md ファイルの表示

@@ -1,4 +1,5 @@
1 1
 [![Build Status](https://travis-ci.org/google/pprof.svg?branch=master)](https://travis-ci.org/google/pprof)
2
+[![codecov](https://codecov.io/gh/google/pprof/graph/badge.svg)](https://codecov.io/gh/google/pprof)
2 3
 
3 4
 # Introduction
4 5
 

+ 18
- 0
test.sh ファイルの表示

@@ -0,0 +1,18 @@
1
+#!/usr/bin/env bash
2
+
3
+set -e
4
+echo "" > coverage.txt
5
+
6
+PKG=$(go list ./... | grep -v /vendor/)
7
+
8
+staticcheck $PKG
9
+unused $PKG
10
+go test -v $PKG
11
+
12
+for d in $PKG; do
13
+  go test -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