mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-09 06:10:28 +00:00
Reduce uname usage
This commit is contained in:
@@ -54,6 +54,8 @@ runs:
|
|||||||
INPUT_FALLBACK: ${{ inputs.fallback }}
|
INPUT_FALLBACK: ${{ inputs.fallback }}
|
||||||
DEFAULT_GITHUB_TOKEN: ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
|
DEFAULT_GITHUB_TOKEN: ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
|
||||||
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
||||||
|
RUNNER_OS: ${{ runner.os }}
|
||||||
|
RUNNER_ARCH: ${{ runner.arch }}
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
# Use pwsh and retry on bash startup failure to work around windows-11-arm runner bug:
|
# Use pwsh and retry on bash startup failure to work around windows-11-arm runner bug:
|
||||||
# https://github.com/actions/partner-runner-images/issues/169
|
# https://github.com/actions/partner-runner-images/issues/169
|
||||||
@@ -88,4 +90,6 @@ runs:
|
|||||||
INPUT_FALLBACK: ${{ inputs.fallback }}
|
INPUT_FALLBACK: ${{ inputs.fallback }}
|
||||||
DEFAULT_GITHUB_TOKEN: ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
|
DEFAULT_GITHUB_TOKEN: ${{ inputs.fallback == 'cargo-binstall' && github.token || '' }}
|
||||||
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
||||||
|
RUNNER_OS: ${{ runner.os }}
|
||||||
|
RUNNER_ARCH: ${{ runner.arch }}
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
|
|||||||
27
main.sh
27
main.sh
@@ -515,10 +515,13 @@ token="${GITHUB_TOKEN:-"${GH_TOKEN:-"${DEFAULT_GITHUB_TOKEN:-}"}"}"
|
|||||||
# via `ps -Eww` on macOS. It only reduces the risk of leaks.
|
# via `ps -Eww` on macOS. It only reduces the risk of leaks.
|
||||||
unset GITHUB_TOKEN GH_TOKEN DEFAULT_GITHUB_TOKEN
|
unset GITHUB_TOKEN GH_TOKEN DEFAULT_GITHUB_TOKEN
|
||||||
|
|
||||||
# Refs: https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh
|
# Refs:
|
||||||
|
# - https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh
|
||||||
|
# - https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#runner-context
|
||||||
|
# NB: Sync with tools/ci/tool-list.sh.
|
||||||
base_distro=''
|
base_distro=''
|
||||||
exe=''
|
exe=''
|
||||||
case "$(uname -s)" in
|
case "${RUNNER_OS}" in
|
||||||
Linux)
|
Linux)
|
||||||
host_os=linux
|
host_os=linux
|
||||||
ldd_version=$(ldd --version 2>&1 || true)
|
ldd_version=$(ldd --version 2>&1 || true)
|
||||||
@@ -568,16 +571,15 @@ case "$(uname -s)" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
Darwin) host_os=macos ;;
|
macOS) host_os=macos ;;
|
||||||
MINGW* | MSYS* | CYGWIN* | Windows_NT)
|
Windows)
|
||||||
host_os=windows
|
host_os=windows
|
||||||
exe=.exe
|
exe=.exe
|
||||||
;;
|
;;
|
||||||
*) bail "unrecognized OS type '$(uname -s)'" ;;
|
*) bail "unrecognized runner.os '${RUNNER_OS}'" ;;
|
||||||
esac
|
esac
|
||||||
# NB: Sync with tools/ci/tool-list.sh.
|
case "${RUNNER_ARCH}" in
|
||||||
case "$(uname -m)" in
|
X64) host_arch=x86_64 ;;
|
||||||
aarch64 | arm64) host_arch=aarch64 ;;
|
|
||||||
# Ignore 32-bit Arm for now, as we need to consider the version and whether hard-float is supported.
|
# Ignore 32-bit Arm for now, as we need to consider the version and whether hard-float is supported.
|
||||||
# https://github.com/rust-lang/rustup/pull/593
|
# https://github.com/rust-lang/rustup/pull/593
|
||||||
# https://github.com/cross-rs/cross/pull/1018
|
# https://github.com/cross-rs/cross/pull/1018
|
||||||
@@ -586,6 +588,12 @@ case "$(uname -m)" 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 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>" ;;
|
||||||
|
ARM64) host_arch=aarch64 ;;
|
||||||
|
*)
|
||||||
|
info "unrecognized runner.arch '${RUNNER_ARCH}'; fallback to uname -m"
|
||||||
|
case "$(uname -m)" in
|
||||||
|
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 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>" ;;
|
||||||
ppc64le) host_arch=powerpc64le ;;
|
ppc64le) host_arch=powerpc64le ;;
|
||||||
riscv64) host_arch=riscv64 ;;
|
riscv64) host_arch=riscv64 ;;
|
||||||
@@ -599,9 +607,10 @@ case "$(uname -m)" in
|
|||||||
# And IBM provides runners for powerpc64le/s390x Linux.
|
# And IBM provides runners for powerpc64le/s390x Linux.
|
||||||
# https://github.com/IBM/actionspz
|
# https://github.com/IBM/actionspz
|
||||||
# So we can assume x86_64 unless it has a known non-x86_64 uname -m result.
|
# So we can assume x86_64 unless it has a known non-x86_64 uname -m result.
|
||||||
# TODO: uname -m on windows-11-arm returns "x86_64"
|
|
||||||
*) host_arch=x86_64 ;;
|
*) host_arch=x86_64 ;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
info "host platform: ${host_arch}_${host_os}"
|
info "host platform: ${host_arch}_${host_os}"
|
||||||
|
|
||||||
home="${HOME:-}"
|
home="${HOME:-}"
|
||||||
|
|||||||
Reference in New Issue
Block a user