diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1bdb57e1..497e0eaf 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -28,6 +28,13 @@ jobs: - name: Get dependencies run: go mod tidy + + # go build does not compile _test.go, so building alone never ran a single + # test. This is the only workflow that fires on every push and pull request, + # which makes it the one place a test gate belongs. + - name: Test + run: make test + - name: Build run: make build diff --git a/Makefile b/Makefile index 73972725..65b32832 100644 --- a/Makefile +++ b/Makefile @@ -37,9 +37,13 @@ stop: #@echo "go-admin stop success" -#.PHONY: test -#test: -# go test -v ./... -cover +# -race is worth the extra minute here: common/actions reuses model instances +# across concurrent requests, so a Generate() that returns in place instead of +# a copy leaks data between them - and that is invisible to a single-threaded +# test run. +.PHONY: test +test: + go test -race -cover ./... #.PHONY: docker #docker: