Skip to content

Commit

Permalink
Remove use of goveralls and try a new way to merge cover profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
loicalbertin committed Feb 28, 2018
1 parent 9217219 commit 6f44696
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install:

script:
- make generate header format
- export PATH="$PWD/build:$PATH"; ./build/coverage.sh
- ./build/coverage.sh

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

GOTOOLS = golang.org/x/tools/cmd/stringer github.com/kardianos/govendor github.com/jteeuwen/go-bindata/... github.com/abice/go-enum github.com/google/addlicense github.com/mattn/goveralls
GOTOOLS = github.com/ystia/gocovermerge golang.org/x/tools/cmd/stringer github.com/kardianos/govendor github.com/jteeuwen/go-bindata/... github.com/abice/go-enum github.com/google/addlicense

VETARGS?=-all -asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
Expand Down Expand Up @@ -79,9 +79,4 @@ savedeps: checks
restoredeps: checks
@godep restore -v


goveralls: generate
@echo "--> Running goverall tests"
@export PATH=$$PWD/build:$$PATH; $$GOPATH/bin/goveralls -service=travis-ci -debug -v

.PHONY: buildnformat build cov checks test cover format vet tools dist goveralls
.PHONY: buildnformat build cov checks test cover format vet tools dist
15 changes: 9 additions & 6 deletions build/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${scriptDir}/..
export PATH=${scriptDir}:$PATH

pkgs=$(go list ./...)
pkgsList=$(echo "${pkgs}" | tr '\n' ',' | sed -e 's@^\(.*\),$@\1@')
rm -f coverage.txt
profDir="${scriptDir}/coverprofiles"
rm -rf ${profDir}

echo "mode: atomic" > coverage.txt
for d in ${pkgs}; do
go test -coverprofile=${scriptDir}/profile.out -covermode=atomic $d 2>&1 | grep -v "warning: no packages being tested depend on"
if [ -f ${scriptDir}/profile.out ]; then
cat ${scriptDir}/profile.out >> coverage.txt
rm ${scriptDir}/profile.out
fi
pOutName="${profDir}/profile-$(echo "$d" | tr '/' '-').out"
go test -coverprofile=${pOutName} -covermode=atomic -coverpkg="${pkgsList}" $d 2>&1 | grep -v "warning: no packages being tested depend on"
done

gocovermerge -output coverage.txt ${profDir}/*.out

0 comments on commit 6f44696

Please sign in to comment.