Skip to content

Commit 6da8d5a

Browse files
shenxianpeng2bndy5
andcommitted
conditionally fallback to static binaries
Co-authored-by: Brendan <2bndy5@gmail.com>
1 parent c4d7aca commit 6da8d5a

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

action.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,36 @@ runs:
377377
^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args
378378
379379
print $"\n(ansi purple)Ensuring clang-format and clang-tidy ${{ inputs.version }} are present(ansi reset)"
380-
let tools = ['clang-format' 'clang-tidy']
380+
let version = "${{ inputs.version }}" | into int
381+
382+
$uv_args = [run --no-sync --project $action_path --directory (pwd)]
383+
if $verbosity {
384+
$uv_args = $uv_args | append '-v'
385+
}
386+
387+
mut tools = []
388+
if ("${{ inputs.tidy-checks }}" != "-*") {
389+
# clang-tidy is being used
390+
$tools = $tools | append "clang-tidy"
391+
}
392+
if ("${{ inputs.style }}" | is-not-empty) {
393+
# clang-format is being used
394+
$tools = $tools | append "clang-format"
395+
}
396+
381397
for tool in $tools {
382-
let cmd = [clang-tools-wheel --tool $tool --version ${{ inputs.version }}]
383-
$uv_args = [run --no-sync --project $action_path --directory (pwd)]
384-
if $verbosity {
385-
$uv_args = $uv_args | append '-v'
398+
print $"Installing ($tool) ($version)"
399+
let cmd = if (
400+
(($version < 13) and ($tool | str ends-with "tidy"))
401+
or (
402+
($version <= 9)
403+
and ($tool | str ends-with "format")
404+
and not ((sys host | get 'long_os_version') | str starts-with "Linux")
405+
)
406+
) {
407+
[clang-tools --tool $tool --install $version]
408+
} else {
409+
[clang-tools-wheel --tool $tool --version $version]
386410
}
387411
^$'($env.UV_INSTALL_DIR)/uv' ...$uv_args ...$cmd
388412
}

0 commit comments

Comments
 (0)