Description
The bug is strictly related to how gcovr should be called regarding its documentation. You can find their information that the search path for coverage files is set by default to -root.
In this case, when using action without specifying "root" and "working-directory" or specifying just the "working-directory", gcovr is run with no arguments, so just like using the command "gcovr" on the local machine in the folder where you currently are. In the second case, the action is changing the working directory before running gcovr. In general, it leads to the same use case.
If you specify "path" and "working directory" it will lead to the scenario where the action will change the working directory to requested and then run gcovr with additional argument --root equal to the "root" parameter. Having in mind what's written in gcovr specification, this leads to a scenario that gcovr is not searching coverage files in the working directory but under the "path" directory that was passed as --root argument. This in turn leads to incorrect check results.
The same issue is related to the scenario where the action is used only with the "root" parameter.
Proposed solutions:
-
the fastest but not the most elegant - add a dot (".") in gcovr.ts line 58, - this way gcovr will always search for coverage files starting in the directory where action was called.
-
more in line with gcovr specification - instead of changing the working directory before running the gcovr add the working directory as a "search_paths"