Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Grcov is not working with codecov #3

Open
wdanilo opened this issue Oct 7, 2019 · 7 comments
Open

Grcov is not working with codecov #3

wdanilo opened this issue Oct 7, 2019 · 7 comments

Comments

@wdanilo
Copy link

wdanilo commented Oct 7, 2019

Hi!
Maybe I'm doing something wrong, but I spend a few hours trying to make it working, unfortunately without any luck. I don't have any errors - everything passes successfully. Could I ask you to confirm if this is a bug?

My repo's GitHub action config is here: https://github.com/luna/basegl/blob/master/.github/workflows/build.yml
And the build results are here:
https://github.com/luna/basegl/actions

As you can see, the coverage file gets generated and gets successfully passed to actions-rs/grcov. The codecov token is correct as well, however, codecov does not display any results and no errors are reported anywhere :( I'd be thankful for any hint here!

@svartalf
Copy link
Member

svartalf commented Oct 7, 2019

Hey!

Generated file does not has the .info extension, as you could see in logs:

Generated coverage report at /tmp/grcov-report-kcud6n5lg3d
::set-output name=report,::/tmp/grcov-report-kcud6n5lg3d

Here, ::set-output name=report,:: is some metadata syntax used by Github Actions (let's just ignore it) and the /tmp/grcov-report-kcud6n5lg3d is a full absolute path to the report file, you do not need to add anything to it, like you are doing here: https://github.com/luna/basegl/blob/2440f88c4a1f763a6ed82dffc584511521644147/.github/workflows/build.yml#L97

You should also check if the Docker container has an access to the /tmp folder on the host, it might be the same issue as in #1.

Also, I'm strongly suggest you to immediately revoke the token, which is hardcoded in the workflow file right now, generate a new token and store it as an Action secret instead; codecov Action page has an example of how to use secrets

@wdanilo
Copy link
Author

wdanilo commented Oct 7, 2019

@svartalf First of all, thank you so much for such a fast reply!
Secondly, that's unfortunate - I added the ".info" prefix after asking the question to check if it is the case. I already removed it and hmm, I still dont understand what is happenning, but I know more, please see this build:
https://github.com/luna/basegl/commit/9b8a529793da591494847f25573d54ec43239a73/checks?check_suite_id=255062814

It contains two shell scripts, one listing all files in /tmp, and the second printing the content of our file to screen. We can observe that the file is generated there, so that's cool. However, the content of the file seems to be only "TN:", which looks incorrect to me.

Regarding Docker access to /tmp - it could definitely be the case. I will try to move the file back to . and see what happens (I will move it because somehow the name in config is not used by grcov - please note that the repository has a grcov.yml config, but the file is still generated in /tmp: https://github.com/luna/basegl/blob/master/.github/actions-rs/grcov.yml )

Regarding the token, thanks for pointing it out. Of course, I'll re-generate it and put in secrets, it should not have been made public.

@wdanilo
Copy link
Author

wdanilo commented Oct 7, 2019

Ok, so @svartalf, it seems like you were right regarding the accesses. I modified the script so I'm copying the file from /tmp to the local fs and it is now seen by codecov ❤️

However, the last problem remains - codecov tells me "There was an error processing coverage reports.", so it seems like the generated file is incorrect. If that's true, it may be a bug of grcov rather than this repo – what do you think about it?

Still, here are some bugs in this plugin:

  1. The issue you have described should be mentioned in the main README for other people using this repo.
  2. The config file is not read properly (I had to move the file manually - see my previous post for explanation).

@svartalf Thank you once again for your assistance!

@svartalf
Copy link
Member

svartalf commented Oct 7, 2019

Well, considering that project crates found properly and the corresponding gcda/gcno files were generated by the rustc:

  Found project crates: basegl,basegl-backend-webgl,basegl-prelude,basegl-system-web
  Archiving coverage file: /home/runner/work/basegl/basegl/target/debug/deps/basegl-67aff20e1676a7ba.gcda
  Archiving coverage file: /home/runner/work/basegl/basegl/target/debug/deps/basegl-67aff20e1676a7ba.gcno
  Archiving coverage file: /home/runner/work/basegl/basegl/target/debug/deps/basegl_prelude-5816b90801e3bf39.gcda
  Archiving coverage file: /home/runner/work/basegl/basegl/target/debug/deps/basegl_prelude-5816b90801e3bf39.gcno
  Archiving coverage file: /home/runner/work/basegl/basegl/target/debug/deps/basegl_prelude-66a9e69b50116db3.gcno
  Coverage files archive was created at the /tmp/coverage-bq88ywk38mf.zip

my guess is that grcov filters out all lines for some reasons. I recall that I had the similar issue in heim recently, but it was postponed as being not so important at the moment.
There is a one interesting difference between the basegl and heim grcov.yml files: mine is missing the filter: covered line.
Maybe that's why grcov is filtering out everything — it can't match code lines with the coverage information? Could you maybe try to remove that line temporary and see how it goes?

  1. I agree that this issue about the report path should be mentioned in README, but since it was discovered just today, I was not able to do it yet (but will try to find time tomorrow).
  2. As for config file path, I just found that I mismanaged a latest release (whoops!), but it was fixed already, so a simple workflow restart should start using the output-file setting properly.

@wdanilo
Copy link
Author

wdanilo commented Oct 7, 2019

@svartalf you were right again! Removing the line filter: covered fixes the issues! Thank you so much for your fast help. Regarding the other topics:

  1. Oh, I did not notice that was discovered today as well!
  2. ❤️

@svartalf
Copy link
Member

svartalf commented Oct 7, 2019

I consider the current behavior with the filter: covered line as incorrect, because it was working for me before on Azure CI, but apparently stopped working now with this Action, so it should be investigated later.

@williamdes
Copy link

Works fine: #141 (#141 (comment))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants