mirror of
https://github.com/taiki-e/install-action.git
synced 2025-12-27 01:54:13 -05:00
Improve platform support
This commit is contained in:
1
.github/.cspell/project-dictionary.txt
vendored
1
.github/.cspell/project-dictionary.txt
vendored
@@ -25,6 +25,7 @@ pluginconf
|
||||
protoc
|
||||
pubkey
|
||||
pwsh
|
||||
QQSTRING
|
||||
quickinstall
|
||||
rclone
|
||||
rdme
|
||||
|
||||
84
.github/workflows/ci.yml
vendored
84
.github/workflows/ci.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# NB: Sync list with https://github.com/taiki-e/checkout-action/blob/HEAD/.github/workflows/ci.yml
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-24.04
|
||||
@@ -53,8 +54,11 @@ jobs:
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: windows-2019
|
||||
- os: windows-2019
|
||||
bash: msys64
|
||||
- os: windows-2019
|
||||
bash: cygwin
|
||||
- os: windows-2022
|
||||
# https://github.com/taiki-e/install-action/pull/518#issuecomment-2160736760
|
||||
- os: windows-2022
|
||||
bash: msys64
|
||||
- os: windows-2022
|
||||
@@ -62,30 +66,28 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- run: |
|
||||
printf 'C:\msys64\mingw32\bin\n' >>"${GITHUB_PATH}"
|
||||
printf 'C:\msys64\usr\bin\n' >>"${GITHUB_PATH}"
|
||||
if: matrix.bash == 'msys64'
|
||||
- run: |
|
||||
choco install --no-progress --requirechecksums cygwin
|
||||
printf 'C:\tools\cygwin\bin\n' >>"${GITHUB_PATH}"
|
||||
printf 'C:\tools\cygwin\usr\bin\n' >>"${GITHUB_PATH}"
|
||||
if: matrix.bash == 'cygwin'
|
||||
- uses: taiki-e/checkout-action@v1
|
||||
# cross attempts to install rust-src when Cargo.toml is available even if `cross --version`
|
||||
- run: rm Cargo.toml
|
||||
- name: Generate tool list
|
||||
id: tool-list
|
||||
run: tools/ci/tool-list.sh "${{ matrix.tool }}" >>"${GITHUB_OUTPUT}"
|
||||
- run: |
|
||||
set -eEuxo pipefail
|
||||
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
|
||||
echo "C:\msys64\usr\bin" >> $GITHUB_PATH
|
||||
if: matrix.bash == 'msys64'
|
||||
- run: |
|
||||
set -eEuxo pipefail
|
||||
choco install --no-progress --requirechecksums cygwin
|
||||
echo "C:\tools\cygwin\bin" >> $GITHUB_PATH
|
||||
echo "C:\tools\cygwin\usr\bin" >> $GITHUB_PATH
|
||||
if: matrix.bash == 'cygwin'
|
||||
- run: env
|
||||
- uses: ./
|
||||
with:
|
||||
tool: ${{ steps.tool-list.outputs.tool }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
|
||||
# Test all shells listed in https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
|
||||
- name: Test bash
|
||||
run: just --version && shfmt --version && protoc --version
|
||||
shell: bash
|
||||
@@ -119,10 +121,14 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
container:
|
||||
# NB: Sync list with https://github.com/taiki-e/checkout-action/blob/HEAD/.github/workflows/ci.yml
|
||||
- ubuntu:14.04 # glibc 2.19
|
||||
- ubuntu:16.04 # glibc 2.23
|
||||
- ubuntu:18.04 # glibc 2.27
|
||||
- ubuntu:20.04 # glibc 2.31
|
||||
- ubuntu:22.04 # glibc 2.35
|
||||
- ubuntu:24.04 # glibc 2.39
|
||||
- debian:9-slim # glibc 2.24
|
||||
- debian:10-slim # glibc 2.28
|
||||
- debian:11-slim # glibc 2.31
|
||||
- debian:12-slim # glibc 2.36
|
||||
@@ -131,6 +137,7 @@ jobs:
|
||||
- almalinux:8-minimal # glibc 2.28
|
||||
- almalinux:9 # glibc 2.34
|
||||
- almalinux:9-minimal # glibc 2.34
|
||||
- centos:6 # glibc 2.12
|
||||
- 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)
|
||||
@@ -140,24 +147,63 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
container: ${{ matrix.container }}
|
||||
steps:
|
||||
- name: Install requirements (ubuntu:14.04)
|
||||
run: |
|
||||
set -CeEuxo pipefail
|
||||
# ubuntu 14.04's jq is 1.3
|
||||
# error: syntax error, unexpected QQSTRING_START, expecting $end
|
||||
# https://github.com/jqlang/jq/issues/273
|
||||
apt-get -o Acquire::Retries=10 -qq update
|
||||
apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends ca-certificates curl
|
||||
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 -o /usr/local/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64
|
||||
chmod +x /usr/local/bin/jq
|
||||
if: startsWith(matrix.container, 'ubuntu:14.04')
|
||||
- name: Install requirements (debian:9)
|
||||
run: |
|
||||
set -CeEuxo pipefail
|
||||
# In Debian, the old repositories is removed from the main mirrors some time after EoL.
|
||||
sed -i /etc/apt/sources.list -e 's/deb.debian.org/archive.debian.org/g' \
|
||||
-e 's|security.debian.org|archive.debian.org/|g' \
|
||||
-e '/stretch-updates/d'
|
||||
if: startsWith(matrix.container, 'debian:9')
|
||||
- name: Install requirements (centos)
|
||||
run: |
|
||||
set -eEuxo pipefail
|
||||
set -CeEuxo pipefail
|
||||
# In CentOS, the old repositories is removed from the main mirrors just after EoL.
|
||||
# https://github.com/rust-lang/rust/pull/126352
|
||||
sed -i /etc/yum.repos.d/*.repo -e 's!^mirrorlist!#mirrorlist!' \
|
||||
-e 's!^#baseurl=http://mirror.centos.org/!baseurl=https://vault.centos.org/!'
|
||||
-e 's!^#baseurl=http://mirror.centos.org/!baseurl=https://vault.centos.org/!'
|
||||
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
if [[ "${{ matrix.container }}" == "centos:6" ]]; then
|
||||
# CentOS 6's curl (7.19.7) has no curl has no --proto/--tlsv1.2.
|
||||
yum install -y gcc openssl-devel
|
||||
curl -fsSL --retry 10 https://curl.se/download/curl-7.34.0.tar.gz | tar xzf -
|
||||
cd -- curl-*
|
||||
./configure --prefix=/usr/local --with-ssl
|
||||
make
|
||||
make install
|
||||
# CentOS 6's jq is 1.3
|
||||
# error: syntax error, unexpected QQSTRING_START, expecting $end
|
||||
# https://github.com/jqlang/jq/issues/273
|
||||
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 -o /usr/local/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64
|
||||
chmod +x /usr/local/bin/jq
|
||||
# for checkout-action https://github.com/taiki-e/checkout-action/blob/87380fc33ed8e04e325b05d3576995b2253ab5ba/.github/workflows/ci.yml#L134-L142
|
||||
yum install -y openssh-clients perl perl-Error perl-TermReadKey rsync
|
||||
rpm -i \
|
||||
https://vault.ius.io/el6/x86_64/packages/p/perl-Git18-1.8.5.5-4.ius.el6.noarch.rpm \
|
||||
https://vault.ius.io/el6/x86_64/packages/g/git18-1.8.5.5-4.ius.el6.x86_64.rpm
|
||||
fi
|
||||
if: startsWith(matrix.container, 'centos')
|
||||
- name: Install requirements (alpine)
|
||||
run: apk --no-cache add bash
|
||||
shell: sh
|
||||
if: startsWith(matrix.container, 'alpine')
|
||||
- uses: taiki-e/checkout-action@v1
|
||||
# cross attempts to install rust-src when Cargo.toml is available even if `cross --version`
|
||||
- run: rm Cargo.toml
|
||||
- name: Generate tool list
|
||||
id: tool-list
|
||||
run: tools/ci/tool-list.sh >>"${GITHUB_OUTPUT}"
|
||||
# remove bash installed by checkout-action
|
||||
- run: apk --no-cache del bash
|
||||
shell: sh
|
||||
if: startsWith(matrix.container, 'alpine')
|
||||
- uses: ./
|
||||
with:
|
||||
tool: ${{ steps.tool-list.outputs.tool }}
|
||||
|
||||
@@ -10,6 +10,12 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Fix "/etc/os-release: No such file or directory" error on CentOS 6.
|
||||
|
||||
- Improve support for Alpine based containers/self-hosted runners (no longer need to install bash in advance).
|
||||
|
||||
- Improve documentation on platform support.
|
||||
|
||||
## [2.41.18] - 2024-07-15
|
||||
|
||||
- Update `espup@latest` to 0.12.1.
|
||||
|
||||
11
README.md
11
README.md
@@ -110,9 +110,16 @@ See the [Supported tools section](#supported-tools) for how to ensure that fallb
|
||||
## Compatibility
|
||||
|
||||
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
|
||||
On Linux, if any required tools are missing, this action will attempt to install them from distro's package manager, so no pre-setup is usually required (except for CentOS or Debian 9 (or older) or very old distro described below, which was already EoL and needs to use vault/archive repos -- see "Install requirements" in [our CI config](https://github.com/taiki-e/install-action/blob/HEAD/.github/workflows/ci.yml) for example of setup).
|
||||
|
||||
On other platforms, at least the following tools are required:
|
||||
|
||||
- bash 3.2+
|
||||
- jq 1.5+
|
||||
- curl 7.34+ (or RHEL7/CentOS7's patched curl 7.29)
|
||||
|
||||
Known environments affected by the above version requirements are CentOS 6 (EoL on 2020-11) using curl 7.19 and jq 1.3, and Ubuntu 14.04 (EoL on 2019-04) using jq 1.3 (see "Install requirements" in [our CI config](https://github.com/taiki-e/install-action/blob/HEAD/.github/workflows/ci.yml) for example of workaround).
|
||||
|
||||
## Related Projects
|
||||
|
||||
|
||||
23
action.yml
23
action.yml
@@ -21,8 +21,27 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- run: bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
|
||||
shell: bash
|
||||
- run: |
|
||||
set -eu
|
||||
if ! command -v bash >/dev/null; then
|
||||
if grep -Eq '^ID=alpine' /etc/os-release; then
|
||||
printf '::group::Install packages required for checkout-action (bash)\n'
|
||||
# NB: sync with apk_install in main.sh
|
||||
if command -v sudo >/dev/null; then
|
||||
sudo apk --no-cache add bash
|
||||
elif command -v doas >/dev/null; then
|
||||
doas apk --no-cache add bash
|
||||
else
|
||||
apk --no-cache add bash
|
||||
fi
|
||||
printf '::endgroup::\n'
|
||||
else
|
||||
printf '::error::checkout-action requires bash\n'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
|
||||
shell: sh
|
||||
env:
|
||||
INPUT_TOOL: ${{ inputs.tool }}
|
||||
INPUT_CHECKSUM: ${{ inputs.checksum }}
|
||||
|
||||
26
main.sh
26
main.sh
@@ -455,17 +455,21 @@ case "$(uname -s)" in
|
||||
host_env="gnu"
|
||||
host_glibc_version=$(grep <<<"${ldd_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
|
||||
fi
|
||||
if grep -q '^ID_LIKE=' /etc/os-release; then
|
||||
base_distro=$(grep '^ID_LIKE=' /etc/os-release | cut -d= -f2)
|
||||
case "${base_distro}" in
|
||||
*debian*) base_distro=debian ;;
|
||||
*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 | cut -d= -f2)
|
||||
if [[ -e /etc/os-release ]]; then
|
||||
if grep -Eq '^ID_LIKE=' /etc/os-release; then
|
||||
base_distro=$(grep -E '^ID_LIKE=' /etc/os-release | cut -d= -f2)
|
||||
case "${base_distro}" in
|
||||
*debian*) base_distro=debian ;;
|
||||
*fedora*) base_distro=fedora ;;
|
||||
*suse*) base_distro=suse ;;
|
||||
*arch*) base_distro=arch ;;
|
||||
*alpine*) base_distro=alpine ;;
|
||||
esac
|
||||
else
|
||||
base_distro=$(grep -E '^ID=' /etc/os-release | cut -d= -f2)
|
||||
fi
|
||||
elif [[ -e /etc/redhat-release ]]; then
|
||||
base_distro=fedora
|
||||
fi
|
||||
case "${base_distro}" in
|
||||
fedora)
|
||||
|
||||
@@ -25,10 +25,13 @@ glibc_pre_2_27_incompat=(
|
||||
valgrind
|
||||
wasmtime
|
||||
)
|
||||
musl_incompat=(
|
||||
glibc_pre_2_17_incompat=(
|
||||
"${glibc_pre_2_27_incompat[@]}"
|
||||
deepsource
|
||||
)
|
||||
musl_incompat=(
|
||||
"${glibc_pre_2_17_incompat[@]}"
|
||||
)
|
||||
|
||||
incompat_tools=()
|
||||
case "${1:-}" in
|
||||
@@ -50,16 +53,21 @@ case "$(uname -s)" in
|
||||
if grep <<<"${ldd_version}" -q 'musl'; then
|
||||
incompat_tools+=("${musl_incompat[@]}")
|
||||
else
|
||||
host_glibc_version=$(grep <<<"${ldd_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
|
||||
higher_glibc_version=$(sort <<<"2.34"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
host_glibc_version=$(grep -E "GLIBC|GNU libc" <<<"${ldd_version}" | sed "s/.* //g")
|
||||
higher_glibc_version=$(sort -Vu <<<"2.34"$'\n'"${host_glibc_version}" | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
higher_glibc_version=$(sort <<<"2.31"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
higher_glibc_version=$(sort -Vu <<<"2.31"$'\n'"${host_glibc_version}" | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
higher_glibc_version=$(sort <<<"2.27"$'\n'"${host_glibc_version}" -Vu | tail -1)
|
||||
if [[ "${higher_glibc_version}" == "${host_glibc_version}" ]]; then
|
||||
incompat_tools+=("${glibc_pre_2_31_incompat[@]}")
|
||||
higher_glibc_version=$(sort -Vu <<<"2.27"$'\n'"${host_glibc_version}" | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
higher_glibc_version=$(sort -Vu <<<"2.17"$'\n'"${host_glibc_version}" | tail -1)
|
||||
if [[ "${higher_glibc_version}" != "${host_glibc_version}" ]]; then
|
||||
incompat_tools+=("${glibc_pre_2_17_incompat[@]}")
|
||||
else
|
||||
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
||||
fi
|
||||
else
|
||||
incompat_tools+=("${glibc_pre_2_27_incompat[@]}")
|
||||
incompat_tools+=("${glibc_pre_2_31_incompat[@]}")
|
||||
fi
|
||||
else
|
||||
incompat_tools+=("${glibc_pre_2_34_incompat[@]}")
|
||||
|
||||
@@ -328,6 +328,7 @@ impl StringOrArray {
|
||||
/// 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
|
||||
// TODO: support musl with dynamic linking like wasmtime 22.0.0+'s musl binaries: https://github.com/bytecodealliance/wasmtime/releases/tag/v22.0.0
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
pub enum HostPlatform {
|
||||
|
||||
Reference in New Issue
Block a user