carlos / platform Public

Merge pull request #278 from carlosframework/amadan-ci-one-definition

amadan CI: one definition of the gate, so gofmt is actually checked
Paul Campbell pushed by paul@keymail.dev ae6a18243758148d707d76295bb9740f0c997b89 parent a0e1b91parent c23e3ab
2 files changed, +22 −9
  • .amadan/ci.d/10-gate +14 −7
  • Makefile +8 −2
diff --git a/.amadan/ci.d/10-gate b/.amadan/ci.d/10-gate
index 9276c1635..abb3ada43 100755
--- a/.amadan/ci.d/10-gate
+++ b/.amadan/ci.d/10-gate
@@ -8,13 +8,20 @@
# definition of green; where the two disagree, the workflow is the one
# that gates a merge and the difference is a bug in this file.
#
-# -count=1 is the same rule for the same reason it is there: never
-# satisfy the gate from a cached pass. The 30m timeout is above Go's
-# 10m default because the root package's e2e tests compile the carlos
-# binary many times over — copied from the workflow rather than
-# re-derived, so a change there is a change in one place.
+# One definition, not two. Everything past the build is `make test` — the
+# same target a maintainer runs on a laptop — so CI and the local gate
+# cannot drift apart, and a check added to one is a check added to both.
+# That is how the gofmt check gets here at all: `make test` runs vet, a
+# repo-wide `gofmt -l .`, then the tests, and this file no longer restates
+# any of it.
+#
+# `go build ./...` stays spelled out because `make test` does not do it —
+# the Makefile's test target starts at vet.
+#
+# -count=1 and -timeout 30m moved to the Makefile's go test line along with
+# the reasoning for them; they are still in force here, just no longer
+# written down twice.
set -eu
go build ./...
-go vet ./...
-go test ./... -count=1 -timeout 30m
+exec make test
diff --git a/Makefile b/Makefile
index 7e858f35a..5a963c1e4 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,16 @@ GOARCH ?=
.PHONY: test build fmt
+# The build gate: vet, format, tests. `.amadan/ci.d/10-gate` runs this same
+# target, so what CI checks and what you check are one definition.
+#
+# -count=1 is CLAUDE.md's rule: never satisfy the gate from a cached pass.
+# The 30m timeout is above Go's 10m default because the root package's e2e
+# tests compile the carlos binary many times over.
test:
go vet ./...
- @fmt_out=$$(gofmt -l .); if [ -n "$$fmt_out" ]; then echo "gofmt needed:"; echo "$$fmt_out"; exit 1; fi
- go test ./...
+ @fmt_out=$$(gofmt -l .); if [ -n "$$fmt_out" ]; then echo "gofmt needed:"; echo "$$fmt_out"; exit 1; fi; echo "gofmt -l .: clean"
+ go test ./... -count=1 -timeout 30m
build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "$(LDFLAGS)" -o carlos .