Compare commits

...

5 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
10 changed files with 254 additions and 32 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

@@ -31,7 +31,7 @@ jobs:
# 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,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.10,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.6,cargo-watch@8.1.1
- 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:

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,11 @@ 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.
@@ -410,7 +415,8 @@ 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.15.1...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

23
main.sh
View File

@@ -80,8 +80,8 @@ host_triple() {
}
install_cargo_binstall() {
# https://github.com/cargo-bins/cargo-binstall/releases
binstall_version="0.17.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#*@}"
@@ -290,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
;;
@@ -306,7 +315,7 @@ for tool in "${tools[@]}"; do
;;
protoc)
# https://github.com/protocolbuffers/protobuf/releases
latest_version="3.21.10"
latest_version="3.21.11"
repo="protocolbuffers/protobuf"
case "${version}" in
latest) version="${latest_version}" ;;
@@ -477,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,6 +3,9 @@ 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:

View File

@@ -4,13 +4,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
# USAGE:
# ./tools/tidy.sh
#
# Note: This script requires the following tools:
# - shfmt
# - shellcheck
# - npm (if any of YAML/JavaScript/JSON exists)
# - npm
# - jq and yq (if this repository uses bors)
# - clang-format (if any of C/C++ exists)
#
@@ -21,14 +24,10 @@ cd "$(dirname "$0")"/..
x() {
local cmd="$1"
shift
if [[ -n "${verbose:-}" ]]; then
(
set -x
"${cmd}" "$@"
)
else
(
set -x
"${cmd}" "$@"
fi
)
}
check_diff() {
if [[ -n "${CI:-}" ]]; then
@@ -50,17 +49,10 @@ warn() {
should_fail=1
}
if [[ "${1:-}" == "-v" ]]; then
shift
verbose=1
fi
if [[ -n "${CI:-}" ]]; then
verbose=1
fi
if [[ $# -gt 0 ]]; then
cat <<EOF
USAGE:
$0 [-v]
$0
EOF
exit 1
fi
@@ -81,15 +73,12 @@ 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
if [[ ! -e node_modules/.bin/prettier ]]; then
x npm install prettier &>/dev/null
fi
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; then
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[]'))
@@ -133,6 +122,47 @@ 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