cpp-linter / cpp-linter-action

A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of file-annotations, thread-comments, workflow step-summary, and Pull Request reviews.
https://cpp-linter.github.io/cpp-linter-action/
MIT License
91 stars 21 forks source link

Using a path as version will not work #242

Closed petersteneteg closed 3 months ago

petersteneteg commented 4 months ago

https://github.com/cpp-linter/cpp-linter-action/blob/08fd7830fb2e8f842c5bdb89278409f4904fa70c/action.yml#L45

does not seem to be supported?

it is used directly here https://github.com/cpp-linter/cpp-linter-action/blob/08fd7830fb2e8f842c5bdb89278409f4904fa70c/action.yml#L228

without any checks for if it is a number or path?

2bndy5 commented 4 months ago

Do you have an actual CI run that demonstrates this alleged bug?

The script/code that handles the input version is designed to pass the value through when installing the specified version fails (ie it is a path).

petersteneteg commented 4 months ago

Maybe im using it wrong but it fails here:

File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2.11.0/venv/bin/clang-tools", line 8, in <module>
Downloading clang-format (version /home/runner/work/inviwo/inviwo/llvm/bin)
    sys.exit(main())
  File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2.11.0/venv/lib/python3.10/site-packages/clang_tools/main.py", line 69, in main
    install_clang_tools(
  File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2.11.0/venv/lib/python3.10/site-packages/clang_tools/install.py", line 273, in install_clang_tools
    install_tool(tool_name, version, install_dir, no_progress_bar)
  File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2.11.0/venv/lib/python3.10/site-packages/clang_tools/install.py", line 110, in install_tool
    raise OSError(f"Failed to download {bin_name} from {bin_url}")
OSError: Failed to download bin_linux-amd64 from https://github.com/cpp-linter/clang-tools-static-binaries/releases/download/master-03a926cf/clang-format-/home/runner/work/inviwo/inviwo/llvm/bin_linux-amd64

seems like clang-tools gets invoked with the llvm path as a version argument.

https://github.com/inviwo/inviwo/actions/runs/9172440231/job/25218937016

2bndy5 commented 4 months ago

Thanks for reporting this.

I think this would technically be a bug in cpp-linter/clang-tools-pip pkg, but our action.yml could simply continue if clang-tools fails to recognize the version spec as a path.