| 1 | .PHONY: vet fmt-check test race browser 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 |
| 5 | # delegate to make targets, never keep their own copies). |
| 6 | # |
| 7 | # The node tests are not a separate target: js_test.go runs them from |
| 8 | # inside `go test`, skipping when node is absent, so a runner without |
| 9 | # node still reports the Go half honestly instead of failing a step |
| 10 | # it cannot run. |
| 11 | ci: vet fmt-check test race browser |
| 12 | |
| 13 | # The example is its own module with a replace back here, so ./... |
| 14 | # does not reach it; each target visits it explicitly. |
| 15 | vet: |
| 16 | go vet ./... |
| 17 | cd example && go vet ./... |
| 18 | |
| 19 | fmt-check: |
| 20 | @out=$$(gofmt -l .); if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi |
| 21 | |
| 22 | # -count=1 on purpose: these tests build a real SQLite database and |
| 23 | # race goroutines against it; a cached PASS re-reports one scheduling |
| 24 | # as though it were every scheduling. |
| 25 | test: |
| 26 | go test ./... -count=1 |
| 27 | cd example && go test ./... -count=1 |
| 28 | |
| 29 | # -race needs cgo; everything else runs with the default toolchain, so |
| 30 | # this target sets CGO_ENABLED for its own command only. |
| 31 | race: |
| 32 | CGO_ENABLED=1 go test ./... -race -count=1 |
| 33 | |
| 34 | # The browser drive: the module, the worker import and the handlers |
| 35 | # agreeing in a real Chromium, via rastrillo's harness. It fails, not |
| 36 | # skips, without a browser — rastrillo's rule (RASTRILLO_BROWSER_OPTIONAL |
| 37 | # stays unset): a skip is not a pass, and a machine that loses its |
| 38 | # browser should say so loudly. |
| 39 | browser: |
| 40 | go test -tags browser -run TestBrowser -count=1 . |
| 41 | |