Skip to content

Commit 7653c20

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

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

0 commit comments

Comments
 (0)