diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fceb14..ec61a02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,13 @@ jobs: run: | bash ./test.sh + - name: Upload to codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.txt + fail_ci_if_error: true + - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: diff --git a/test.sh b/test.sh index ad5cf68..cb59e60 100755 --- a/test.sh +++ b/test.sh @@ -4,7 +4,7 @@ set -e echo "" > coverage.txt for d in $(go list ./... | grep -v vendor); do - go test $d + go test -coverprofile=profile.out -covermode=atomic $d if [ -f profile.out ]; then cat profile.out | grep -v "_mock.go" >> coverage.txt rm profile.out