mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-21 15:10:27 +00:00
Support wasm-pack on Windows
This commit is contained in:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -25,10 +25,10 @@ jobs:
|
||||
os:
|
||||
- ubuntu-20.04
|
||||
tool:
|
||||
# Note: Specifying the version of valgrind and wasm-pack is not supported.
|
||||
# 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,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
|
||||
- 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,wasm-pack@0.10.3,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:
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
- os: macos-11
|
||||
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,protoc,shellcheck,shfmt,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
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Support `wasm-pack` on Windows.
|
||||
|
||||
- Support specifying the version of `wasm-pack`.
|
||||
|
||||
## [1.10.2] - 2022-08-01
|
||||
|
||||
- Support `protoc` on Windows.
|
||||
|
||||
@@ -79,7 +79,7 @@ https://spdx.org/licenses
|
||||
| [**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) |
|
||||
| [**wasm-pack**](https://github.com/rustwasm/wasm-pack) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rustwasm/wasm-pack/releases) | Linux, macOS, Windows | [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) |
|
||||
|
||||
If `$CARGO_HOME/bin` is not available, Rust-related binaries will be installed to `$HOME/.cargo/bin`.<br>
|
||||
|
||||
75
main.sh
75
main.sh
@@ -173,22 +173,25 @@ for tool in "${tools[@]}"; do
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
repo="taiki-e/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
darwin*) target="x86_64-apple-darwin" ;;
|
||||
cygwin* | msys*) target="x86_64-pc-windows-msvc" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}-${target}.tar.gz"
|
||||
download "${url}" "${cargo_bin}" "${tool}${exe}"
|
||||
;;
|
||||
cross)
|
||||
# https://github.com/cross-rs/cross/releases
|
||||
latest_version="0.2.4"
|
||||
repo="cross-rs/cross"
|
||||
repo="cross-rs/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
darwin*) target="x86_64-apple-darwin" ;;
|
||||
@@ -196,11 +199,8 @@ for tool in "${tools[@]}"; do
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
0.1.* | 0.2.[0-1]) url="https://github.com/${repo}/releases/download/v${version}/cross-v${version}-${target}.tar.gz" ;;
|
||||
*) url="https://github.com/${repo}/releases/download/v${version}/cross-${target}.tar.gz" ;;
|
||||
0.1.* | 0.2.[0-1]) url="https://github.com/${repo}/releases/download/v${version}/${tool}-v${version}-${target}.tar.gz" ;;
|
||||
*) url="https://github.com/${repo}/releases/download/v${version}/${tool}-${target}.tar.gz" ;;
|
||||
esac
|
||||
download "${url}" "${cargo_bin}" "${tool}${exe}"
|
||||
;;
|
||||
@@ -230,7 +230,7 @@ for tool in "${tools[@]}"; do
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
miner_patch_version="${latest_version#*.}"
|
||||
miner_patch_version="${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"
|
||||
@@ -275,12 +275,12 @@ for tool in "${tools[@]}"; do
|
||||
shellcheck)
|
||||
# https://github.com/koalaman/shellcheck/releases
|
||||
latest_version="0.8.0"
|
||||
repo="koalaman/shellcheck"
|
||||
repo="koalaman/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
base_url="https://github.com/${repo}/releases/download/v${version}/shellcheck-v${version}"
|
||||
bin="shellcheck-v${version}/shellcheck${exe}"
|
||||
base_url="https://github.com/${repo}/releases/download/v${version}/${tool}-v${version}"
|
||||
bin="${tool}-v${version}/${tool}${exe}"
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
if type -P shellcheck &>/dev/null; then
|
||||
@@ -291,7 +291,7 @@ for tool in "${tools[@]}"; do
|
||||
darwin*) url="${base_url}.darwin.x86_64.tar.xz" ;;
|
||||
cygwin* | msys*)
|
||||
url="${base_url}.zip"
|
||||
bin="shellcheck${exe}"
|
||||
bin="${tool}${exe}"
|
||||
;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
@@ -301,6 +301,9 @@ for tool in "${tools[@]}"; do
|
||||
# https://github.com/mvdan/sh/releases
|
||||
latest_version="3.5.1"
|
||||
repo="mvdan/sh"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
bin_dir="/usr/local/bin"
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="linux_amd64" ;;
|
||||
@@ -316,26 +319,23 @@ for tool in "${tools[@]}"; do
|
||||
;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/shfmt_v${version}_${target}${exe}"
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}_v${version}_${target}${exe}"
|
||||
info "downloading ${url}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o "${bin_dir}/shfmt${exe}" "${url}"
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused -o "${bin_dir}/${tool}${exe}" "${url}"
|
||||
case "${OSTYPE}" in
|
||||
linux* | darwin*) chmod +x "${bin_dir}/shfmt${exe}" ;;
|
||||
linux* | darwin*) chmod +x "${bin_dir}/${tool}${exe}" ;;
|
||||
esac
|
||||
;;
|
||||
valgrind)
|
||||
case "${version}" in
|
||||
latest) ;;
|
||||
*) warn "specifying the version of ${tool} is not supported yet by this action" ;;
|
||||
esac
|
||||
case "${OSTYPE}" in
|
||||
linux*) ;;
|
||||
darwin* | cygwin* | msys*) bail "${tool} for non-linux is not supported yet by this action" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) ;;
|
||||
*) warn "specifying the version of ${tool} is not supported yet by this action" ;;
|
||||
esac
|
||||
retry sudo apt-get -o Acquire::Retries=10 -qq 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
|
||||
@@ -344,22 +344,29 @@ for tool in "${tools[@]}"; do
|
||||
retry sudo snap install valgrind --classic
|
||||
;;
|
||||
wasm-pack)
|
||||
# https://rustwasm.github.io/wasm-pack/installer
|
||||
# https://github.com/rustwasm/wasm-pack/releases
|
||||
latest_version="0.10.3"
|
||||
repo="rustwasm/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
case "${OSTYPE}" in
|
||||
linux* | darwin*) ;;
|
||||
cygwin* | msys*) bail "${tool} for windows is not supported yet by this action" ;;
|
||||
linux*) target="x86_64-unknown-linux-musl" ;;
|
||||
darwin*) target="x86_64-apple-darwin" ;;
|
||||
cygwin* | msys*) target="x86_64-pc-windows-msvc" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://rustwasm.github.io/wasm-pack/installer/init.sh | sh
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}-v${version}-${target}.tar.gz"
|
||||
download "${url}" "${cargo_bin}" "${tool}-v${version}-${target}/${tool}${exe}"
|
||||
;;
|
||||
wasmtime)
|
||||
# https://github.com/bytecodealliance/wasmtime/releases
|
||||
latest_version="0.39.1"
|
||||
repo="bytecodealliance/wasmtime"
|
||||
repo="bytecodealliance/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
base_url="https://github.com/bytecodealliance/wasmtime/releases/download/v${version}/wasmtime-v${version}"
|
||||
base_url="https://github.com/${repo}/releases/download/v${version}/${tool}-v${version}"
|
||||
case "${OSTYPE}" in
|
||||
linux*)
|
||||
target="x86_64-linux"
|
||||
@@ -396,16 +403,16 @@ for tool in "${tools[@]}"; do
|
||||
mdbook-linkcheck)
|
||||
# https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases
|
||||
latest_version="0.7.6"
|
||||
repo="Michael-F-Bryan/mdbook-linkcheck"
|
||||
repo="Michael-F-Bryan/${tool}"
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
case "${OSTYPE}" in
|
||||
linux*) target="x86_64-unknown-linux-gnu" ;;
|
||||
darwin*) target="x86_64-apple-darwin" ;;
|
||||
cygwin* | msys*) target="x86_64-pc-windows-msvc" ;;
|
||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||
esac
|
||||
case "${version}" in
|
||||
latest) version="${latest_version}" ;;
|
||||
esac
|
||||
url="https://github.com/${repo}/releases/download/v${version}/${tool}.${target}.zip"
|
||||
download "${url}" "${cargo_bin}" "${tool}${exe}"
|
||||
case "${OSTYPE}" in
|
||||
|
||||
Reference in New Issue
Block a user