mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-06 13:10:27 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eef07f07c | ||
|
|
bb72b7ab31 | ||
|
|
f80dd34cc7 | ||
|
|
a252073294 | ||
|
|
f4a1ca475e | ||
|
|
d33a0a9074 | ||
|
|
3594558506 | ||
|
|
bbcb7fd5c9 | ||
|
|
155e686da4 | ||
|
|
e5d84f2a67 |
1
.github/.cspell/project-dictionary.txt
vendored
1
.github/.cspell/project-dictionary.txt
vendored
@@ -1,5 +1,6 @@
|
||||
binstall
|
||||
bytecodealliance
|
||||
Dpkg
|
||||
jfrimmel
|
||||
koalaman
|
||||
libc
|
||||
|
||||
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
@@ -10,7 +10,7 @@ on:
|
||||
- main
|
||||
- dev
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
- cron: '0 1 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
@@ -27,14 +27,17 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-20.04
|
||||
- ubuntu-22.04
|
||||
tool:
|
||||
# Note: Specifying the version of valgrind is not supported.
|
||||
# cargo-watch is supported by cargo-binstall (through quickinstall)
|
||||
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||
- cargo-hack@0.5.24,cargo-llvm-cov@0.5.2,cargo-minimal-versions@0.1.8,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,nextest@0.9.11,protoc@3.21.11,shellcheck@0.8.0,shfmt@3.5.1,wasm-pack@0.10.3,wasmtime@3.0.1,mdbook@0.4.22,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1
|
||||
# Nextest supports basic version ranges as well
|
||||
- nextest@0.9
|
||||
include:
|
||||
# Note: Specifying the version of valgrind and cargo-binstall is not supported.
|
||||
- os: ubuntu-20.04
|
||||
tool: cargo-hack@0.5.24,cargo-llvm-cov@0.5.2,cargo-minimal-versions@0.1.8,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,nextest@0.9.11,protoc@3.21.11,shellcheck@0.8.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@3.0.1,mdbook@0.4.22,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1
|
||||
# Nextest supports basic version ranges as well. For other tools, this will be supported by https://github.com/taiki-e/install-action/pull/27.
|
||||
- os: ubuntu-20.04
|
||||
tool: nextest@0.9
|
||||
- os: macos-11
|
||||
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,mdbook-linkcheck,cargo-watch
|
||||
- os: windows-2019
|
||||
@@ -47,3 +50,37 @@ jobs:
|
||||
- uses: ./
|
||||
with:
|
||||
tool: ${{ matrix.tool }}
|
||||
|
||||
test-container:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- container: ubuntu:20.04
|
||||
# valgrind: installing snap to container is difficult...
|
||||
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,mdbook-linkcheck,cargo-watch
|
||||
- container: debian:latest
|
||||
# valgrind: installing snap to container is difficult...
|
||||
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,mdbook-linkcheck,cargo-watch
|
||||
- container: alpine:latest
|
||||
# cargo-udeps,protoc,valgrind,wasmtime,mdbook,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,nextest,shellcheck,shfmt,wasm-pack,cargo-binstall
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.container }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install requirements (ubuntu/debian)
|
||||
run: |
|
||||
set -ex
|
||||
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 ca-certificates cargo curl unzip xz-utils
|
||||
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
|
||||
- name: Install requirements (alpine)
|
||||
run: apk add bash cargo curl tar xz
|
||||
shell: sh
|
||||
if: startsWith(matrix.container, 'alpine')
|
||||
- uses: ./
|
||||
with:
|
||||
tool: ${{ matrix.tool }}
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -10,6 +10,16 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.15.4] - 2022-12-12
|
||||
|
||||
- Update `shfmt@latest` to 3.6.0.
|
||||
- Update `cargo-binstall@latest` to 0.18.0.
|
||||
- Support installing `cargo-binstall` on linux with custom host targets such as x86_64-alpine-linux-musl.
|
||||
|
||||
## [1.15.3] - 2022-12-11
|
||||
|
||||
- Fix bug regarding musl host detection. ([#29](https://github.com/taiki-e/install-action/issues/29))
|
||||
|
||||
## [1.15.2] - 2022-12-10
|
||||
|
||||
- Update `mdbook-linkcheck@latest` to 0.7.7.
|
||||
@@ -415,7 +425,9 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.15.2...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.15.4...HEAD
|
||||
[1.15.4]: https://github.com/taiki-e/install-action/compare/v1.15.3...v1.15.4
|
||||
[1.15.3]: https://github.com/taiki-e/install-action/compare/v1.15.2...v1.15.3
|
||||
[1.15.2]: https://github.com/taiki-e/install-action/compare/v1.15.1...v1.15.2
|
||||
[1.15.1]: https://github.com/taiki-e/install-action/compare/v1.15.0...v1.15.1
|
||||
[1.15.0]: https://github.com/taiki-e/install-action/compare/v1.14.7...v1.15.0
|
||||
|
||||
69
main.sh
69
main.sh
@@ -80,7 +80,7 @@ host_triple() {
|
||||
}
|
||||
install_cargo_binstall() {
|
||||
# https://github.com/cargo-bins/cargo-binstall/releases
|
||||
local binstall_version="0.17.0"
|
||||
local binstall_version="0.18.0"
|
||||
local install_binstall='1'
|
||||
if [[ -f "${cargo_bin}/cargo-binstall${exe}" ]]; then
|
||||
if [[ "$(cargo binstall -V)" == "cargo-binstall ${binstall_version}" ]]; then
|
||||
@@ -98,14 +98,14 @@ install_cargo_binstall() {
|
||||
host_triple
|
||||
base_url="https://github.com/cargo-bins/cargo-binstall/releases/download/v${binstall_version}/cargo-binstall"
|
||||
case "${host}" in
|
||||
x86_64-unknown-linux-gnu) url="${base_url}-x86_64-unknown-linux-musl.tgz" ;;
|
||||
x86_64-unknown-linux-musl) url="${base_url}-x86_64-unknown-linux-musl.tgz" ;;
|
||||
x86_64-*-linux-gnu) url="${base_url}-x86_64-unknown-linux-musl.tgz" ;;
|
||||
x86_64-*-linux-musl) url="${base_url}-x86_64-unknown-linux-musl.tgz" ;;
|
||||
|
||||
armv7-unknown-linux-gnueabihf) url="${base_url}-armv7-unknown-linux-musleabihf.tgz" ;;
|
||||
armv7-unknown-linux-musleabihf) url="${base_url}-armv7-unknown-linux-musleabihf.tgz" ;;
|
||||
armv7-*-linux-gnueabihf) url="${base_url}-armv7-unknown-linux-musleabihf.tgz" ;;
|
||||
armv7-*-linux-musleabihf) url="${base_url}-armv7-unknown-linux-musleabihf.tgz" ;;
|
||||
|
||||
aarch64-unknown-linux-gnu) url="${base_url}-aarch64-unknown-linux-musl.tgz" ;;
|
||||
aarch64-unknown-linux-musl) url="${base_url}-aarch64-unknown-linux-musl.tgz" ;;
|
||||
aarch64-*-linux-gnu) url="${base_url}-aarch64-unknown-linux-musl.tgz" ;;
|
||||
aarch64-*-linux-musl) url="${base_url}-aarch64-unknown-linux-musl.tgz" ;;
|
||||
|
||||
x86_64-pc-windows-gnu) url="${base_url}-x86_64-pc-windows-msvc.zip" ;;
|
||||
|
||||
@@ -137,6 +137,34 @@ cargo_binstall() {
|
||||
*) cargo binstall --force --no-confirm --version "${version}" "${tool}" ;;
|
||||
esac
|
||||
}
|
||||
apt_update() {
|
||||
if type -P sudo &>/dev/null; then
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq update
|
||||
else
|
||||
retry apt-get -o Acquire::Retries=10 -qq update
|
||||
fi
|
||||
}
|
||||
apt_install() {
|
||||
if type -P sudo &>/dev/null; then
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends "$@"
|
||||
else
|
||||
retry apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends "$@"
|
||||
fi
|
||||
}
|
||||
apt_remove() {
|
||||
if type -P sudo &>/dev/null; then
|
||||
sudo apt-get -qq -o Dpkg::Use-Pty=0 remove -y "$@"
|
||||
else
|
||||
apt-get -qq -o Dpkg::Use-Pty=0 remove -y "$@"
|
||||
fi
|
||||
}
|
||||
snap_install() {
|
||||
if type -P sudo &>/dev/null; then
|
||||
retry sudo snap install "$@"
|
||||
else
|
||||
retry snap install "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
bail "invalid argument '$1'"
|
||||
@@ -161,16 +189,6 @@ if [[ ! -d "${cargo_bin}" ]]; then
|
||||
cargo_bin=/usr/local/bin
|
||||
fi
|
||||
|
||||
# Refs: https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
host_env="gnu"
|
||||
if ldd --version 2>&1 | grep -q 'musl'; then
|
||||
host_env="musl"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for tool in "${tools[@]}"; do
|
||||
if [[ "${tool}" == *"@"* ]]; then
|
||||
version="${tool#*@}"
|
||||
@@ -300,8 +318,9 @@ for tool in "${tools[@]}"; do
|
||||
# https://nexte.st/book/pre-built-binaries.html
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
case "${host_env}" in
|
||||
gnu) url="https://get.nexte.st/${version}/linux" ;;
|
||||
host_triple
|
||||
case "${host}" in
|
||||
*-linux-gnu*) url="https://get.nexte.st/${version}/linux" ;;
|
||||
*) url="https://get.nexte.st/${version}/linux-musl" ;;
|
||||
esac
|
||||
;;
|
||||
@@ -322,7 +341,7 @@ for tool in "${tools[@]}"; do
|
||||
esac
|
||||
miner_patch_version="${version#*.}"
|
||||
base_url="https://github.com/${repo}/releases/download/v${miner_patch_version}/protoc-${miner_patch_version}"
|
||||
# Copying files to /usr/local/include requires sudo.
|
||||
# Copying files to /usr/local/include requires sudo, so do not use it.
|
||||
bin_dir="${HOME}/.install-action/bin"
|
||||
include_dir="${HOME}/.install-action/include"
|
||||
if [[ ! -d "${bin_dir}" ]]; then
|
||||
@@ -368,7 +387,7 @@ for tool in "${tools[@]}"; do
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
if type -P shellcheck &>/dev/null; then
|
||||
sudo apt-get -qq -o Dpkg::Use-Pty=0 remove -y shellcheck
|
||||
apt_remove shellcheck
|
||||
fi
|
||||
url="${base_url}.linux.x86_64.tar.xz"
|
||||
;;
|
||||
@@ -383,7 +402,7 @@ for tool in "${tools[@]}"; do
|
||||
;;
|
||||
shfmt)
|
||||
# https://github.com/mvdan/sh/releases
|
||||
latest_version="3.5.1"
|
||||
latest_version="3.6.0"
|
||||
repo="mvdan/sh"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
@@ -420,12 +439,12 @@ for tool in "${tools[@]}"; do
|
||||
darwin* | cygwin* | msys*) bail "${tool} for non-linux is not supported yet by this action" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq update
|
||||
apt_update
|
||||
# libc6-dbg is needed to run Valgrind
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y libc6-dbg
|
||||
apt_install libc6-dbg
|
||||
# Use snap to install the latest Valgrind
|
||||
# https://snapcraft.io/install/valgrind/ubuntu
|
||||
retry sudo snap install valgrind --classic
|
||||
snap_install valgrind --classic
|
||||
;;
|
||||
wasm-pack)
|
||||
# https://github.com/rustwasm/wasm-pack/releases
|
||||
|
||||
Reference in New Issue
Block a user