mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-04 20:20:30 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fdefab8ca | ||
|
|
c430b7f8ce | ||
|
|
cfca345a65 | ||
|
|
a76dc5ad72 | ||
|
|
1dda3d1d7e | ||
|
|
92705122ed | ||
|
|
7e5692dc7d | ||
|
|
8aa291abce | ||
|
|
36cb23f9a6 | ||
|
|
ab4e6f5142 | ||
|
|
aae9c8b0a3 | ||
|
|
6eaed8fc4e |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -10,13 +10,29 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.8.0] - 2022-07-26
|
||||
|
||||
- Only use musl binaries for nextest if glibc isn't available. See [#13](https://github.com/taiki-e/install-action/issues/13) for more.
|
||||
|
||||
- Fix cargo-binstall installation failure. ([#16](https://github.com/taiki-e/install-action/pull/16), thanks @CAD97)
|
||||
|
||||
- Accept `cargo-nextest` as an alias for `nextest`. ([#15](https://github.com/taiki-e/install-action/pull/15), thanks @CAD97)
|
||||
|
||||
## [1.7.0] - 2022-07-25
|
||||
|
||||
- Install Rust-related binaries to `/usr/local/bin` when `$CARGO_HOME/bin` and `$HOME/.cargo/bin` is not available.
|
||||
|
||||
## [1.6.1] - 2022-07-25
|
||||
|
||||
- Fix diagnostics.
|
||||
|
||||
## [1.6.0] - 2022-07-25
|
||||
|
||||
- Support mdbook-linkcheck.
|
||||
- Support mdbook on Windows.
|
||||
- Support wasmtime on Windows.
|
||||
- Support nextest on Linux (musl).
|
||||
- Fix installation failure when `$CARGO_HOME/bin` or `$HOME/.cargo/bin` is not available.
|
||||
- Fix installation failure when `$CARGO_HOME/bin` and `$HOME/.cargo/bin` is not available.
|
||||
|
||||
## [1.5.11] - 2022-07-25
|
||||
|
||||
@@ -218,7 +234,10 @@ 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.6.0...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.8.0...HEAD
|
||||
[1.8.0]: https://github.com/taiki-e/install-action/compare/v1.7.0...v1.8.0
|
||||
[1.7.0]: https://github.com/taiki-e/install-action/compare/v1.6.1...v1.7.0
|
||||
[1.6.1]: https://github.com/taiki-e/install-action/compare/v1.6.0...v1.6.1
|
||||
[1.6.0]: https://github.com/taiki-e/install-action/compare/v1.5.11...v1.6.0
|
||||
[1.5.11]: https://github.com/taiki-e/install-action/compare/v1.5.10...v1.5.11
|
||||
[1.5.10]: https://github.com/taiki-e/install-action/compare/v1.5.9...v1.5.10
|
||||
|
||||
25
README.md
25
README.md
@@ -66,20 +66,23 @@ https://spdx.org/licenses
|
||||
|
||||
| Name | Where binaries will be installed | Where will it be installed from | Supported platform | License |
|
||||
| ---- | -------------------------------- | ------------------------------- | ------------------ | ------- |
|
||||
| [**cargo-hack**](https://github.com/taiki-e/cargo-hack) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-hack/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-hack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-hack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-llvm-cov**](https://github.com/taiki-e/cargo-llvm-cov) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-llvm-cov/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-minimal-versions**](https://github.com/taiki-e/cargo-minimal-versions) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-minimal-versions/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-MIT) |
|
||||
| [**parse-changelog**](https://github.com/taiki-e/parse-changelog) | `~/.cargo/bin` | [GitHub Releases](https://github.com/taiki-e/parse-changelog/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cross**](https://github.com/cross-rs/cross) | `~/.cargo/bin` | [GitHub Releases](https://github.com/cross-rs/cross/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-MIT) |
|
||||
| [**nextest**](https://github.com/nextest-rs/nextest) | `~/.cargo/bin` | [GitHub Releases](https://github.com/nextest-rs/nextest/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-hack**](https://github.com/taiki-e/cargo-hack) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-hack/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-hack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-hack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-llvm-cov**](https://github.com/taiki-e/cargo-llvm-cov) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-llvm-cov/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-llvm-cov/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cargo-minimal-versions**](https://github.com/taiki-e/cargo-minimal-versions) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/taiki-e/cargo-minimal-versions/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/cargo-minimal-versions/blob/HEAD/LICENSE-MIT) |
|
||||
| [**parse-changelog**](https://github.com/taiki-e/parse-changelog) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/taiki-e/parse-changelog/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/taiki-e/parse-changelog/blob/HEAD/LICENSE-MIT) |
|
||||
| [**cross**](https://github.com/cross-rs/cross) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/cross-rs/cross/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/cross-rs/cross/blob/HEAD/LICENSE-MIT) |
|
||||
| [**nextest**](https://github.com/nextest-rs/nextest) (alias: `cargo-nextest`) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/nextest-rs/nextest/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-MIT) |
|
||||
| [**shellcheck**](https://www.shellcheck.net) | `/usr/local/bin` | [GitHub Releases](https://github.com/koalaman/shellcheck/releases) | Linux, macOS | [GPL-3.0-or-later](https://github.com/koalaman/shellcheck/blob/HEAD/LICENSE) |
|
||||
| [**shfmt**](https://github.com/mvdan/sh) | `/usr/local/bin` | [GitHub Releases](https://github.com/mvdan/sh/releases) | Linux, macOS | [BSD-3-Clause](https://github.com/mvdan/sh/blob/HEAD/LICENSE) |
|
||||
| [**valgrind**](https://valgrind.org) | `/snap/bin` | [snap](https://snapcraft.io/install/valgrind/ubuntu) | Linux | [GPL-2.0-or-later](https://valgrind.org/docs/manual/license.gpl.html) |
|
||||
| [**wasm-pack**](https://github.com/rustwasm/wasm-pack) | `~/.cargo/bin` | [GitHub Releases](https://github.com/rustwasm/wasm-pack/releases) | Linux, macOS | [Apache-2.0](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**wasmtime**](https://github.com/bytecodealliance/wasmtime) | `~/.cargo/bin` | [GitHub Releases](https://github.com/bytecodealliance/wasmtime/releases) | Linux, macOS, Windows | [Apache-2.0 WITH LLVM-exception](https://github.com/bytecodealliance/wasmtime/blob/HEAD/LICENSE) |
|
||||
| [**mdbook**](https://github.com/rust-lang/mdBook) | `~/.cargo/bin` | [GitHub Releases](https://github.com/rust-lang/mdBook/releases) | Linux, macOS, Windows | [MPL-2.0](https://github.com/rust-lang/mdBook/blob/HEAD/LICENSE) |
|
||||
| [**mdbook-linkcheck**](https://github.com/Michael-F-Bryan/mdbook-linkcheck) | `~/.cargo/bin` | [GitHub Releases](https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases) | Linux, macOS, Windows | [MIT](https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/HEAD/LICENSE) |
|
||||
| [**cargo-binstall**][cargo-binstall] | `~/.cargo/bin` | [GitHub Releases](https://github.com/ryankurte/cargo-binstall/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/ryankurte/cargo-binstall/blob/HEAD/LICENSE.txt) |
|
||||
| [**wasm-pack**](https://github.com/rustwasm/wasm-pack) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rustwasm/wasm-pack/releases) | Linux, macOS | [Apache-2.0](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/rustwasm/wasm-pack/blob/HEAD/LICENSE-MIT) |
|
||||
| [**wasmtime**](https://github.com/bytecodealliance/wasmtime) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/bytecodealliance/wasmtime/releases) | Linux, macOS, Windows | [Apache-2.0 WITH LLVM-exception](https://github.com/bytecodealliance/wasmtime/blob/HEAD/LICENSE) |
|
||||
| [**mdbook**](https://github.com/rust-lang/mdBook) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rust-lang/mdBook/releases) | Linux, macOS, Windows | [MPL-2.0](https://github.com/rust-lang/mdBook/blob/HEAD/LICENSE) |
|
||||
| [**mdbook-linkcheck**](https://github.com/Michael-F-Bryan/mdbook-linkcheck) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases) | Linux, macOS, Windows | [MIT](https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/HEAD/LICENSE) |
|
||||
| [**cargo-binstall**][cargo-binstall] | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/ryankurte/cargo-binstall/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/ryankurte/cargo-binstall/blob/HEAD/LICENSE.txt) |
|
||||
|
||||
If `$CARGO_HOME/bin` is not available, Rust-related binaries will be installed to `$HOME/.cargo/bin`.
|
||||
If `$HOME/.cargo/bin` is not available, Rust-related binaries will be installed to `/usr/local/bin`.
|
||||
|
||||
If a tool not included in the list above is specified, this action uses [cargo-binstall] as a fallback.
|
||||
|
||||
|
||||
44
main.sh
44
main.sh
@@ -43,7 +43,7 @@ download() {
|
||||
mkdir -p .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
|
||||
unzip tmp.zip
|
||||
mv "${bin}" "${bin_dir}/"
|
||||
@@ -59,17 +59,22 @@ download() {
|
||||
if [[ "${components}" != "0" ]]; then
|
||||
tar_args+=(--strip-components "${components}")
|
||||
fi
|
||||
info "downloading ${url}..."
|
||||
info "downloading ${url}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar "${tar_args[@]}" -C "${bin_dir}" "${bin}"
|
||||
}
|
||||
host_triple() {
|
||||
if [[ -z "${host:-}" ]]; then
|
||||
host="$(rustc -vV | grep host | cut -c 7-)"
|
||||
fi
|
||||
}
|
||||
install_cargo_binstall() {
|
||||
if [[ ! -f "${cargo_bin}/cargo-binstall" ]]; then
|
||||
info "installing cargo-binstall"
|
||||
|
||||
target="$(rustc -vV | grep host | cut -c 7-)"
|
||||
host_triple
|
||||
base_url=https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall
|
||||
case "${target}" in
|
||||
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" ;;
|
||||
|
||||
@@ -82,10 +87,10 @@ install_cargo_binstall() {
|
||||
x86_64-pc-windows-gnu) url="${base_url}-x86_64-pc-windows-msvc.zip" ;;
|
||||
|
||||
x86_64-apple-darwin | aarch64-apple-darwin | x86_64-pc-windows-msvc)
|
||||
url="${base_url}-${target}.zip"
|
||||
url="${base_url}-${host}.zip"
|
||||
;;
|
||||
|
||||
*) bail "unsupported target '${target}' for cargo-binstall" ;;
|
||||
*) bail "unsupported target '${host}' for cargo-binstall" ;;
|
||||
esac
|
||||
|
||||
download "${url}" "${cargo_bin}" "cargo-binstall${exe}"
|
||||
@@ -129,9 +134,9 @@ case "${OSTYPE}" in
|
||||
esac
|
||||
|
||||
cargo_bin="${CARGO_HOME:-"$HOME/.cargo"}/bin"
|
||||
mkdir -p "${cargo_bin}"
|
||||
# For version check. It is intentional that this is not wrote in GITHUB_ENV.
|
||||
export PATH="${cargo_bin}:$PATH"
|
||||
if [[ ! -d "${cargo_bin}" ]]; then
|
||||
cargo_bin=/usr/local/bin
|
||||
fi
|
||||
|
||||
for tool in "${tools[@]}"; do
|
||||
if [[ "${tool}" == *"@"* ]]; then
|
||||
@@ -140,6 +145,7 @@ for tool in "${tools[@]}"; do
|
||||
version="latest"
|
||||
fi
|
||||
tool="${tool%@*}"
|
||||
bin="${tool}${exe}"
|
||||
info "installing ${tool}@${version}"
|
||||
case "${tool}" in
|
||||
cargo-hack | cargo-llvm-cov | cargo-minimal-versions | parse-changelog)
|
||||
@@ -186,13 +192,14 @@ for tool in "${tools[@]}"; do
|
||||
esac
|
||||
download "${url}" "${cargo_bin}" "${tool}${exe}"
|
||||
;;
|
||||
nextest)
|
||||
nextest | cargo-nextest)
|
||||
bin="cargo-nextest"
|
||||
# https://nexte.st/book/pre-built-binaries.html
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
# musl binaries are available on 0.9.29+.
|
||||
case "${version}" in
|
||||
0.[1-8].* | 0.9.[0-9] | 0.9.[0-1][0-9] | 0.9.2[0-8]) 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
|
||||
;;
|
||||
@@ -200,7 +207,7 @@ for tool in "${tools[@]}"; do
|
||||
cygwin* | msys*) url="https://get.nexte.st/${version}/windows-tar" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
info "downloading ${url}..."
|
||||
info "downloading ${url}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
|
||||
| tar xzf - -C "${cargo_bin}"
|
||||
;;
|
||||
@@ -247,7 +254,7 @@ for tool in "${tools[@]}"; do
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/shfmt_v${version}_${target}${exe}"
|
||||
info "downloading ${url}..."
|
||||
info "downloading ${url}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o /usr/local/bin/shfmt "${url}"
|
||||
chmod +x /usr/local/bin/shfmt
|
||||
;;
|
||||
@@ -344,9 +351,10 @@ for tool in "${tools[@]}"; do
|
||||
;;
|
||||
esac
|
||||
|
||||
info "${tool} installed at $(type -P "${tool}")"
|
||||
case "${tool}" in
|
||||
cargo-* | nextest) x cargo "${tool#cargo-}" --version ;;
|
||||
info "${tool} installed at $(type -P "${bin}")"
|
||||
case "${bin}" in
|
||||
cargo-binstall) x cargo binstall | head 1 ;; # cargo binstall doesn't have a normal --version flag
|
||||
cargo-*) x cargo "${tool#cargo-}" --version ;;
|
||||
*) x "${tool}" --version ;;
|
||||
esac
|
||||
echo
|
||||
|
||||
@@ -83,6 +83,7 @@ tools=(
|
||||
parse-changelog
|
||||
cross
|
||||
nextest
|
||||
cargo-nextest
|
||||
shellcheck
|
||||
shfmt
|
||||
valgrind
|
||||
|
||||
Reference in New Issue
Block a user