Files
mesh-catalog/modules/gitea/cmd/repositories/first.go
T
jschoubben 5e24deb0f1 gitea: require mesh/check in place of the two old statuses on every main the gate judges (issue 1301, S1-S3)
ADR 0447 §1 has main require mesh/check alone. The repositories program now
requires it in place of mesh/merge-gate and mesh/repo-check on every listed
repository and on every other one whose main requires mesh/merge-gate, so the
switch needs no hand-kept list (lead decisions L4, L11). A main requiring
mesh/repo-check alone (hq) keeps it until issue 1296 (ADR 0503 §5).
2026-10-22 17:49:53 +02:00

44 lines
2.1 KiB
Go

package main
import "strings"
// MergeCheck is the first commit's merge-check.sh (ADR 0428 §4): it declares the Go toolchain (ADR 0238 §4, read
// among a script's first lines by the build seat), and runs the unit tests, then with -tags integration the
// integration tests, of every Go module in the tree; on a tree with none it says so and passes.
const MergeCheck = `#!/bin/sh
# mesh-check-toolchain: go
#
# This repository's own check (novox/hq ADR 0238 §4), run by the checker within mesh/check (ADR 0447), 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
`
// FirstCommit is main's first commit of a listed repository: its README, naming the repository's purpose, and
// its own check.
func FirstCommit(name string, r Repo) map[string]string {
purpose := strings.TrimSpace(r.Description)
if purpose == "" {
purpose = "(its purpose is not described yet: the gitea module's config value `repositories` describes it)"
}
readme := "# " + name + "\n\n" + purpose + "\n\n" +
"Made by the mesh from the gitea module's config value `repositories` (novox/hq ADR 0428). Main takes no push: " +
"a change reaches it by a pull request whose `mesh/check` passed: the checker's verdict on its head merged onto " +
"main, this repository's `merge-check.sh` among its tests (novox/hq ADR 0447).\n"
return map[string]string{"README.md": readme, "merge-check.sh": MergeCheck}
}