diff options
author | Ben Sima <ben@bsima.me> | 2024-11-15 14:55:37 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2024-12-21 10:06:49 -0500 |
commit | 6513755670892983db88a6633b8c1ea6019c03d1 (patch) | |
tree | 44e9eccdb7a3a74ab7e96a8fee7572dd6a78dc73 /Omni/Ci.sh | |
parent | ae7b7e0186b5f2e0dcd4d5fac0a71fa264caedc2 (diff) |
Re-namespace some stuff to Omni
I was getting confused about what is a product and what is internal
infrastructure; I think it is good to keep those things separate. So I moved a
bunch of stuff to an Omni namespace, actually most stuff went there. Only things
that are explicitly external products are still in the Biz namespace.
Diffstat (limited to 'Omni/Ci.sh')
-rwxr-xr-x | Omni/Ci.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Omni/Ci.sh b/Omni/Ci.sh new file mode 100755 index 0000000..609e9aa --- /dev/null +++ b/Omni/Ci.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# +# A simple ci that saves its results in a git note, formatted according to +# RFC-2822, more or less. +# +# To run this manually, exec the script. It will by default run the tests for +# HEAD, whatever you currently have checked out. +# +# It would be cool to use a zero-knowledge proof mechanism here to prove that +# so-and-so ran the tests, but I'll have to research how to do that. +# +# ensure we don't exit on bild failure, only on CI script error + set +e + set -u +## + [[ -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) +## + commit=$(git notes --ref=ci show HEAD || true) + if [[ -n "$commit" ]] + then + if grep -q "Lint-is: good" <<< "$commit" + then + exit 0 + fi + if grep -q "Test-is: good" <<< "$commit" + then + exit 0 + fi + fi +## + runlint="$CODEROOT"/_/bin/lint + [[ ! -f "$runlint" ]] && bild "${BILD_ARGS:-""}" "${CODEROOT:?}"/Omni/Lint.hs + if "$runlint" "${CODEROOT:?}"/**/* + then + lint_result="good" + else + lint_result="fail" + fi +## + if bild "${BILD_ARGS:-""}" --test "${CODEROOT:?}"/**/* + then + test_result="good" + else + test_result="fail" + fi +## + read -r -d '' note <<EOF +Lint-is: $lint_result +Test-is: $test_result +Test-by: $user <$mail> +Test-at: $at +EOF +## + git notes --ref=ci append -m "$note" +## +# exit 1 if failure + [[ ! "$lint_result" == "fail" && ! "$test_result" == "fail" ]] +## |