summaryrefslogtreecommitdiff
path: root/Biz/Ide/hooks/pre-push
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-08-14 20:50:20 -0400
committerBen Sima <ben@bsima.me>2023-08-16 14:29:43 -0400
commit5c214478cc2d9e78ba78f3911f9fede2029c829f (patch)
treea307ddc9939e741e53f510c6479b32adb158f7f4 /Biz/Ide/hooks/pre-push
parent2d8b280ed2c73d65fb905a580e9499bb7f69ff01 (diff)
Turn pre-push into a record-keeping ci
This is necessary because otherwise I have no record of when I had a successful build.
Diffstat (limited to 'Biz/Ide/hooks/pre-push')
-rwxr-xr-xBiz/Ide/hooks/pre-push35
1 files changed, 34 insertions, 1 deletions
diff --git a/Biz/Ide/hooks/pre-push b/Biz/Ide/hooks/pre-push
index c27046d..a1dccc3 100755
--- a/Biz/Ide/hooks/pre-push
+++ b/Biz/Ide/hooks/pre-push
@@ -1,2 +1,35 @@
#!/usr/bin/env bash
-lint "${BIZ_ROOT:?}"/**/* && bild --test "${BIZ_ROOT:?}"/**/*
+#
+# a simple ci that saves its results in a git note, formatted according to
+# RFC-2822, more or less.
+#
+##
+ set -euo pipefail
+ [[ -n $(git status -s) ]] && { echo fail: dirty worktree; exit 1; }
+##
+ at=$(date -R)
+ user=$(git config --get user.name)
+ mail=$(git config --get user.email)
+##
+ if lint "${BIZ_ROOT:?}"/**/*
+ then
+ lint_result="good"
+ else
+ lint_result="fail"
+ fi
+##
+ git notes --ref=ci append -m "Lint-is: $lint_result"
+ git notes --ref=ci append -m "Lint-by: $user <$mail>"
+ git notes --ref=ci append -m "Lint-at: $at"
+##
+ if bild --test "${BIZ_ROOT:?}"/**/*
+ then
+ test_result="good"
+ else
+ test_result="fail"
+ fi
+##
+ git notes --ref=ci append -m "Test-is: $test_result"
+ git notes --ref=ci append -m "Test-by: $user <$mail>"
+ git notes --ref=ci append -m "Test-at: $at"
+##