#!/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 if [[ $local_ref =~ notes ]]; then exit 0 fi commit=$(git notes --ref=ci show $local_ref || true) if [[ -n "$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 fi ## if bild --test "${CODEROOT:?}"/**/* then test_result="good" else test_result="fail" exit 1 fi ## read -r -d '' note < Test-at: $at EOF ## git notes --ref=ci append -m "$note" done ##