The forge's announcer announces each new head of an open pull request as pull.updated, once, and marks the head pending; the controller asks the build seat to check it against every machine of the mesh's facts, and says the verdict as checked, which the forge's holder sets as the head commit's status mesh/merge-gate - an error never as a success - with the check's own account as a comment when it is not a pass. merge-check.sh is the catalogue's check: every manifest through the running controller's module check and merge gate, and the Go tests of each module the change touches, a module whose dependencies cannot be fetched said as not tested.
31 lines
1.7 KiB
Bash
Executable File
31 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# The merge check of the catalogue (novox/hq to-be 45 §9), run by the build seat on every pull request
|
|
# before it merges. MESH_GATE is the controller the mesh runs — the judge a catalogue change must be
|
|
# readable by — built beside this check; MESH_FACTS the facts snapshot it keeps.
|
|
#
|
|
# 1. every manifest through the controller's own module check;
|
|
# 2. the merge gate: every machine of the snapshot composed with this tree's manifests and validated
|
|
# by the node-engine's own validator; a manifest the running controller cannot read, an identity a
|
|
# real machine's name makes too long, a module removed while a machine runs it, all fail here; how
|
|
# wide the merge's rebuild would be is said;
|
|
# 3. the Go tests of every module the change touches that has them, its replays among them — and a
|
|
# module whose dependencies cannot be fetched here is said as not tested, never passed silently.
|
|
set -eu
|
|
gate="${MESH_GATE:?the build seat builds the controller the mesh runs as MESH_GATE}"
|
|
|
|
"$gate" module check modules/*/module.json > /dev/null
|
|
"$gate" merge-gate --facts "$MESH_FACTS" --store "$MESH_GATE_POSTGRES" \
|
|
--repository "${MESH_CHECK_REPOSITORY:-novox/mesh-catalog}" --tree . \
|
|
--changed "${MESH_CHECK_CHANGED:-}" --json > "${MESH_CHECK_VERDICT:-/dev/null}"
|
|
|
|
touched=$(printf '%s\n' "${MESH_CHECK_CHANGED:-}" | tr ',' '\n' | sed -n 's#^modules/\([^/]*\)/.*#\1#p' | sort -u)
|
|
for m in $touched; do
|
|
[ -f "modules/$m/go.mod" ] || continue
|
|
if ! (cd "modules/$m" && GOPRIVATE=git.novox.be go mod download >/dev/null 2>&1); then
|
|
echo "NOT TESTED: modules/$m — its dependencies cannot be fetched by the build seat"
|
|
continue
|
|
fi
|
|
echo "testing modules/$m"
|
|
(cd "modules/$m" && GOPRIVATE=git.novox.be go test -count=1 ./...)
|
|
done
|