mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-09 14:20:29 +00:00
Diagnostic improvements
This commit is contained in:
@@ -29,6 +29,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
|||||||
|
|
||||||
- Fix issue where x86_64 binary will be installed on AArch64 Windows even when AArch64 Windows binary available.
|
- Fix issue where x86_64 binary will be installed on AArch64 Windows even when AArch64 Windows binary available.
|
||||||
|
|
||||||
|
- Diagnostic improvements.
|
||||||
|
|
||||||
## [2.76.0] - 2026-05-04
|
## [2.76.0] - 2026-05-04
|
||||||
|
|
||||||
- Support `mdbook-d2`. ([#1737](https://github.com/taiki-e/install-action/pull/1737), thanks @nhu)
|
- Support `mdbook-d2`. ([#1737](https://github.com/taiki-e/install-action/pull/1737), thanks @nhu)
|
||||||
|
|||||||
14
action.yml
14
action.yml
@@ -22,11 +22,14 @@ runs:
|
|||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
|
bail() {
|
||||||
|
printf '::error::install-action: %s\n' "$*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
# If /bin/sh is dash, environment variable containing % is not imported, but is fine
|
# If /bin/sh is dash, environment variable containing % is not imported, but is fine
|
||||||
# because it also means that it will not be exposed to subprocess.
|
# because it also means that it will not be exposed to subprocess.
|
||||||
if /usr/bin/env | grep -Eq '^BASH_FUNC_'; then
|
if /usr/bin/env | grep -Eq '^BASH_FUNC_'; then
|
||||||
printf '::error::bash function injection via BASH_FUNC_ environment variable is not allowed for security reasons\n'
|
bail 'bash function injection via BASH_FUNC_ environment variable is not allowed for security reasons'
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
if ! command -v bash >/dev/null; then
|
if ! command -v bash >/dev/null; then
|
||||||
if grep -Eq '^ID=alpine' /etc/os-release; then
|
if grep -Eq '^ID=alpine' /etc/os-release; then
|
||||||
@@ -41,8 +44,7 @@ runs:
|
|||||||
fi
|
fi
|
||||||
printf '::endgroup::\n'
|
printf '::endgroup::\n'
|
||||||
else
|
else
|
||||||
printf '::error::install-action requires bash\n'
|
bail 'this action requires bash'
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
|
bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
|
||||||
@@ -77,10 +79,10 @@ runs:
|
|||||||
exit $code
|
exit $code
|
||||||
}
|
}
|
||||||
if ($i -lt 10) {
|
if ($i -lt 10) {
|
||||||
Write-Output "::warning::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); retrying..."
|
Write-Output "::warning::install-action: installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); retrying..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Output "::error::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); this maybe resolved by re-running job"
|
Write-Output "::error::install-action: installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); this maybe resolved by re-running job"
|
||||||
exit 1
|
exit 1
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
|
|||||||
28
main.sh
28
main.sh
@@ -28,11 +28,11 @@ retry() {
|
|||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
bail() {
|
bail() {
|
||||||
printf '::error::%s\n' "$*"
|
printf '::error::install-action: %s\n' "$*"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
warn() {
|
warn() {
|
||||||
printf '::warning::%s\n' "$*"
|
printf '::warning::install-action: %s\n' "$*"
|
||||||
}
|
}
|
||||||
info() {
|
info() {
|
||||||
printf >&2 'info: %s\n' "$*"
|
printf >&2 'info: %s\n' "$*"
|
||||||
@@ -382,7 +382,7 @@ install_cargo_binstall() {
|
|||||||
info "cargo-binstall already installed at ${cargo_bin}/cargo-binstall${exe}"
|
info "cargo-binstall already installed at ${cargo_bin}/cargo-binstall${exe}"
|
||||||
install_binstall=''
|
install_binstall=''
|
||||||
else
|
else
|
||||||
info "cargo-binstall already installed at ${cargo_bin}/cargo-binstall${exe}, but is not compatible version with install-action, upgrading"
|
info "cargo-binstall already installed at ${cargo_bin}/cargo-binstall${exe}, but is not compatible version with this action, upgrading"
|
||||||
rm -- "${cargo_bin}/cargo-binstall${exe}"
|
rm -- "${cargo_bin}/cargo-binstall${exe}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -588,8 +588,8 @@ case "${RUNNER_ARCH}" in
|
|||||||
# Does it seem only armv7l+ is supported?
|
# Does it seem only armv7l+ is supported?
|
||||||
# https://github.com/actions/runner/blob/v2.321.0/src/Misc/externals.sh#L178
|
# https://github.com/actions/runner/blob/v2.321.0/src/Misc/externals.sh#L178
|
||||||
# https://github.com/actions/runner/issues/688
|
# https://github.com/actions/runner/issues/688
|
||||||
ARM) bail "32-bit Arm runner is currently not supported by this action; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
ARM) bail "32-bit Arm runner is currently not supported; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
||||||
X86) bail "32-bit x86 runner is currently not supported by this action; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
X86) bail "32-bit x86 runner is currently not supported; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
||||||
ARM64) host_arch=aarch64 ;;
|
ARM64) host_arch=aarch64 ;;
|
||||||
PPC64LE) host_arch=powerpc64le ;;
|
PPC64LE) host_arch=powerpc64le ;;
|
||||||
RISCV64) host_arch=riscv64 ;;
|
RISCV64) host_arch=riscv64 ;;
|
||||||
@@ -598,13 +598,13 @@ case "${RUNNER_ARCH}" in
|
|||||||
info "unrecognized runner.arch '${RUNNER_ARCH}'; fallback to uname -m"
|
info "unrecognized runner.arch '${RUNNER_ARCH}'; fallback to uname -m"
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
aarch64 | arm64) host_arch=aarch64 ;;
|
aarch64 | arm64) host_arch=aarch64 ;;
|
||||||
xscale | arm | armv*l) bail "32-bit Arm runner is not supported yet by this action; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
xscale | arm | armv*l) bail "32-bit Arm runner is currently not supported; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
||||||
ppc64le) host_arch=powerpc64le ;;
|
ppc64le) host_arch=powerpc64le ;;
|
||||||
riscv64) host_arch=riscv64 ;;
|
riscv64) host_arch=riscv64 ;;
|
||||||
s390x) host_arch=s390x ;;
|
s390x) host_arch=s390x ;;
|
||||||
# Very few tools provide prebuilt binaries for these.
|
# Very few tools provide prebuilt binaries for these.
|
||||||
# TODO: fallback to `cargo install`? (binstall fallback is not good idea here as cargo-binstall doesn't provide prebuilt binaries for these.)
|
# TODO: fallback to `cargo install`? (binstall fallback is not good idea here as cargo-binstall doesn't provide prebuilt binaries for these.)
|
||||||
loongarch64 | mips | mips64 | ppc | ppc64 | sun4v) bail "$(uname -m) runner is not supported yet by this action; if you need support for this platform, please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
loongarch64 | mips | mips64 | ppc | ppc64 | sun4v) bail "$(uname -m) runner is not supported yet; please submit an issue at <https://github.com/taiki-e/install-action>" ;;
|
||||||
# GitHub Actions Runner supports x86_64/AArch64/Arm Linux and x86_64/AArch64 Windows/macOS.
|
# GitHub Actions Runner supports x86_64/AArch64/Arm Linux and x86_64/AArch64 Windows/macOS.
|
||||||
# https://github.com/actions/runner/blob/v2.332.0/.github/workflows/build.yml#L24
|
# https://github.com/actions/runner/blob/v2.332.0/.github/workflows/build.yml#L24
|
||||||
# https://docs.github.com/en/actions/reference/runners/self-hosted-runners#supported-processor-architectures
|
# https://docs.github.com/en/actions/reference/runners/self-hosted-runners#supported-processor-architectures
|
||||||
@@ -703,18 +703,18 @@ case "${host_os}" in
|
|||||||
fi
|
fi
|
||||||
printf '::endgroup::\n'
|
printf '::endgroup::\n'
|
||||||
;;
|
;;
|
||||||
*) warn "install-action requires at least jq and curl on non-Debian/Fedora/SUSE/Arch/Alpine-based Linux" ;;
|
*) warn "this action requires at least jq and curl on non-Debian/Fedora/SUSE/Arch/Alpine-based Linux" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
macos)
|
macos)
|
||||||
if ! type -P jq >/dev/null || ! type -P curl >/dev/null; then
|
if ! type -P jq >/dev/null || ! type -P curl >/dev/null; then
|
||||||
warn "install-action requires at least jq and curl on macOS"
|
warn "this action requires at least jq and curl on macOS"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
windows)
|
windows)
|
||||||
if ! type -P curl >/dev/null; then
|
if ! type -P curl >/dev/null; then
|
||||||
warn "install-action requires at least curl on Windows"
|
warn "this action requires at least curl on Windows"
|
||||||
fi
|
fi
|
||||||
if [[ -f "${install_action_dir}/jq/bin/jq.exe" ]]; then
|
if [[ -f "${install_action_dir}/jq/bin/jq.exe" ]]; then
|
||||||
jq() { "${install_action_dir}/jq/bin/jq.exe" -b "$@"; }
|
jq() { "${install_action_dir}/jq/bin/jq.exe" -b "$@"; }
|
||||||
@@ -759,7 +759,7 @@ for tool in "${tools[@]}"; do
|
|||||||
if [[ "${tool}" != 'rust' ]]; then
|
if [[ "${tool}" != 'rust' ]]; then
|
||||||
if [[ ! "${version}" =~ ^([1-9][0-9]*(\.[0-9]+(\.[0-9]+)?)?|0\.[1-9][0-9]*(\.[0-9]+)?|^0\.0\.[0-9]+)(-[0-9A-Za-z\.-]+)?$|^latest$ ]]; then
|
if [[ ! "${version}" =~ ^([1-9][0-9]*(\.[0-9]+(\.[0-9]+)?)?|0\.[1-9][0-9]*(\.[0-9]+)?|^0\.0\.[0-9]+)(-[0-9A-Za-z\.-]+)?$|^latest$ ]]; then
|
||||||
if [[ ! "${version}" =~ ^([1-9][0-9]*(\.[0-9]+(\.[0-9]+)?)?|0\.[1-9][0-9]*(\.[0-9]+)?|^0\.0\.[0-9]+)(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$|^latest$ ]]; then
|
if [[ ! "${version}" =~ ^([1-9][0-9]*(\.[0-9]+(\.[0-9]+)?)?|0\.[1-9][0-9]*(\.[0-9]+)?|^0\.0\.[0-9]+)(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$|^latest$ ]]; then
|
||||||
bail "install-action does not support semver operators: '${version}'"
|
bail "semver operators are not supported in 'tool' input option: '${version}'"
|
||||||
fi
|
fi
|
||||||
bail "install-action v2 does not support semver build-metadata: '${version}'; if you need these supports again, please submit an issue at <https://github.com/taiki-e/install-action>"
|
bail "install-action v2 does not support semver build-metadata: '${version}'; if you need these supports again, please submit an issue at <https://github.com/taiki-e/install-action>"
|
||||||
fi
|
fi
|
||||||
@@ -932,11 +932,11 @@ for tool in "${tools[@]}"; do
|
|||||||
info "installing ${tool}@${version}"
|
info "installing ${tool}@${version}"
|
||||||
case "${version}" in
|
case "${version}" in
|
||||||
latest) ;;
|
latest) ;;
|
||||||
*) warn "specifying the version of ${tool} is not supported yet by this action" ;;
|
*) warn "specifying the version of ${tool} is not supported" ;;
|
||||||
esac
|
esac
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
linux) ;;
|
linux) ;;
|
||||||
macos | windows) bail "${tool} for non-Linux is not supported yet by this action" ;;
|
macos | windows) bail "${tool} for non-Linux is not supported" ;;
|
||||||
*) bail "unsupported host OS '${host_os}' for ${tool}" ;;
|
*) bail "unsupported host OS '${host_os}' for ${tool}" ;;
|
||||||
esac
|
esac
|
||||||
# libc6-dbg is needed to run Valgrind
|
# libc6-dbg is needed to run Valgrind
|
||||||
@@ -949,7 +949,7 @@ for tool in "${tools[@]}"; do
|
|||||||
cargo-binstall)
|
cargo-binstall)
|
||||||
case "${version}" in
|
case "${version}" in
|
||||||
latest) ;;
|
latest) ;;
|
||||||
*) warn "specifying the version of ${tool} is not supported by this action" ;;
|
*) warn "specifying the version of ${tool} is not supported" ;;
|
||||||
esac
|
esac
|
||||||
install_cargo_binstall
|
install_cargo_binstall
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|||||||
Reference in New Issue
Block a user