jandelgado / gcov2lcov-action

Github action to convert go coverage files to lcov format
MIT License
22 stars 2 forks source link

I don't think -coverpkg=./... is handled well. #2

Closed arvenil closed 4 years ago

arvenil commented 4 years ago

codecov: 82% coveralls: 48% https://github.com/arvenil/kata

go test -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic ./...

Note -coverpkg=./.... This results in below file (I cut it only to show line 14 of templates.go file):

$ cat coverage.txt | grep templates.go:14
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 0
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 0
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 1
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 0
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 0
github.com/arvenil/kata/format/templates/templates.go:14.37,19.17 5 0

As you may see, for example, line 14 is visible there several times with different count. This tool converts it to:

DA:14,0
DA:14,0
DA:14,1
DA:14,0
DA:14,0
DA:14,0

And then coveralls doesn't seem to handle it and shows ZERO coverage when there was exactly one pass. Maybe this tool should sum such entries, and as so coveralls would show correct value, or maybe it's a bug worth reporting to coveralls?

jandelgado commented 4 years ago

Thanks for the report. Could you please open the issue in the "https://github.com/jandelgado/gcov2lcov" project, since this does the actual conversion?

jandelgado commented 4 years ago

I have a fix ready to test. Please test with:

  - name: Convert coverage to lcov
      uses: jandelgado/gcov2lcov-action@8def3626a8d83b1304867dc031b6729eb733e993

If it works, I'll release it

jandelgado commented 4 years ago

I think I've found & fixed the problem, please retry with this version

- name: Convert coverage to lcov
      uses: jandelgado/gcov2lcov-action@c760baabceadcd9ab34f1a5244f0db8472abd6db

fixed by https://github.com/jandelgado/gcov2lcov/pull/4

Thanks -jan