diff options
author | Ben Sima <ben@bsima.me> | 2023-10-10 13:31:58 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-10-27 14:57:45 -0400 |
commit | 7597d51ed4c866f596fb690d4d53d70bc01181b4 (patch) | |
tree | ad081cbbfcc4f1df71f21b18b7b15900feea559e /Biz/Ide | |
parent | 2be88dd9ec52e9fdbb2d7c02c154b7482c47aabf (diff) |
CI script improvements
Added BILD_ARGS and removed the unused 'while read' so you can just call it
directly without having to supply arguments.
Diffstat (limited to 'Biz/Ide')
-rwxr-xr-x | Biz/Ide/hooks/pre-push.bash | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/Biz/Ide/hooks/pre-push.bash b/Biz/Ide/hooks/pre-push.bash index 0c313cb..5abd3ee 100755 --- a/Biz/Ide/hooks/pre-push.bash +++ b/Biz/Ide/hooks/pre-push.bash @@ -1,8 +1,11 @@ #!/usr/bin/env bash # -# a simple ci that saves its results in a git note, formatted according to +# 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 expect to read a line of +# inputs, you can just enter 'HEAD' and it will +# ## set -uo pipefail [[ -n $(git status -s) ]] && { echo fail: dirty worktree; exit 1; } @@ -11,48 +14,42 @@ user=$(git config --get user.name) mail=$(git config --get user.email) ## - while read local_ref local_sha remote_ref remote_sha - do - if [[ $local_ref =~ notes ]]; then - exit 0 - fi - commit=$(git notes --ref=ci show $local_ref || true) - if [[ -n "$commit" ]] + commit=$(git notes --ref=ci show HEAD || true) + if [[ -n "$commit" ]] + then + lint_ok=$() + if grep -q "Lint-is: good" <<< $commit then - lint_ok=$() - if grep -q "Lint-is: good" <<< $commit - then - exit 0 - fi - if grep -q "Test-is: good" <<< $commit - then - exit 0 - fi - fi - ## - if lint "${CODEROOT:?}"/**/* - then - lint_result="good" - else - lint_result="fail" - exit 1 + exit 0 fi - ## - if bild --test "${CODEROOT:?}"/**/* + if grep -q "Test-is: good" <<< $commit then - test_result="good" - else - test_result="fail" - exit 1 + exit 0 fi - ## - read -r -d '' note <<EOF + fi +## + if lint "${CODEROOT:?}"/**/* + then + lint_result="good" + else + lint_result="fail" + exit 1 + fi +## + if bild ${BILD_ARGS:-""} --test "${CODEROOT:?}"/**/* + then + test_result="good" + else + test_result="fail" + exit 1 + 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" - done +## + git notes --ref=ci append -m "$note" ## |