mirror of
https://github.com/truespar/sentio.git
synced 2026-11-17 08:16:11 +00:00
CI triggered on both push to any branch and pull_request, so every branch ran twice and main ran again after merge. Push is limited to main now, and a concurrency group cancels superseded runs. publish gets a group too, but never cancels - a half-published release leaves a manifest without its binaries. Adds a pre-push hook installer for fmt and clippy.
25 lines
641 B
Bash
Executable File
25 lines
641 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs a pre-push hook that runs the two checks CI fails on most often.
|
|
# Catching them here costs seconds; catching them on a runner costs minutes and
|
|
# a red mark on the branch.
|
|
#
|
|
# ./scripts/install-git-hooks.sh
|
|
#
|
|
# Skip it for one push with `git push --no-verify`.
|
|
set -euo pipefail
|
|
|
|
root="$(git rev-parse --show-toplevel)"
|
|
hook="$root/.git/hooks/pre-push"
|
|
|
|
cat > "$hook" <<'HOOK'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
echo "pre-push: cargo fmt --check"
|
|
cargo fmt --all -- --check
|
|
echo "pre-push: cargo clippy"
|
|
cargo clippy --workspace --all-targets -- -D warnings
|
|
HOOK
|
|
|
|
chmod +x "$hook"
|
|
echo "installed $hook"
|