diff --git a/.gitignore b/.gitignore index 86b253e7eb..7c5d75d8ed 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,7 @@ gtags.conf # Delve generated file **/__debug_bin + +# go-codecov +coverage.txt +profile.out diff --git a/Makefile b/Makefile index 6f0f449b3a..d3df2405cb 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,11 @@ test-cpp: build-cpp-with-unittest @echo "Running cpp unittests..." @(env bash $(PWD)/scripts/run_cpp_unittest.sh) +# Run go-codecov +go-codecov: + @echo "Running go unittests..." + @(env bash $(PWD)/scripts/run_go_codecov.sh) + #TODO: build each component to docker docker: verifiers diff --git a/scripts/run_go_codecov.sh b/scripts/run_go_codecov.sh new file mode 100755 index 0000000000..c9d5f25a44 --- /dev/null +++ b/scripts/run_go_codecov.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./internal... | grep -v vendor); do + go test -race -coverprofile=profile.out -covermode=atomic "$d" + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done