diff --git a/README.md b/README.md index 385f9f4..e598fda 100644 --- a/README.md +++ b/README.md @@ -188,13 +188,12 @@ Otherwise, [nushell] and/or the LLVM-provided bash script will fail to run. ### On macOS runners The specified `version` of `clang-format` and `clang-tidy` is installed via Homebrew. -Failing that, we attempt to use static binaries that we built ourselves; -see [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more detail. +Failing that, we attempt to use Python wheel that we built ourselves; see [cpp-linter/clang-tools-pip] project for more detail. ### On Windows runners -For Windows runners, we only use clang tools built as static binaries. -See [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more detail. +For Windows runners, we only use clang tools Python wheels. +See [cpp-linter/clang-tools-pip] project for more detail. ## License @@ -203,7 +202,6 @@ The scripts and documentation in this project are released under the [MIT Licens [nushell]: https://www.nushell.sh/ [uv]: https://docs.astral.sh/uv/ [cpp-linter/clang-tools-pip]: https://github.com/cpp-linter/clang-tools-pip -[cpp-linter/clang-tools-static-binaries]: https://github.com/cpp-linter/clang-tools-static-binaries [gh-container-syntax]: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idcontainer diff --git a/action.yml b/action.yml index ac154ae..013774e 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,7 @@ inputs: description: | The desired version of the [clang-tools](https://github.com/cpp-linter/clang-tools-pip) to use. Accepted options are strings which can be 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10 or 9. + clang-tidy only supports versions 13 and above. - Set this option to a blank string (`''`) to use the platform's default installed version. - This value can also be a path to where the clang tools are installed (if using a custom install location). @@ -377,12 +378,44 @@ runs: ^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args print $"\n(ansi purple)Ensuring clang-format and clang-tidy ${{ inputs.version }} are present(ansi reset)" - let cmd = [clang-tools -i ${{ inputs.version }} -b] + let version_str = "${{ inputs.version }}" + if ($version_str | is-empty) { + print $"(ansi yellow)Using platform default clang tools \(version not specified)(ansi reset)" + exit 0 + } + let version = $version_str | into int + $uv_args = [run --no-sync --project $action_path --directory (pwd)] if $verbosity { $uv_args = $uv_args | append '-v' } - ^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args ...$cmd + + mut tools = [] + if ("${{ inputs.tidy-checks }}" != "-*") { + # clang-tidy is being used + $tools = $tools | append "clang-tidy" + } + if ("${{ inputs.style }}" | is-not-empty) { + # clang-format is being used + $tools = $tools | append "clang-format" + } + + for tool in $tools { + print $"Installing ($tool) ($version)" + let cmd = if ( + (($version < 13) and ($tool | str ends-with "tidy")) + or ( + ($version <= 9) + and ($tool | str ends-with "format") + and not ((sys host | get 'long_os_version') | str starts-with "Linux") + ) + ) { + [clang-tools --tool $tool --install $version] + } else { + [clang-tools-wheel --tool $tool --version $version] + } + ^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args ...$cmd + } - name: Run cpp-linter id: cpp-linter