2022-06-05 19:44:54 +08:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
# To use this script as a Git hook:
|
|
|
|
#
|
|
|
|
# cd .git/hooks # from repo root
|
|
|
|
# ln -s ../../tools/pre-push .
|
|
|
|
|
|
|
|
if ! git diff HEAD --quiet; then
|
|
|
|
if git diff --cached --quiet; then
|
|
|
|
echo 'Local changes exist and none is staged; stashing.'
|
|
|
|
git stash
|
|
|
|
trap 'r=$?; git stash pop; trap - EXIT; exit $r' EXIT INT HUP TERM
|
|
|
|
else
|
|
|
|
echo 'Local changes exist and some are staged; not stashing.'
|
|
|
|
echo 'Make a commit, stash all the changes, or unstage all the changes.'
|
|
|
|
exit 1
|
2022-11-17 10:57:47 +08:00
|
|
|
fi
|
2022-06-05 19:44:54 +08:00
|
|
|
fi
|
|
|
|
|
2022-12-30 07:16:16 +08:00
|
|
|
make test all-checks
|
2022-06-05 19:44:54 +08:00
|
|
|
make -C website check-rellinks
|
|
|
|
# A quick cross compilation test. Not exhaustive, but will catch most issues.
|
|
|
|
if test `go env GOOS` = windows; then
|
|
|
|
GOOS=linux GOARCH=amd64 go build ./...
|
2024-02-01 23:02:39 +08:00
|
|
|
GOOS=linux GOARCH=amd64 go test -o NUL -c ./...
|
2022-06-05 19:44:54 +08:00
|
|
|
else
|
|
|
|
GOOS=windows GOARCH=amd64 go build ./...
|
2024-02-01 23:02:39 +08:00
|
|
|
GOOS=windows GOARCH=amd64 go test -o /dev/null -c ./...
|
2022-06-05 19:44:54 +08:00
|
|
|
fi
|