From 9b6acd45109d05fd127eae0171597380f3df95e4 Mon Sep 17 00:00:00 2001 From: copyonwrite <73547592+copyonwrite@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:03:06 +0100 Subject: [PATCH] Copyonwrite/367/fix make error mockery (#368) * Make 'make' install mockery * Add 'all' target to Makefile and fix 'mockery' error * Install mockery in goal 'install-build-dependencies' --- Makefile | 8 +++++++- README.md | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index edfce156..aa985113 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ ifeq ($(wildcard .env),.env) export $(shell sed 's/=.*//' .env) endif +all: build-binary test-all + build-binary: mockery gqlgen GO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o build/heureka cmd/heureka/main.go @@ -62,9 +64,13 @@ run: gqlgen: cd internal/api/graphql && go run github.com/99designs/gqlgen generate -mockery: +mockery: install-build-dependencies mockery +install-build-dependencies: + go install github.com/vektra/mockery/v2@v2.46.3 + + GINKGO := go run github.com/onsi/ginkgo/v2/ginkgo test-all: mockery gqlgen $(GINKGO) -r diff --git a/README.md b/README.md index ab6b2d7a..febbc260 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,9 @@ Use the following command in the root folder of heureka: Heureka uses [Mockery](https://vektra.github.io/mockery/) for building Mocks based on defined interfaces for the purpose of Unit-Testing. -Please [follow the steps to install mockery on your local system](https://vektra.github.io/mockery/latest/installation/) to be able to build mocks. +The Makefile/Dockerfile take care of installing mockery via + + go install github.com/vektra/mockery/v2@v2.46.3 #### Using Ginkgo