blob: 85f047fa783f851d450cd8a840ece9cc9e77df7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/env bash
#
# a simple ci that saves its results in a git note, formatted according to
# RFC-2822, more or less.
#
##
set -uo 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)
##
while read local_ref local_sha remote_ref remote_sha
do
commit=$(git notes --ref=ci show $local_ref || true)
if [[ -n "$commit" ]]
then
lint_ok=$(grep "Lint-is: good" <<< $commit)
test_ok=$(grep "Test-is: good" <<< $commit)
if [[ $lint_ok -eq 0 || $test_ok -eq 0 ]]
then
exit 0
fi
fi
##
if lint "${BIZ_ROOT:?}"/**/*
then
lint_result="good"
else
lint_result="fail"
exit 1
fi
##
if bild --test "${BIZ_ROOT:?}"/**/*
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
##
|