| 1 | .PHONY: vet fmt-check test test-peers race ci |
| 2 | |
| 3 | # ci is the one gate: what a runner executes and what you run before |
| 4 | # pushing are the same definition (amadan's own rule — CI steps delegate |
| 5 | # to make targets, never keep their own copies of the commands). |
| 6 | # |
| 7 | # There is no separate migration-check step. The scaffold's Makefile |
| 8 | # shells out to the `rastrillo` CLI for one, which would make this |
| 9 | # module's gate depend on building that binary; the example's |
| 10 | # TestSchemaAndModelsAgree does the same work — replay the app's own |
| 11 | # Schema, diff it against the app's own Models, fail on any pending |
| 12 | # change — through migrate.Generate, inside `test`. idear's own |
| 13 | # migrations are checked by schema_test.go, which is where a frozen |
| 14 | # checksum belongs. |
| 15 | ci: vet fmt-check test test-peers race |
| 16 | |
| 17 | vet: |
| 18 | go vet ./... |
| 19 | |
| 20 | fmt-check: |
| 21 | @out=$$(gofmt -l .); if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi |
| 22 | |
| 23 | # -count=1 on purpose: these tests build a real SQLite database and |
| 24 | # race real goroutines against it, and a cached PASS re-reports one |
| 25 | # scheduling of a race as though it were every scheduling. |
| 26 | test: |
| 27 | go test ./... -count=1 |
| 28 | |
| 29 | # test-peers is the same suite built with the idear_peers tag, which |
| 30 | # flips PeerGrants: reach extends to the actor's own rank. The policy |
| 31 | # is a compile-time constant, so a build nobody compiles is a build |
| 32 | # nobody tests — every mode-specific assertion states both answers by |
| 33 | # hand, and this target is what makes the second one count. vet runs |
| 34 | # too, because a file behind a build tag is invisible to plain vet. |
| 35 | test-peers: |
| 36 | go vet -tags idear_peers ./... |
| 37 | go test -tags idear_peers ./... -count=1 |
| 38 | |
| 39 | # race is a separate target because it needs a different toolchain |
| 40 | # setting, not because it is optional. The store's invariants are |
| 41 | # transaction invariants and race_test.go drives them with real |
| 42 | # goroutines; -race is what makes those tests able to report a data |
| 43 | # race in the store itself rather than only a broken outcome. -race |
| 44 | # requires cgo, and everything else in this Makefile runs with |
| 45 | # CGO_ENABLED=0, so this target sets it for its own command and no |
| 46 | # other. |
| 47 | race: |
| 48 | CGO_ENABLED=1 go test ./... -race -count=1 |
| 49 | |