mirror of
https://github.com/taiki-e/install-action.git
synced 2025-12-27 01:54:13 -05:00
Improve support for SUSE/Arch based containers/self-hosted runners
This commit is contained in:
1
.github/.cspell/project-dictionary.txt
vendored
1
.github/.cspell/project-dictionary.txt
vendored
@@ -1,4 +1,5 @@
|
||||
almalinux
|
||||
archlinux
|
||||
bindgen
|
||||
binstall
|
||||
coreutils
|
||||
|
||||
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -103,12 +103,15 @@ jobs:
|
||||
- debian:10-slim # glibc 2.28
|
||||
- debian:11-slim # glibc 2.31
|
||||
- debian:12-slim # glibc 2.36
|
||||
- fedora:latest # glibc 2.37 (as of fedora 38)
|
||||
- fedora:latest # glibc 2.38 (as of fedora 39)
|
||||
- almalinux:8 # glibc 2.28
|
||||
- almalinux:8-minimal # glibc 2.28
|
||||
- almalinux:9 # glibc 2.34
|
||||
- almalinux:9-minimal # glibc 2.34
|
||||
- centos:7 # glibc 2.17
|
||||
- opensuse/leap:latest # glibc 2.31 (as of leap 15.5)
|
||||
- opensuse/tumbleweed:latest # glibc 2.39 (as of 2024-04-18)
|
||||
- archlinux:latest # glibc 2.38 (as of 2024-04-18)
|
||||
- alpine:latest # musl 1.2.4 (as of alpine 3.19)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
@@ -126,6 +129,15 @@ jobs:
|
||||
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --no-modify-path
|
||||
echo "$HOME/.cargo/bin" >>"${GITHUB_PATH}"
|
||||
if: startsWith(matrix.container, 'fedora') || startsWith(matrix.container, 'almalinux') || startsWith(matrix.container, 'centos')
|
||||
- name: Install requirements (opensuse)
|
||||
run: |
|
||||
set -eEuxo pipefail
|
||||
zypper install -y rustup
|
||||
rustup toolchain add stable --profile minimal
|
||||
if: startsWith(matrix.container, 'opensuse')
|
||||
- name: Install requirements (archlinux)
|
||||
run: pacman -Sy --noconfirm rust
|
||||
if: startsWith(matrix.container, 'archlinux')
|
||||
- name: Install requirements (alpine)
|
||||
run: apk --no-cache add bash cargo
|
||||
shell: sh
|
||||
|
||||
@@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Improve support for SUSE/Arch based containers/self-hosted runners.
|
||||
|
||||
## [2.32.20] - 2024-04-17
|
||||
|
||||
- Update `cargo-hack@latest` to 0.6.28.
|
||||
|
||||
@@ -147,7 +147,7 @@ See the linked documentation for information on security when installed using [s
|
||||
|
||||
## Compatibility
|
||||
|
||||
This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine, Fedora, CentOS, Alma).
|
||||
This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Fedora, CentOS, Alma, openSUSE, Arch, Alpine).
|
||||
To use this action in self-hosted runners or in containers, at least the following tools are required:
|
||||
|
||||
- bash
|
||||
|
||||
52
main.sh
52
main.sh
@@ -87,12 +87,23 @@ download_and_extract() {
|
||||
|
||||
local tar_args=()
|
||||
case "${url}" in
|
||||
*.tar.gz | *.tgz) tar_args+=("xzf") ;;
|
||||
*.tar.gz | *.tgz)
|
||||
tar_args+=("xzf")
|
||||
if ! type -P gzip &>/dev/null; then
|
||||
case "${base_distro}" in
|
||||
debian | fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (gzip)"
|
||||
sys_install gzip
|
||||
echo "::endgroup::"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
*.tar.bz2 | *.tbz2)
|
||||
tar_args+=("xjf")
|
||||
if ! type -P bzip2 &>/dev/null; then
|
||||
case "${base_distro}" in
|
||||
debian | alpine | fedora)
|
||||
debian | fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (bzip2)"
|
||||
sys_install bzip2
|
||||
echo "::endgroup::"
|
||||
@@ -109,7 +120,7 @@ download_and_extract() {
|
||||
sys_install xz-utils
|
||||
echo "::endgroup::"
|
||||
;;
|
||||
alpine | fedora)
|
||||
fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (xz)"
|
||||
sys_install xz
|
||||
echo "::endgroup::"
|
||||
@@ -120,7 +131,7 @@ download_and_extract() {
|
||||
*.zip)
|
||||
if ! type -P unzip &>/dev/null; then
|
||||
case "${base_distro}" in
|
||||
debian | alpine | fedora)
|
||||
debian | fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (unzip)"
|
||||
sys_install unzip
|
||||
echo "::endgroup::"
|
||||
@@ -311,6 +322,15 @@ apt_remove() {
|
||||
snap_install() {
|
||||
retry _sudo snap install "$@"
|
||||
}
|
||||
dnf_install() {
|
||||
retry _sudo "${dnf}" install -y "$@"
|
||||
}
|
||||
zypper_install() {
|
||||
retry _sudo zypper install -y "$@"
|
||||
}
|
||||
pacman_install() {
|
||||
retry _sudo pacman -Sy --noconfirm "$@"
|
||||
}
|
||||
apk_install() {
|
||||
if type -P sudo &>/dev/null; then
|
||||
sudo apk --no-cache add "$@"
|
||||
@@ -320,14 +340,13 @@ apk_install() {
|
||||
apk --no-cache add "$@"
|
||||
fi
|
||||
}
|
||||
dnf_install() {
|
||||
retry _sudo "${dnf}" install -y "$@"
|
||||
}
|
||||
sys_install() {
|
||||
case "${base_distro}" in
|
||||
debian) apt_install "$@" ;;
|
||||
alpine) apk_install "$@" ;;
|
||||
fedora) dnf_install "$@" ;;
|
||||
suse) zypper_install "$@" ;;
|
||||
arch) pacman_install "$@" ;;
|
||||
alpine) apk_install "$@" ;;
|
||||
esac
|
||||
}
|
||||
init_install_action_bin_dir() {
|
||||
@@ -393,8 +412,10 @@ case "$(uname -s)" in
|
||||
base_distro=$(grep '^ID_LIKE=' /etc/os-release | sed 's/^ID_LIKE=//')
|
||||
case "${base_distro}" in
|
||||
*debian*) base_distro=debian ;;
|
||||
*alpine*) base_distro=alpine ;;
|
||||
*fedora*) base_distro=fedora ;;
|
||||
*suse*) base_distro=suse ;;
|
||||
*arch*) base_distro=arch ;;
|
||||
*alpine*) base_distro=alpine ;;
|
||||
esac
|
||||
else
|
||||
base_distro=$(grep '^ID=' /etc/os-release | sed 's/^ID=//')
|
||||
@@ -426,19 +447,18 @@ case "$(uname -s)" in
|
||||
esac
|
||||
case "$(uname -m)" in
|
||||
aarch64 | arm64) host_arch="aarch64" ;;
|
||||
xscale | arm | armv[6-9]l)
|
||||
xscale | arm | armv*l)
|
||||
# Ignore 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/cross-rs/cross/pull/1018
|
||||
# Does it seem only armv7l+ is supported?
|
||||
# https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/src/Misc/externals.sh#L174
|
||||
# https://github.com/actions/runner/blob/v2.315.0/src/Misc/externals.sh#L189
|
||||
# https://github.com/actions/runner/issues/688
|
||||
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>"
|
||||
;;
|
||||
# GitHub Actions Runner supports Linux (x86_64, aarch64, arm), Windows (x86_64, aarch64),
|
||||
# and macOS (x86_64, aarch64).
|
||||
# https://github.com/actions/runner
|
||||
# https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/.github/workflows/build.yml#L21
|
||||
# https://github.com/actions/runner/blob/v2.315.0/.github/workflows/build.yml#L21
|
||||
# https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#supported-architectures-and-operating-systems-for-self-hosted-runners
|
||||
# So we can assume x86_64 unless it is aarch64 or arm.
|
||||
*) host_arch="x86_64" ;;
|
||||
@@ -467,7 +487,7 @@ case "${host_os}" in
|
||||
linux)
|
||||
if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/dev/null; then
|
||||
case "${base_distro}" in
|
||||
debian | fedora | alpine)
|
||||
debian | fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (jq, curl, and/or tar)"
|
||||
sys_packages=()
|
||||
if ! type -P curl &>/dev/null; then
|
||||
@@ -493,7 +513,7 @@ case "${host_os}" in
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
;;
|
||||
*) warn "install-action requires at least jq and curl on non-Debian/Fedora/Alpine-based Linux" ;;
|
||||
*) warn "install-action requires at least jq and curl on non-Debian/Fedora/SUSE/Arch/Alpine-based Linux" ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
@@ -574,7 +594,7 @@ for tool in "${tools[@]}"; do
|
||||
fi
|
||||
if ! type -P unzip &>/dev/null; then
|
||||
case "${base_distro}" in
|
||||
debian | alpine | fedora)
|
||||
debian | fedora | suse | arch | alpine)
|
||||
echo "::group::Install packages required for installation (unzip)"
|
||||
sys_install unzip
|
||||
echo "::endgroup::"
|
||||
|
||||
@@ -819,8 +819,7 @@ impl StringOrArray {
|
||||
|
||||
/// GitHub Actions Runner supports Linux (x86_64, aarch64, arm), Windows (x86_64, aarch64),
|
||||
/// and macOS (x86_64, aarch64).
|
||||
/// https://github.com/actions/runner
|
||||
/// https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/.github/workflows/build.yml#L21
|
||||
/// https://github.com/actions/runner/blob/v2.315.0/.github/workflows/build.yml#L21
|
||||
/// https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#supported-architectures-and-operating-systems-for-self-hosted-runners
|
||||
///
|
||||
/// Note:
|
||||
@@ -832,8 +831,9 @@ impl StringOrArray {
|
||||
/// - Ignore 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/cross-rs/cross/pull/1018
|
||||
/// Does it seem only armv7l is supported?
|
||||
/// https://github.com/actions/runner/blob/caec043085990710070108f375cd0aeab45e1017/src/Misc/externals.sh#L174
|
||||
/// Does it seem only armv7l+ is supported?
|
||||
/// https://github.com/actions/runner/blob/v2.315.0/src/Misc/externals.sh#L189
|
||||
/// https://github.com/actions/runner/issues/688
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
enum HostPlatform {
|
||||
|
||||
Reference in New Issue
Block a user