Compare commits

...

15 Commits

Author SHA1 Message Date
Taiki Endo
de0e9b667c Release 1.10.2 2022-08-01 19:49:40 +09:00
Taiki Endo
45e69d69e2 Support protoc on Windows 2022-08-01 19:43:41 +09:00
Taiki Endo
9c40419eb7 Release 1.10.1 2022-08-01 18:19:11 +09:00
Taiki Endo
b8a66e6289 Update readme and changelog 2022-08-01 18:19:01 +09:00
Taiki Endo
a8803585a3 Fix missing include files when installing protoc on Linux and macOS 2022-08-01 18:07:53 +09:00
Taiki Endo
80528fecb9 Release 1.10.0 2022-08-01 17:43:41 +09:00
Taiki Endo
878e967972 Set PROTOC environment variable when installing protoc 2022-08-01 17:40:32 +09:00
Taiki Endo
b1b32c59f1 Tweak readme 2022-08-01 17:30:50 +09:00
Taiki Endo
a8398547d2 Release 1.9.0 2022-08-01 17:27:44 +09:00
Taiki Endo
15ad10ce15 Update readme 2022-08-01 17:26:13 +09:00
Taiki Endo
27a2597e2a Support protoc 2022-08-01 17:23:02 +09:00
Taiki Endo
41cb1134d7 Release 1.8.4 2022-08-01 12:16:56 +09:00
Taiki Endo
13e84cc696 Update cargo-llvm-cov to 0.4.13 2022-08-01 12:03:10 +09:00
Taiki Endo
d744cfca57 Release 1.8.3 2022-07-30 17:56:09 +09:00
Taiki Endo
f6e099c85c Support shorthand for mdbook-linkcheck 2022-07-30 17:56:01 +09:00
5 changed files with 137 additions and 33 deletions

View File

@@ -27,19 +27,19 @@ jobs:
tool:
# Note: Specifying the version of valgrind and wasm-pack is not supported.
# cargo-watch is supported by cargo-binstall (through quickinstall)
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
- cargo-hack@0.5.16,cargo-llvm-cov@0.4.12,cargo-minimal-versions@0.1.5,parse-changelog@0.5.0,cross@0.2.4,nextest@0.9.11,shellcheck@0.8.0,shfmt@3.5.1,wasmtime@0.39.1,mdbook@0.4.21,mdbook-linkcheck@0.7.6,cargo-watch@8.1.1
- cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,protoc,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
- cargo-hack@0.5.16,cargo-llvm-cov@0.4.13,cargo-minimal-versions@0.1.5,parse-changelog@0.5.0,cross@0.2.4,nextest@0.9.11,protoc@3.21.4,shellcheck@0.8.0,shfmt@3.5.1,wasmtime@0.39.1,mdbook@0.4.21,mdbook-linkcheck@0.7.6,cargo-watch@8.1.1
# Nextest supports basic version ranges as well
- nextest@0.9
include:
# Note: mdBook binary is incompatible with ubuntu 18.04,
# see https://github.com/rust-lang/mdBook/issues/1779
- os: ubuntu-18.04
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,protoc,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook-linkcheck,cargo-watch
- os: macos-11
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
- os: windows-2019
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cross,nextest,protoc,shellcheck,shfmt,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

View File

@@ -10,6 +10,34 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
## [1.10.2] - 2022-08-01
- Support `protoc` on Windows.
## [1.10.1] - 2022-08-01
- Fix missing include files when installing `protoc` on Linux and macOS.
- Installation of `protoc` on Windows is not currently working (in all released versions) and is considered unsupported.
## [1.10.0] - 2022-08-01
- Set the `PROTOC` environment variable when installing `protoc` if it has not already been set.
## [1.9.0] - 2022-08-01
- Support `protoc`.
- Support `shellcheck` on Windows.
- Support `shfmt` on Windows.
## [1.8.4] - 2022-08-01
- Update `cargo-llvm-cov@latest` to 0.4.13.
## [1.8.3] - 2022-07-30
- Support `taiki-e/install-action@mdbook-linkcheck` shorthand for mdbook-linkcheck.
## [1.8.2] - 2022-07-30
- Update `cargo-hack@latest` to 0.5.16.
@@ -17,13 +45,13 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [1.8.1] - 2022-07-26
- Fix cargo-binstall installation failure.
- Fix `cargo-binstall` installation failure.
## [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)
- 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)
@@ -37,15 +65,15 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [1.6.0] - 2022-07-25
- Support mdbook-linkcheck.
- Support mdbook on Windows.
- Support wasmtime on Windows.
- Support nextest on Linux (musl).
- Support `mdbook-linkcheck`.
- Support `mdbook` on Windows.
- Support `wasmtime` on Windows.
- Support `nextest` on Linux (musl).
- Fix installation failure when `$CARGO_HOME/bin` and `$HOME/.cargo/bin` is not available.
## [1.5.11] - 2022-07-25
- Fix cargo-binstall installation on macOS and Windows.
- Fix `cargo-binstall` installation on macOS and Windows.
## [1.5.10] - 2022-07-24
@@ -243,7 +271,13 @@ 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.8.2...HEAD
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.10.2...HEAD
[1.10.2]: https://github.com/taiki-e/install-action/compare/v1.10.1...v1.10.2
[1.10.1]: https://github.com/taiki-e/install-action/compare/v1.10.0...v1.10.1
[1.10.0]: https://github.com/taiki-e/install-action/compare/v1.9.0...v1.10.0
[1.9.0]: https://github.com/taiki-e/install-action/compare/v1.8.4...v1.9.0
[1.8.4]: https://github.com/taiki-e/install-action/compare/v1.8.3...v1.8.4
[1.8.3]: https://github.com/taiki-e/install-action/compare/v1.8.2...v1.8.3
[1.8.2]: https://github.com/taiki-e/install-action/compare/v1.8.1...v1.8.2
[1.8.1]: https://github.com/taiki-e/install-action/compare/v1.8.0...v1.8.1
[1.8.0]: https://github.com/taiki-e/install-action/compare/v1.7.0...v1.8.0

View File

@@ -70,19 +70,21 @@ https://spdx.org/licenses
| [**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) |
| [**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) |
| [**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) |
| [**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) |
| [**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) |
| [**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) |
| [**protoc**](https://github.com/protocolbuffers/protobuf) | `/usr/local/bin` | [GitHub Releases](https://github.com/protocolbuffers/protobuf/releases) | Linux, macOS, Windows | [BSD-3-Clause](https://github.com/protocolbuffers/protobuf/blob/HEAD/LICENSE) |
| [**shellcheck**](https://www.shellcheck.net) | `/usr/local/bin` | [GitHub Releases](https://github.com/koalaman/shellcheck/releases) | Linux, macOS, Windows | [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, Windows | [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_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 `$CARGO_HOME/bin` is not available, Rust-related binaries will be installed to `$HOME/.cargo/bin`.<br>
If `$HOME/.cargo/bin` is not available, Rust-related binaries will be installed to `/usr/local/bin`.<br>
If `/usr/local/bin` is not available, binaries will be installed to `$HOME/.install-action/bin`.<br>
If a tool not included in the list above is specified, this action uses [cargo-binstall] as a fallback.

88
main.sh
View File

@@ -34,6 +34,16 @@ download() {
local url="$1"
local bin_dir="$2"
local bin="$3"
if [[ "${bin_dir}" == "/usr/"* ]]; then
if [[ ! -d "${bin_dir}" ]]; then
bin_dir="${HOME}/.install-action/bin"
if [[ ! -d "${bin_dir}" ]]; then
mkdir -p "${bin_dir}"
echo "${bin_dir}" >>"${GITHUB_PATH}"
export PATH="${PATH}:${bin_dir}"
fi
fi
fi
local tar_args=()
case "${url}" in
*.tar.gz | *.tgz) tar_args+=("xzf") ;;
@@ -44,7 +54,7 @@ download() {
(
cd .install-action-tmp
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 --retry-connrefused "${url}" -o tmp.zip
unzip tmp.zip
mv "${bin}" "${bin_dir}/"
)
@@ -155,7 +165,7 @@ for tool in "${tools[@]}"; do
# https://github.com/taiki-e/cargo-hack/releases
cargo-hack) latest_version="0.5.16" ;;
# https://github.com/taiki-e/cargo-llvm-cov/releases
cargo-llvm-cov) latest_version="0.4.12" ;;
cargo-llvm-cov) latest_version="0.4.13" ;;
# https://github.com/taiki-e/cargo-minimal-versions/releases
cargo-minimal-versions) latest_version="0.1.5" ;;
# https://github.com/taiki-e/parse-changelog/releases
@@ -213,6 +223,55 @@ for tool in "${tools[@]}"; do
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" \
| tar xzf - -C "${cargo_bin}"
;;
protoc)
# https://github.com/protocolbuffers/protobuf/releases
latest_version="3.21.4"
repo="protocolbuffers/protobuf"
case "${version}" in
latest) version="${latest_version}" ;;
esac
miner_patch_version="${latest_version#*.}"
base_url="https://github.com/${repo}/releases/download/v${miner_patch_version}/protoc-${miner_patch_version}"
bin_dir="/usr/local/bin"
include_dir="/usr/local/include"
case "${OSTYPE}" in
linux*) url="${base_url}-linux-x86_64.zip" ;;
darwin*) url="${base_url}-osx-x86_64.zip" ;;
cygwin* | msys*)
url="${base_url}-win64.zip"
bin_dir="${HOME}/.install-action/bin"
include_dir="${HOME}/.install-action/include"
if [[ ! -d "${bin_dir}" ]]; then
mkdir -p "${bin_dir}"
mkdir -p "${include_dir}"
echo "${bin_dir}" >>"${GITHUB_PATH}"
export PATH="${PATH}:${bin_dir}"
fi
;;
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
esac
mkdir -p .install-action-tmp
(
cd .install-action-tmp
info "downloading ${url}"
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" -o tmp.zip
unzip tmp.zip
mv "bin/protoc${exe}" "${bin_dir}/"
mkdir -p "${include_dir}/"
case "${OSTYPE}" in
linux* | darwin*) sudo cp -r include/. "${include_dir}/" ;;
cygwin* | msys*)
cp -r include/. "${include_dir}/"
bin_dir=$(sed <<<"${bin_dir}" 's/^\/c\//C:\\/')
;;
esac
if [[ -z "${PROTOC:-}" ]]; then
info "setting PROTOC environment variable"
echo "PROTOC=${bin_dir}/protoc${exe}" >>"${GITHUB_ENV}"
fi
)
rm -rf .install-action-tmp
;;
shellcheck)
# https://github.com/koalaman/shellcheck/releases
latest_version="0.8.0"
@@ -221,6 +280,7 @@ for tool in "${tools[@]}"; do
latest) version="${latest_version}" ;;
esac
base_url="https://github.com/${repo}/releases/download/v${version}/shellcheck-v${version}"
bin="shellcheck-v${version}/shellcheck${exe}"
case "${OSTYPE}" in
linux*)
if type -P shellcheck &>/dev/null; then
@@ -230,25 +290,29 @@ for tool in "${tools[@]}"; do
;;
darwin*) url="${base_url}.darwin.x86_64.tar.xz" ;;
cygwin* | msys*)
# TODO: In what directory should we install the binaries?
# url="${base_url}.zip"
bail "${tool} for windows is not supported yet by this action"
url="${base_url}.zip"
bin="shellcheck${exe}"
;;
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
esac
download "${url}" /usr/local/bin "shellcheck-v${version}/shellcheck"
download "${url}" /usr/local/bin "${bin}"
;;
shfmt)
# https://github.com/mvdan/sh/releases
latest_version="3.5.1"
repo="mvdan/sh"
bin_dir="/usr/local/bin"
case "${OSTYPE}" in
linux*) target="linux_amd64" ;;
darwin*) target="darwin_amd64" ;;
cygwin* | msys*)
# TODO: In what directory should we install the binaries?
# target="windows_amd64"
bail "${tool} for windows is not supported yet by this action"
target="windows_amd64"
bin_dir="${HOME}/.install-action/bin"
if [[ ! -d "${bin_dir}" ]]; then
mkdir -p "${bin_dir}"
echo "${bin_dir}" >>"${GITHUB_PATH}"
export PATH="${PATH}:${bin_dir}"
fi
;;
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
esac
@@ -257,8 +321,10 @@ for tool in "${tools[@]}"; do
esac
url="https://github.com/${repo}/releases/download/v${version}/shfmt_v${version}_${target}${exe}"
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
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o "${bin_dir}/shfmt${exe}" "${url}"
case "${OSTYPE}" in
linux* | darwin*) chmod +x "${bin_dir}/shfmt${exe}" ;;
esac
;;
valgrind)
case "${OSTYPE}" in

View File

@@ -81,7 +81,11 @@ tools=(
cargo-llvm-cov
cargo-minimal-versions
parse-changelog
cargo-binstall
cross
mdbook
mdbook-linkcheck
protoc
nextest
cargo-nextest
shellcheck
@@ -89,8 +93,6 @@ tools=(
valgrind
wasm-pack
wasmtime
mdbook
cargo-binstall
)
(