check / check (push) Waiting to run
The vendored files are copies from sneak/prompts e3f79c4, with this repository's own entries kept. The script/ builds pass a new CACHEBUST value instead of --no-cache, which emptied Go's build cache mount, so every make test compiled the standard library and every dependency with -race. Every Dockerfile stage declares ARG CACHEBUST first, so every RUN step still reruns on an unchanged tree. The steps that compile mount Go's build cache, and both go test runs keep -count=1. The lint and test builds write no image. script/bootstrap, script/fmt and script/fmt-check are the canonical files plus this repository's Go steps. Model: opus-5-5
48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# script/fmt-check: check formatting (read-only). Same scope as
|
|
# script/fmt, but fails instead of writing.
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
# Must match the pin in script/bootstrap.
|
|
NODE_VERSION="22.17.0"
|
|
|
|
# True when the node on PATH has the pinned major version: the same
|
|
# function as in script/bootstrap, which uses it to decide where it
|
|
# installs yarn.
|
|
node_is_pinned_major() {
|
|
if ! command -v node >/dev/null 2>&1; then return 1; fi
|
|
installed="$(node --version)"
|
|
installed="${installed#v}"
|
|
[ "${installed%%.*}" = "${NODE_VERSION%%.*}" ]
|
|
}
|
|
|
|
# Run the yarn script/bootstrap installed: the yarn on PATH when the
|
|
# node on PATH has the pinned major version, and otherwise yarn under
|
|
# the pinned node in nvm, which bootstrap leaves off the PATH of the
|
|
# shell that called it. nvm is a bash script, hence the subshell.
|
|
run_yarn() {
|
|
if node_is_pinned_major && command -v yarn >/dev/null 2>&1; then
|
|
exec yarn "$@"
|
|
fi
|
|
if node_is_pinned_major || [ ! -s "$HOME/.nvm/nvm.sh" ]; then
|
|
echo "fmt-check: no yarn; run script/bootstrap first" >&2
|
|
exit 1
|
|
fi
|
|
exec bash -c '. "$HOME/.nvm/nvm.sh" && nvm use "$1" >/dev/null &&
|
|
shift && exec yarn "$@"' bash "$NODE_VERSION" "$@"
|
|
}
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
if [ -n "$(gofmt -l .)" ]; then
|
|
echo "Files need formatting:"
|
|
gofmt -l .
|
|
exit 1
|
|
fi
|
|
run_yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always
|
|
}
|
|
|
|
main "$@"
|