| 1 | .PHONY: vet fmt-check test 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 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 | # race is a separate target because it needs a different toolchain |
| 30 | # setting, not because it is optional. The store's invariants are |
| 31 | # transaction invariants and race_test.go drives them with real |
| 32 | # goroutines; -race is what makes those tests able to report a data |
| 33 | # race in the store itself rather than only a broken outcome. -race |
| 34 | # requires cgo, and everything else in this Makefile runs with |
| 35 | # CGO_ENABLED=0, so this target sets it for its own command and no |
| 36 | # other. |
| 37 | race: |
| 38 | CGO_ENABLED=1 go test ./... -race -count=1 |
| 39 | |