mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-11 07:00:25 +00:00
Improve support for Fedora/RHEL based containers/self-hosted runners
This commit is contained in:
2
.github/.cspell/project-dictionary.txt
vendored
2
.github/.cspell/project-dictionary.txt
vendored
@@ -8,12 +8,14 @@ koalaman
|
|||||||
libc
|
libc
|
||||||
linkcheck
|
linkcheck
|
||||||
mdbook
|
mdbook
|
||||||
|
microdnf
|
||||||
mvdan
|
mvdan
|
||||||
nextest
|
nextest
|
||||||
protobuf
|
protobuf
|
||||||
protoc
|
protoc
|
||||||
protocolbuffers
|
protocolbuffers
|
||||||
quickinstall
|
quickinstall
|
||||||
|
rockylinux
|
||||||
rustwasm
|
rustwasm
|
||||||
shellcheck
|
shellcheck
|
||||||
shfmt
|
shfmt
|
||||||
|
|||||||
57
.github/workflows/ci.yml
vendored
57
.github/workflows/ci.yml
vendored
@@ -56,34 +56,73 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
container:
|
container:
|
||||||
- ubuntu:20.04
|
- ubuntu:20.04 # glibc 2.31
|
||||||
- debian:latest
|
- debian:11-slim # glibc 2.31
|
||||||
tool:
|
tool:
|
||||||
# valgrind: installing snap to container is difficult...
|
# valgrind: installing snap to container is difficult...
|
||||||
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||||
include:
|
include:
|
||||||
- container: ubuntu:18.04
|
- container: ubuntu:22.04 # glibc 2.35
|
||||||
|
# cargo-udeps depends on openssl 1.1
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: ubuntu:18.04 # glibc 2.27
|
||||||
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
|
||||||
- container: alpine:latest
|
- container: debian:10-slim # glibc 2.28
|
||||||
# cargo-udeps,protoc,valgrind,wasmtime,mdbook,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host.
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: fedora:latest # glibc 2.36 (as of fedora 37)
|
||||||
|
# cargo-udeps depends on openssl 1.1
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: rockylinux:8 # glibc 2.28
|
||||||
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: rockylinux:8-minimal # glibc 2.28
|
||||||
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: centos:7 # glibc 2.17
|
||||||
|
# cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host.
|
||||||
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
|
# we don't support nextest on very old glibc due to https://github.com/taiki-e/install-action/issues/13.
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,shellcheck,shfmt,wasm-pack,cargo-binstall
|
||||||
|
- container: alpine:latest # musl 1.2.3 (as of alpine 3.17)
|
||||||
|
# cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host.
|
||||||
|
# The latest mdbook provides prebuilt binaries for musl host, but we don't support it yet (will be done by https://github.com/taiki-e/install-action/pull/27)
|
||||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,shellcheck,shfmt,wasm-pack,cargo-binstall
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,shellcheck,shfmt,wasm-pack,cargo-binstall
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Install requirements (ubuntu/debian)
|
- name: Install requirements (ubuntu/debian)
|
||||||
run: |
|
run: |
|
||||||
set -ex
|
set -ex
|
||||||
apt-get -o Acquire::Retries=10 -qq update
|
apt-get -o Acquire::Retries=10 -qq update
|
||||||
apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends cargo
|
apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends cargo
|
||||||
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
|
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
|
||||||
|
- name: Install requirements (fedora/rockylinux)
|
||||||
|
run: |
|
||||||
|
set -ex
|
||||||
|
dnf=dnf
|
||||||
|
if ! type -P dnf &>/dev/null; then
|
||||||
|
dnf=microdnf
|
||||||
|
fi
|
||||||
|
# tar and gzip are required for actions/checkout on rockylinux:*-minimal
|
||||||
|
$dnf install -y cargo tar gzip
|
||||||
|
if: startsWith(matrix.container, 'fedora') || startsWith(matrix.container, 'rockylinux')
|
||||||
|
- name: Install requirements (centos)
|
||||||
|
run: |
|
||||||
|
set -ex
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
|
||||||
|
echo "$HOME/.cargo/bin" >>"${GITHUB_PATH}"
|
||||||
|
if: startsWith(matrix.container, 'centos')
|
||||||
- name: Install requirements (alpine)
|
- name: Install requirements (alpine)
|
||||||
run: apk add bash cargo
|
run: |
|
||||||
|
set -ex
|
||||||
|
apk add bash cargo
|
||||||
shell: sh
|
shell: sh
|
||||||
if: startsWith(matrix.container, 'alpine')
|
if: startsWith(matrix.container, 'alpine')
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
tool: ${{ matrix.tool }}
|
tool: ${{ matrix.tool }}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Improve support for Fedora/RHEL based containers/self-hosted runners.
|
||||||
|
|
||||||
## [1.16.0] - 2022-12-14
|
## [1.16.0] - 2022-12-14
|
||||||
|
|
||||||
- Update `cargo-binstall@latest` to 0.18.1. ([#32](https://github.com/taiki-e/install-action/pull/32), thanks @NobodyXu)
|
- Update `cargo-binstall@latest` to 0.18.1. ([#32](https://github.com/taiki-e/install-action/pull/32), thanks @NobodyXu)
|
||||||
|
|||||||
@@ -104,11 +104,11 @@ If you want a higher level of security, consider working on [#1](https://github.
|
|||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine).
|
This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine, Fedora, CentOS, Rocky).
|
||||||
To use this action in self-hosted runners or in containers, you will need to install at least the following:
|
To use this action in self-hosted runners or in containers, you will need to install at least the following:
|
||||||
|
|
||||||
- bash
|
- bash
|
||||||
- cargo (if you install cargo subcommands)
|
- cargo (if you install cargo subcommands or use cargo-binstall fallback)
|
||||||
|
|
||||||
## Related Projects
|
## Related Projects
|
||||||
|
|
||||||
|
|||||||
56
main.sh
56
main.sh
@@ -51,7 +51,7 @@ download() {
|
|||||||
tar_args+=("xjf")
|
tar_args+=("xjf")
|
||||||
if ! type -P bzip2 &>/dev/null; then
|
if ! type -P bzip2 &>/dev/null; then
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian | alpine) sys_install bzip2 ;;
|
debian | alpine | fedora) sys_install bzip2 ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -60,21 +60,21 @@ download() {
|
|||||||
if ! type -P xz &>/dev/null; then
|
if ! type -P xz &>/dev/null; then
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian) sys_install xz-utils ;;
|
debian) sys_install xz-utils ;;
|
||||||
alpine) sys_install xz ;;
|
alpine | fedora) sys_install xz ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*.zip)
|
*.zip)
|
||||||
if ! type -P unzip &>/dev/null; then
|
if ! type -P unzip &>/dev/null; then
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian | alpine) sys_install unzip ;;
|
debian | alpine | fedora) sys_install unzip ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
mkdir -p .install-action-tmp
|
mkdir -p .install-action-tmp
|
||||||
(
|
(
|
||||||
cd .install-action-tmp
|
cd .install-action-tmp
|
||||||
info "downloading ${url}"
|
info "downloading ${url}"
|
||||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" -o tmp.zip
|
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" -o tmp.zip
|
||||||
unzip tmp.zip
|
unzip tmp.zip
|
||||||
mv "${bin}" "${bin_dir}/"
|
mv "${bin}" "${bin_dir}/"
|
||||||
)
|
)
|
||||||
@@ -90,7 +90,7 @@ download() {
|
|||||||
tar_args+=(--strip-components "${components}")
|
tar_args+=(--strip-components "${components}")
|
||||||
fi
|
fi
|
||||||
info "downloading ${url}"
|
info "downloading ${url}"
|
||||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" \
|
||||||
| tar "${tar_args[@]}" -C "${bin_dir}" "${bin}"
|
| tar "${tar_args[@]}" -C "${bin_dir}" "${bin}"
|
||||||
}
|
}
|
||||||
host_triple() {
|
host_triple() {
|
||||||
@@ -186,10 +186,18 @@ apk_install() {
|
|||||||
apk add "$@"
|
apk add "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
dnf_install() {
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
retry sudo "${dnf}" install -y "$@"
|
||||||
|
else
|
||||||
|
retry "${dnf}" install -y "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
sys_install() {
|
sys_install() {
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian) apt_install "$@" ;;
|
debian) apt_install "$@" ;;
|
||||||
alpine) apk_install "$@" ;;
|
alpine) apk_install "$@" ;;
|
||||||
|
fedora) dnf_install "$@" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,9 +225,37 @@ case "${OSTYPE}" in
|
|||||||
fi
|
fi
|
||||||
if grep -q '^ID_LIKE=' /etc/os-release; then
|
if grep -q '^ID_LIKE=' /etc/os-release; then
|
||||||
base_distro="$(grep '^ID_LIKE=' /etc/os-release | sed 's/^ID_LIKE=//')"
|
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 ;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
base_distro="$(grep '^ID=' /etc/os-release | sed 's/^ID=//')"
|
base_distro="$(grep '^ID=' /etc/os-release | sed 's/^ID=//')"
|
||||||
fi
|
fi
|
||||||
|
case "${base_distro}" in
|
||||||
|
fedora)
|
||||||
|
dnf=dnf
|
||||||
|
if ! type -P dnf &>/dev/null; then
|
||||||
|
if type -P microdnf &>/dev/null; then
|
||||||
|
# fedora-based distributions have "minimal" images that
|
||||||
|
# use microdnf instead of dnf.
|
||||||
|
dnf=microdnf
|
||||||
|
else
|
||||||
|
# If neither dnf nor microdnf is available, it is
|
||||||
|
# probably an RHEL7-based distribution that does not
|
||||||
|
# have dnf installed by default.
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
sudo yum update -y
|
||||||
|
sudo yum install -y dnf
|
||||||
|
else
|
||||||
|
yum update -y
|
||||||
|
yum install -y dnf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
cygwin* | msys*) exe=".exe" ;;
|
cygwin* | msys*) exe=".exe" ;;
|
||||||
esac
|
esac
|
||||||
@@ -231,7 +267,7 @@ fi
|
|||||||
|
|
||||||
if ! type -P curl &>/dev/null || ! type -P tar &>/dev/null; then
|
if ! type -P curl &>/dev/null || ! type -P tar &>/dev/null; then
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian | alpine) sys_install ca-certificates curl tar ;;
|
debian | alpine | fedora) sys_install ca-certificates curl tar ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -376,7 +412,7 @@ for tool in "${tools[@]}"; do
|
|||||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||||
esac
|
esac
|
||||||
info "downloading ${url}"
|
info "downloading ${url}"
|
||||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" \
|
||||||
| tar xzf - -C "${cargo_bin}"
|
| tar xzf - -C "${cargo_bin}"
|
||||||
;;
|
;;
|
||||||
protoc)
|
protoc)
|
||||||
@@ -405,14 +441,14 @@ for tool in "${tools[@]}"; do
|
|||||||
esac
|
esac
|
||||||
if ! type -P unzip &>/dev/null; then
|
if ! type -P unzip &>/dev/null; then
|
||||||
case "${base_distro}" in
|
case "${base_distro}" in
|
||||||
debian | alpine) sys_install unzip ;;
|
debian | alpine | fedora) sys_install unzip ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
mkdir -p .install-action-tmp
|
mkdir -p .install-action-tmp
|
||||||
(
|
(
|
||||||
cd .install-action-tmp
|
cd .install-action-tmp
|
||||||
info "downloading ${url}"
|
info "downloading ${url}"
|
||||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" -o tmp.zip
|
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" -o tmp.zip
|
||||||
unzip tmp.zip
|
unzip tmp.zip
|
||||||
mv "bin/protoc${exe}" "${bin_dir}/"
|
mv "bin/protoc${exe}" "${bin_dir}/"
|
||||||
mkdir -p "${include_dir}/"
|
mkdir -p "${include_dir}/"
|
||||||
@@ -476,7 +512,7 @@ for tool in "${tools[@]}"; do
|
|||||||
esac
|
esac
|
||||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}_v${version}_${target}${exe}"
|
url="https://github.com/${repo}/releases/download/v${version}/${tool}_v${version}_${target}${exe}"
|
||||||
info "downloading ${url}"
|
info "downloading ${url}"
|
||||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o "${bin_dir}/${tool}${exe}" "${url}"
|
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 -o "${bin_dir}/${tool}${exe}" "${url}"
|
||||||
case "${OSTYPE}" in
|
case "${OSTYPE}" in
|
||||||
linux* | darwin*) chmod +x "${bin_dir}/${tool}${exe}" ;;
|
linux* | darwin*) chmod +x "${bin_dir}/${tool}${exe}" ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user