-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug - invalid run/call of gcovr by action when the "root" parameter is specified #510
Comments
I'm one of the gcovr maintainers, but am unaffiliated with the gcovr-action in this repository. You're correct that changing the working directory can lead to weird situations, because the There can be a difference between two calls gcovr --root foo search_path
cd search_path && gcovr --root ../foo . Due to the heuristics used by gcovr, these can produce different results. In many cases, changing the current working directory is strictly necessary. E.g. it has been reported that in many CMake builds, So the proposed solution (1) (always adding a |
Hi. Thanks for confirming my doubts. Indeed, the "working-directory" could be separated from the |
Hi @niwciu, thank you for raising this issue. In my opinion, regardless of how Gcovr should be called, any GitHub action that calls a program should have a Secondly, this action primarily abstracts Gcovr command line arguments into action inputs. Most action inputs are simply converted into the corresponding Gcovr arguments. For example, if Gcovr is expected to be called as - uses: threeal/[email protected]
with:
root: path
fail-under-line: 100 Regarding the - uses: threeal/[email protected]
with:
root: path . However, the Alternatively, we could introduce a - uses: threeal/[email protected]
with:
search-paths: . |
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.
gcovr doc
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"
The text was updated successfully, but these errors were encountered: