Compare commits

...

25 Commits

Author SHA1 Message Date
Taiki Endo
0865eee0cd Release 1.15.2 2022-12-11 03:46:11 +09:00
Taiki Endo
ab2d9d2b4f Add spell-check to CI 2022-12-09 22:03:48 +09:00
Taiki Endo
8666426bd7 Update protoc@latest to 3.21.11 2022-12-09 01:33:14 +09:00
Taiki Endo
5b5badbee3 Adjust host env check 2022-12-04 07:21:43 +09:00
Taiki Endo
8f358b0517 Update mdbook-linkcheck@latest to 0.7.7 2022-12-04 07:13:24 +09:00
Taiki Endo
087b8bdbf4 Release 1.15.1 2022-12-04 07:03:31 +09:00
Taiki Endo
22d12abbc7 Update cargo-hack@latest to 0.5.24 2022-12-04 06:45:42 +09:00
Taiki Endo
c4dcfd4545 Use reusable workflows 2022-12-03 22:41:35 +09:00
Taiki Endo
36e7fe7dbe Update wasmtime@latest to 3.0.1 2022-12-02 04:18:23 +09:00
Taiki Endo
d49da406cc Update protoc@latest to 3.21.10 2022-12-02 03:20:47 +09:00
Taiki Endo
d0f28d3db6 Overhaul tidy check 2022-12-02 03:19:40 +09:00
Taiki Endo
96c3fd376d Release 1.15.0 2022-11-29 23:09:01 +09:00
Taiki Endo
4091e8ab02 Support cargo-deny 2022-11-29 12:09:30 +09:00
Taiki Endo
956e75d2d4 Update mdbook@latest to 0.4.22 2022-11-29 12:08:30 +09:00
Taiki Endo
44a0ddacb9 Release 1.14.7 2022-11-28 02:01:08 +09:00
Taiki Endo
ce55513d1e Update cargo-llvm-cov@latest to 0.5.2 2022-11-28 01:59:00 +09:00
Taiki Endo
d650d1426d Release 1.14.6 2022-11-27 21:37:13 +09:00
Taiki Endo
9de731de5b Update cargo-hack, cargo-llvm-cov, and cargo-minimal-versions 2022-11-27 21:33:58 +09:00
Taiki Endo
8c5018c59c Release 1.14.5 2022-11-27 14:38:13 +09:00
Taiki Endo
f5afcb464c Update cargo-binstall@latest to 0.17.0 2022-11-27 14:35:58 +09:00
Taiki Endo
b42a02cb11 Update wasmtime@latest to 3.0.0 2022-11-27 13:51:45 +09:00
Taiki Endo
c971aa51fb Release 1.14.4 2022-11-04 09:46:25 +09:00
Taiki Endo
c0929bd53c Update cargo-udeps to 0.1.35 2022-11-04 09:44:12 +09:00
Taiki Endo
dfd35942fe Release 1.14.3 2022-10-28 21:58:34 +09:00
Taiki Endo
078ab003a2 Update wasmtime and protoc 2022-10-28 21:56:16 +09:00
11 changed files with 415 additions and 73 deletions

49
.cspell.json Normal file
View File

@@ -0,0 +1,49 @@
{
"version": "0.2",
"gitignoreRoot": ".",
"useGitignore": true,
"dictionaryDefinitions": [
{
"name": "organization-dictionary",
"path": "./.github/.cspell/organization-dictionary.txt",
"addWords": true
},
{
"name": "project-dictionary",
"path": "./.github/.cspell/project-dictionary.txt",
"addWords": true
},
{
"name": "rust-dependencies",
"path": "./.github/.cspell/rust-dependencies.txt",
"addWords": true
}
],
"dictionaries": [
"organization-dictionary",
"project-dictionary",
"rust-dependencies"
],
"ignoreRegExpList": [
// Copyright notice
"Copyright ((\\(c\\)|\\(C\\)|©) )?.*",
// GHA actions/workflows
"uses: .+@",
// GHA context (repo name, owner name, etc.)
"github.\\w+ (=|!)= '.+'",
// GH username
"( |\\[)@[\\w_-]+",
// Git config username
"git config user.name .*",
// Cargo.toml authors
"authors *= *\\[.*\\]",
"\".* <[\\w_.+-]+@[\\w.-]+>\""
],
"languageSettings": [
{
"languageId": ["*"],
"dictionaries": ["rust"]
}
],
"ignorePaths": []
}

View File

@@ -0,0 +1,109 @@
// This is a dictionary shared by projects under https://github.com/taiki-e.
// It is not intended for manual editing.
endo
taiki
// tool name and its configs or options
asan
cflags
clippy
codegen
cxxflags
exitcode
miri
miriflags
msan
retag
rustc
rustdoc
rustdocflags
rustflags
rustfmt
rustsec
rustup
valgrind
xcompile
Zdoctest
Zmiri
// Rust target triple
aarch
androideabi
armeb
armebv
armv
asmjs
atmega
bpfeb
bpfel
cuda
eabi
eabihf
emscripten
espidf
fortanix
gnuabi
gnueabi
gnueabihf
gnullvm
gnuspe
gnux
illumos
imac
macabi
mipsel
mipsisa
msvc
muslabi
musleabi
musleabihf
nvptx
openwrt
riscv
softfloat
sparcv
thumbeb
thumbebv
thumbv
tvos
uclibc
uclibceabi
uclibceabihf
uefi
vxworks
wasi
watchos
xous
// Rust other
alloc
canonicalize
consts
deque
doctest
hasher
inlateout
intrinsics
lateout
msrv
peekable
punct
repr
rfind
rfold
splitn
uninit
// Other
connrefused
cygwin
euxo
msys
noninteractive
noprofile
norc
pipefail
powerset
proto
tlsv

19
.github/.cspell/project-dictionary.txt vendored Normal file
View File

@@ -0,0 +1,19 @@
binstall
bytecodealliance
jfrimmel
koalaman
libc
linkcheck
mdbook
mvdan
nextest
protobuf
protoc
protocolbuffers
quickinstall
rustwasm
shellcheck
shfmt
toolchains
udeps
wasmtime

0
.github/.cspell/rust-dependencies.txt vendored Normal file
View File

View File

@@ -18,6 +18,9 @@ defaults:
shell: bash
jobs:
tidy:
uses: taiki-e/workflows/.github/workflows/tidy-no-rust.yml@main
test:
strategy:
fail-fast: false
@@ -27,15 +30,15 @@ jobs:
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,cross,nextest,protoc,shellcheck,shfmt,valgrind,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
- cargo-hack@0.5.22,cargo-llvm-cov@0.5.0,cargo-minimal-versions@0.1.7,parse-changelog@0.5.2,cargo-udeps@0.1.33,cargo-valgrind@2.1.0,cross@0.2.4,nextest@0.9.11,protoc@3.21.8,shellcheck@0.8.0,shfmt@3.5.1,wasm-pack@0.10.3,wasmtime@2.0.0,mdbook@0.4.21,mdbook-linkcheck@0.7.6,cargo-watch@8.1.1
- 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:
- os: macos-11
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
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
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
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
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
@@ -44,21 +47,3 @@ jobs:
- uses: ./
with:
tool: ${{ matrix.tool }}
tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: taiki-e/install-action@shellcheck
- uses: taiki-e/install-action@shfmt
- run: npm install prettier
- run: shfmt -d $(git ls-files '*.sh')
if: always()
- run: npx prettier -c $(git ls-files '*.yml')
if: always()
- run: npx prettier -c $(git ls-files '*.js')
if: always()
- run: shellcheck $(git ls-files '*.sh')
if: always()

3
.gitignore vendored
View File

@@ -1,8 +1,5 @@
target
Cargo.lock
node_modules
package-lock.json
package.json
# For platform and editor specific settings, it is recommended to add to
# a global .gitignore file.

View File

@@ -10,6 +10,46 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
## [1.15.2] - 2022-12-10
- Update `mdbook-linkcheck@latest` to 0.7.7.
- Update `protoc@latest` to 3.21.11.
## [1.15.1] - 2022-12-03
- Update `wasmtime@latest` to 3.0.1.
- Update `protoc@latest` to 3.21.10.
- Update `cargo-hack@latest` to 0.5.24.
## [1.15.0] - 2022-11-29
- Support `cargo-deny`.
- Update `mdbook@latest` to 0.4.22.
## [1.14.7] - 2022-11-27
- Update `cargo-llvm-cov@latest` to 0.5.2.
## [1.14.6] - 2022-11-27
- Update `cargo-hack@latest` to 0.5.23.
- Update `cargo-llvm-cov@latest` to 0.5.1.
- Update `cargo-minimal-versions@latest` to 0.1.8.
## [1.14.5] - 2022-11-27
- Update `wasmtime@latest` to 3.0.0.
- Update `cargo-binstall@latest` to 0.17.0.
## [1.14.4] - 2022-11-04
- Update `cargo-udeps@latest` to 0.1.35.
## [1.14.3] - 2022-10-28
- Update `wasmtime@latest` to 2.0.1.
- Update `protoc@latest` to 3.21.9.
## [1.14.2] - 2022-10-25
- Update `cargo-hack@latest` to 0.5.22.
@@ -375,7 +415,15 @@ 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.14.2...HEAD
[Unreleased]: https://github.com/taiki-e/install-action/compare/v1.15.2...HEAD
[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
[1.14.7]: https://github.com/taiki-e/install-action/compare/v1.14.6...v1.14.7
[1.14.6]: https://github.com/taiki-e/install-action/compare/v1.14.5...v1.14.6
[1.14.5]: https://github.com/taiki-e/install-action/compare/v1.14.4...v1.14.5
[1.14.4]: https://github.com/taiki-e/install-action/compare/v1.14.3...v1.14.4
[1.14.3]: https://github.com/taiki-e/install-action/compare/v1.14.2...v1.14.3
[1.14.2]: https://github.com/taiki-e/install-action/compare/v1.14.1...v1.14.2
[1.14.1]: https://github.com/taiki-e/install-action/compare/v1.14.0...v1.14.1
[1.14.0]: https://github.com/taiki-e/install-action/compare/v1.13.9...v1.14.0

View File

@@ -39,7 +39,7 @@ To install a specific version, use `@version` syntax:
```yaml
- uses: taiki-e/install-action@v1
with:
tool: cargo-hack@0.5.22
tool: cargo-hack@0.5.24
```
To install multiple tools:
@@ -66,21 +66,22 @@ https://spdx.org/licenses
| Name | Where binaries will be installed | Where will it be installed from | Supported platform | License |
| ---- | -------------------------------- | ------------------------------- | ------------------ | ------- |
| [**cargo-binstall**][cargo-binstall] | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/cargo-bins/cargo-binstall/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/cargo-bins/cargo-binstall/blob/HEAD/crates/bin/LICENSE) |
| [**cargo-deny**](https://github.com/EmbarkStudios/cargo-deny) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/EmbarkStudios/cargo-deny/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/EmbarkStudios/cargo-deny/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/EmbarkStudios/cargo-deny/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) |
| [**cargo-udeps**](https://github.com/est31/cargo-udeps) | `$CARGO_HOME/bin` | [GitHub Release](https://github.com/est31/cargo-udeps/releases) | Linux, macOS, Windows | [Apache-2.0 OR MIT](https://github.com/est31/cargo-udeps/blob/master/LICENSE) |
| [**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/cargo-bins/cargo-binstall/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/cargo-bins/cargo-binstall/blob/HEAD/crates/bin/LICENSE) |
| [**cargo-valgrind**](https://github.com/jfrimmel/cargo-valgrind) | `$CARGO_HOME/bin` | [GitHub Release](https://github.com/jfrimmel/cargo-valgrind/releases) | Linux, macOS, Windows | [MIT](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-MIT) or [Apache-2.0](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-APACHE) |
| [**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**](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) |
| [**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) |
| [**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) |
| [**protoc**](https://github.com/protocolbuffers/protobuf) | `$HOME/.install-action/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) |
| [**cargo-valgrind**](https://github.com/jfrimmel/cargo-valgrind) | `$CARGO_HOME/bin` | [GitHub Release](https://github.com/jfrimmel/cargo-valgrind/releases) | Linux, macOS, Windows | [MIT](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-MIT) or [Apache-2.0](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-APACHE) |
| [**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) |

51
main.sh
View File

@@ -80,8 +80,8 @@ host_triple() {
}
install_cargo_binstall() {
# https://github.com/cargo-bins/cargo-binstall/releases
binstall_version="0.16.0"
install_binstall='1'
local binstall_version="0.17.0"
local install_binstall='1'
if [[ -f "${cargo_bin}/cargo-binstall${exe}" ]]; then
if [[ "$(cargo binstall -V)" == "cargo-binstall ${binstall_version}" ]]; then
info "cargo-binstall already installed on in ${cargo_bin}/cargo-binstall${exe}"
@@ -161,6 +161,16 @@ 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#*@}"
@@ -177,11 +187,11 @@ for tool in "${tools[@]}"; do
cargo-hack | cargo-llvm-cov | cargo-minimal-versions | parse-changelog)
case "${tool}" in
# https://github.com/taiki-e/cargo-hack/releases
cargo-hack) latest_version="0.5.22" ;;
cargo-hack) latest_version="0.5.24" ;;
# https://github.com/taiki-e/cargo-llvm-cov/releases
cargo-llvm-cov) latest_version="0.5.0" ;;
cargo-llvm-cov) latest_version="0.5.2" ;;
# https://github.com/taiki-e/cargo-minimal-versions/releases
cargo-minimal-versions) latest_version="0.1.7" ;;
cargo-minimal-versions) latest_version="0.1.8" ;;
# https://github.com/taiki-e/parse-changelog/releases
parse-changelog) latest_version="0.5.2" ;;
*) exit 1 ;;
@@ -201,7 +211,7 @@ for tool in "${tools[@]}"; do
;;
cargo-udeps)
# https://github.com/est31/cargo-udeps/releases
latest_version="0.1.33"
latest_version="0.1.35"
repo="est31/${tool}"
case "${version}" in
latest) version="${latest_version}" ;;
@@ -250,6 +260,22 @@ for tool in "${tools[@]}"; do
esac
download "${url}" "${cargo_bin}" "${tool}${exe}"
;;
cargo-deny)
# https://github.com/EmbarkStudios/cargo-deny/releases
latest_version="0.13.5"
repo="EmbarkStudios/${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
url="https://github.com/${repo}/releases/download/${version}/${tool}-${version}-${target}.tar.gz"
download "${url}" "${cargo_bin}" "${tool}-${version}-${target}/${tool}${exe}"
;;
cross)
# https://github.com/cross-rs/cross/releases
latest_version="0.2.4"
@@ -274,9 +300,8 @@ for tool in "${tools[@]}"; do
# https://nexte.st/book/pre-built-binaries.html
case "${OSTYPE}" in
linux*)
host_triple
case "${host}" in
*-linux-gnu*) url="https://get.nexte.st/${version}/linux" ;;
case "${host_env}" in
gnu) url="https://get.nexte.st/${version}/linux" ;;
*) url="https://get.nexte.st/${version}/linux-musl" ;;
esac
;;
@@ -290,7 +315,7 @@ for tool in "${tools[@]}"; do
;;
protoc)
# https://github.com/protocolbuffers/protobuf/releases
latest_version="3.21.8"
latest_version="3.21.11"
repo="protocolbuffers/protobuf"
case "${version}" in
latest) version="${latest_version}" ;;
@@ -420,7 +445,7 @@ for tool in "${tools[@]}"; do
;;
wasmtime)
# https://github.com/bytecodealliance/wasmtime/releases
latest_version="2.0.0"
latest_version="3.0.1"
repo="bytecodealliance/${tool}"
case "${version}" in
latest) version="${latest_version}" ;;
@@ -445,7 +470,7 @@ for tool in "${tools[@]}"; do
;;
mdbook)
# https://github.com/rust-lang/mdBook/releases
latest_version="0.4.21"
latest_version="0.4.22"
repo="rust-lang/mdBook"
case "${version}" in
latest) version="${latest_version}" ;;
@@ -461,7 +486,7 @@ for tool in "${tools[@]}"; do
;;
mdbook-linkcheck)
# https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases
latest_version="0.7.6"
latest_version="0.7.7"
repo="Michael-F-Bryan/${tool}"
case "${version}" in
latest) version="${latest_version}" ;;

View File

@@ -3,13 +3,16 @@ set -euo pipefail
IFS=$'\n\t'
cd "$(dirname "$0")"/..
# shellcheck disable=SC2154
trap 's=$?; echo >&2 "$0: Error on line "${LINENO}": ${BASH_COMMAND}"; exit ${s}' ERR
# Publish a new release.
#
# USAGE:
# ./tools/publish.sh <VERSION>
#
# Note:
# - This script requires parse-changelog <https://github.com/taiki-e/parse-changelog>
# Note: This script requires the following tools:
# - parse-changelog <https://github.com/taiki-e/parse-changelog>
bail() {
echo >&2 "error: $*"
@@ -77,19 +80,20 @@ if [[ -n "${tags}" ]]; then
fi
tools=(
cargo-binstall
cargo-deny
cargo-hack
cargo-llvm-cov
cargo-minimal-versions
cargo-nextest
cargo-udeps
cargo-valgrind
parse-changelog
cargo-binstall
cross
mdbook
mdbook-linkcheck
protoc
nextest
cargo-nextest
parse-changelog
protoc
shellcheck
shfmt
valgrind

View File

@@ -4,60 +4,165 @@ set -euo pipefail
IFS=$'\n\t'
cd "$(dirname "$0")"/..
# shellcheck disable=SC2154
trap 's=$?; echo >&2 "$0: Error on line "${LINENO}": ${BASH_COMMAND}"; exit ${s}' ERR
# USAGE:
# ./tools/tidy.sh
#
# Note: This script requires the following tools:
# - shfmt
# - prettier
# - shellcheck
# - npm
# - jq and yq (if this repository uses bors)
# - clang-format (if any of C/C++ exists)
#
# This script is shared with other repositories, so there may also be
# checks for files not included in this repository, but they will be
# skipped if the corresponding files do not exist.
x() {
local cmd="$1"
shift
if [[ -n "${verbose:-}" ]]; then
(
set -x
"${cmd}" "$@"
)
else
(
set -x
"${cmd}" "$@"
)
}
check_diff() {
if [[ -n "${CI:-}" ]]; then
if ! git --no-pager diff --exit-code "$@"; then
should_fail=1
fi
else
if ! git --no-pager diff --exit-code "$@" &>/dev/null; then
should_fail=1
fi
fi
}
warn() {
echo >&2 "warning: $*"
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
echo "::warning::$*"
else
echo >&2 "warning: $*"
fi
should_fail=1
}
if [[ "${1:-}" == "-v" ]]; then
shift
verbose=1
fi
if [[ $# -gt 0 ]]; then
cat <<EOF
USAGE:
$0 [-v]
$0
EOF
exit 1
fi
prettier=prettier
if type -P npm &>/dev/null && type -P "$(npm bin)/prettier" &>/dev/null; then
prettier="$(npm bin)/prettier"
# C/C++ (if exists)
if [[ -n "$(git ls-files '*.c')$(git ls-files '*.cpp')" ]]; then
if [[ ! -e .clang-format ]]; then
warn "could not fount .clang-format in the repository root"
fi
if type -P clang-format &>/dev/null; then
x clang-format -i $(git ls-files '*.c') $(git ls-files '*.cpp')
check_diff $(git ls-files '*.c') $(git ls-files '*.cpp')
else
warn "'clang-format' is not installed"
fi
fi
# YAML/JavaScript/JSON (if exists)
if [[ -n "$(git ls-files '*.yml')$(git ls-files '*.js')$(git ls-files '*.json')" ]]; then
if type -P npm &>/dev/null; then
x npx prettier -l -w $(git ls-files '*.yml') $(git ls-files '*.js') $(git ls-files '*.json')
check_diff $(git ls-files '*.yml') $(git ls-files '*.js') $(git ls-files '*.json')
else
warn "'npm' is not installed"
fi
if [[ -e .github/workflows/ci.yml ]] && grep -q '# tidy:needs' .github/workflows/ci.yml && ! grep -Eq '# *needs: \[' .github/workflows/ci.yml; then
if type -P jq &>/dev/null && type -P yq &>/dev/null; then
# shellcheck disable=SC2207
jobs_actual=($(yq '.jobs' .github/workflows/ci.yml | jq -r 'keys_unsorted[]'))
unset 'jobs_actual[${#jobs_actual[@]}-1]'
# shellcheck disable=SC2207
jobs_expected=($(yq -r '.jobs."ci-success".needs[]' .github/workflows/ci.yml))
if [[ "${jobs_actual[*]}" != "${jobs_expected[*]+"${jobs_expected[*]}"}" ]]; then
printf -v jobs '%s, ' "${jobs_actual[@]}"
sed -i "s/needs: \[.*\] # tidy:needs/needs: [${jobs%, }] # tidy:needs/" .github/workflows/ci.yml
check_diff .github/workflows/ci.yml
warn "please update 'needs' section in 'ci-success' job"
fi
else
warn "'jq' or 'yq' is not installed"
fi
fi
fi
if [[ -n "$(git ls-files '*.yaml')" ]]; then
warn "please use '.yml' instead of '.yaml' for consistency"
git ls-files '*.yaml'
fi
# Shell scripts
if type -P shfmt &>/dev/null; then
x shfmt -l -w $(git ls-files '*.sh')
check_diff $(git ls-files '*.sh')
else
warn "'shfmt' is not installed"
fi
if type -P "${prettier}" &>/dev/null; then
x "${prettier}" -l -w $(git ls-files '*.yml')
x "${prettier}" -l -w $(git ls-files '*.js')
else
warn "'prettier' is not installed"
fi
if type -P shellcheck &>/dev/null; then
x shellcheck $(git ls-files '*.sh')
if ! x shellcheck $(git ls-files '*.sh'); then
should_fail=1
fi
if [[ -n "$(git ls-files '*Dockerfile')" ]]; then
# SC2154 doesn't seem to work on dockerfile.
if ! x shellcheck -e SC2148,SC2154,SC2250 $(git ls-files '*Dockerfile'); then
should_fail=1
fi
fi
else
warn "'shellcheck' is not installed"
fi
# Spell check (if config exists)
if [[ -f .cspell.json ]]; then
if type -P npm &>/dev/null; then
if [[ -f Cargo.toml ]]; then
metadata=$(cargo metadata --format-version=1 --all-features --no-deps)
dependencies=''
for id in $(jq <<<"${metadata}" '.workspace_members[]'); do
dependencies+=$'\n'
dependencies+=$(jq <<<"${metadata}" ".packages[] | select(.id == ${id})" | jq -r '.dependencies[].name')
done
cat >.github/.cspell/rust-dependencies.txt <<EOF
// This file is @generated by $(basename "$0").
// It is not intended for manual editing.
EOF
# shellcheck disable=SC2001
sed <<<"${dependencies}" 's/[0-9_-]/\n/g' | LC_ALL=C sort -f -u | (grep -E '.{4,}' || true) >>.github/.cspell/rust-dependencies.txt
check_diff .github/.cspell/rust-dependencies.txt
else
touch .github/.cspell/rust-dependencies.txt
fi
x npx cspell --no-progress $(git ls-files)
for dictionary in .github/.cspell/*.txt; do
if [[ "${dictionary}" == .github/.cspell/project-dictionary.txt ]]; then
continue
fi
dup=$(sed '/^$/d' .github/.cspell/project-dictionary.txt "${dictionary}" | LC_ALL=C sort -f | uniq -d -i | (grep -v '//.*' || true))
if [[ -n "${dup}" ]]; then
warn "duplicated words in dictionaries; please remove the following words from .github/.cspell/project-dictionary.txt"
echo "======================================="
echo "${dup}"
echo "======================================="
fi
done
else
warn "'npm' is not installed"
fi
fi
if [[ -n "${should_fail:-}" ]]; then
exit 1
fi