diff options
-rw-r--r-- | .gitlab/ci/test.yml | 5 | ||||
-rw-r--r-- | Makefile.build.mk | 2 | ||||
-rw-r--r-- | Makefile.internal.mk | 4 | ||||
-rw-r--r-- | Makefile.util.mk | 9 |
4 files changed, 19 insertions, 1 deletions
diff --git a/.gitlab/ci/test.yml b/.gitlab/ci/test.yml index d20c144e..e9bca5d6 100644 --- a/.gitlab/ci/test.yml +++ b/.gitlab/ci/test.yml @@ -64,3 +64,8 @@ check deps: - echo skipping script: - make deps-check + +check mocks: + extends: .tests-common + script: + - make mocks-check diff --git a/Makefile.build.mk b/Makefile.build.mk index 6ee9218c..6f6c6bc1 100644 --- a/Makefile.build.mk +++ b/Makefile.build.mk @@ -21,7 +21,7 @@ cisetup: .GOPATH/.ok # Installing dev tools defined in go.tools awk '/_/ {print $$2}' ./tools/main.go | grep -v -e mockgen -e golangci | xargs -tI % go install ${V:+-v -x} -modfile=tools/go.mod -mod=mod % -generate-mocks: .GOPATH/.ok +generate-mocks: .GOPATH/.ok bin/mockgen $Q bin/mockgen -source=internal/interface.go -destination=internal/handlers/mock/handler_mock.go -package=mock $Q bin/mockgen -source=internal/source/source.go -destination=internal/source/mock/source_mock.go -package=mock $Q bin/mockgen -source=internal/source/gitlab/mock/client_stub.go -destination=internal/source/gitlab/mock/client_mock.go -package=mock diff --git a/Makefile.internal.mk b/Makefile.internal.mk index d2340855..a3e7eb7b 100644 --- a/Makefile.internal.mk +++ b/Makefile.internal.mk @@ -32,3 +32,7 @@ bin/golangci-lint: .GOPATH/.ok bin/gotestsum: .GOPATH/.ok @test -x $@ || \ { echo "Vendored gotestsum not found, try running 'make setup'..."; exit 1; } + +bin/mockgen: .GOPATH/.ok + @test -x $@ || \ + { echo "Vendored mockgen not found, try running 'make setup'..."; exit 1; } diff --git a/Makefile.util.mk b/Makefile.util.mk index 692848c7..91da83aa 100644 --- a/Makefile.util.mk +++ b/Makefile.util.mk @@ -49,6 +49,15 @@ deps-check: .GOPATH/.ok exit 1; \ fi; +mocks-check: .GOPATH/.ok generate-mocks + @if git diff --color=always --exit-code; then \ + echo "mocks are ok"; \ + else \ + echo ""; \ + echo "mocks needs to be regenerated, please run 'make generate-mocks' and commit them";\ + exit 1; \ + fi; + deps-download: .GOPATH/.ok go mod download |