Compare commits

...

12 Commits

Author SHA1 Message Date
Taiki Endo
9fdefab8ca Release 1.8.0 2022-07-26 11:36:08 +09:00
Taiki Endo
c430b7f8ce Update changelog 2022-07-26 11:33:53 +09:00
Taiki Endo
cfca345a65 Accept install-action@cargo-nextest 2022-07-26 11:33:53 +09:00
Christopher Durham
a76dc5ad72 Accept tool: cargo-nextest to install nextest (#15) 2022-07-26 11:30:14 +09:00
Christopher Durham
1dda3d1d7e Don't try to run cargo binstall --version (#16) 2022-07-26 11:30:04 +09:00
Taiki Endo
92705122ed Only use musl binaries for nextest if glibc isn't available
Closes #13
2022-07-26 11:21:16 +09:00
Taiki Endo
7e5692dc7d Release 1.7.0 2022-07-25 20:02:35 +09:00
Taiki Endo
8aa291abce Install Rust-related binaries to /usr/local/bin when cargo home is not available 2022-07-25 20:00:53 +09:00
Taiki Endo
36cb23f9a6 Release 1.6.1 2022-07-25 19:49:44 +09:00
Taiki Endo
ab4e6f5142 Update changelog 2022-07-25 19:49:37 +09:00
Taiki Endo
aae9c8b0a3 Fix install log for nextest 2022-07-25 19:47:04 +09:00
Taiki Endo
6eaed8fc4e Remove ... from log 2022-07-25 19:42:59 +09:00
4 changed files with 62 additions and 31 deletions

View File

@@ -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

View File

@@ -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
View File

@@ -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

View File

@@ -83,6 +83,7 @@ tools=(
parse-changelog
cross
nextest
cargo-nextest
shellcheck
shfmt
valgrind