Skip to content

Commit

Permalink
Support nextest on linux-gnu with very old glibc
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Dec 25, 2022
1 parent 8ffc26a commit bbbd8c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ jobs:
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,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.
# 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,dprint,just,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,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.
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall
Expand Down
18 changes: 15 additions & 3 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ read_manifest() {
# TODO: However, a warning may make sense.
download_info=$(jq <<<"${manifest}" -r ".${host_arch}_linux_gnu")
elif [[ "${host_env}" == "gnu" ]]; then
# TODO: don't hardcode tool name and use 'prefer_linux_gnu' field in base manifest.
case "${tool}" in
cargo-nextest | nextest)
# musl build of nextest is slow, so use glibc build if host_env is gnu.
# https://github.com/taiki-e/install-action/issues/13
download_info=$(jq <<<"${manifest}" -r ".${host_arch}_linux_gnu")
# TODO: don't hardcode required glibc version
required_glibc_version=2.27
higher_glibc_version=$(echo "${required_glibc_version}"$'\n'"${host_glibc_version}" | sort -Vu | tail -1)
if [[ "${higher_glibc_version}" == "${host_glibc_version}" ]]; then
# musl build of nextest is slow, so use glibc build if host_env is gnu.
# https://github.com/taiki-e/install-action/issues/13
download_info=$(jq <<<"${manifest}" -r ".${host_arch}_linux_gnu")
fi
;;
esac
fi
Expand Down Expand Up @@ -326,6 +332,12 @@ case "$(uname -s)" in
if (ldd --version 2>&1 || true) | grep -q 'musl'; then
host_env="musl"
fi
case "${host_env}" in
gnu)
host_glibc_version=$(ldd --version 2>&1 || true)
host_glibc_version=$(grep <<<"${host_glibc_version}" -E "GLIBC|GNU libc" | sed "s/.* //g")
;;
esac
if grep -q '^ID_LIKE=' /etc/os-release; then
base_distro="$(grep '^ID_LIKE=' /etc/os-release | sed 's/^ID_LIKE=//')"
case "${base_distro}" in
Expand Down

0 comments on commit bbbd8c8

Please sign in to comment.