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.

Home Page:https://cpp-linter.github.io/cpp-linter-action/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using a path as version will not work

petersteneteg opened this issue · comments

- This value can also be a path to where the clang tools are installed (if using a custom install location).

does not seem to be supported?

it is used directly here

if ! sudo apt-get install -y clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}; then

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

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).

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

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.