Files

22 lines
879 B
Bash

#!/bin/sh
# mesh-check-toolchain: go
#
# This repository's own check, mesh/repo-check (novox/hq ADR 0238 §4), written with its first commit (ADR 0428 §4):
# every Go module in the tree is vetted, its unit tests run, and then its integration tests (-tags integration).
# A tree with no Go module has nothing to test, and the check says so and passes.
set -eu
cd "$(dirname "$0")"
modules=$(find . -name go.mod -not -path '*/vendor/*' -not -path './.git/*' | sort)
if [ -z "$modules" ]; then
echo "This tree holds no Go module, so there are no tests to run; the check passes."
exit 0
fi
for mod in $modules; do
dir=$(dirname "$mod")
echo "== $dir: go vet and the unit tests"
(cd "$dir" && go vet ./... && go test ./...)
echo "== $dir: the integration tests (-tags integration)"
(cd "$dir" && go vet -tags integration ./... && go test -tags integration ./...)
done