include make/lint.mk
include make/build.mk
include make/coverage.mk
include make/generate.mk
include make/bin-deps.mk

PKGS = $(shell go list ./... | grep -vE 'mock|config|generated|header|document|internal/pb')
INTEGRATION_TAG = integration

.PHONY: lint, coverage

lint: cart-lint loms-lint notifier-lint comments-lint

build: cart-build loms-build notifier-build comments-build

coverage: cart-coverage loms-coverage notifier-coverage comments-coverage

generate: cart-generate loms-generate notifier-generate comments-generate
	cd pkg && go mod tidy

run-all:
	echo "starting build"
	docker-compose up --build

.PHONY: .integration-test
integration-test:
	# ALLURE_OUTPUT_PATH=$(shell pwd)/allure-results ALLURE_OUTPUT_FOLDER=cart go test -v -tags=$(INTEGRATION_TAG) ./cart/tests/integration
	# CGO_ENABLED=0 ALLURE_OUTPUT_PATH=$(shell pwd)/allure-results ALLURE_OUTPUT_FOLDER=loms go test -v -tags=$(INTEGRATION_TAG) ./loms/tests/integration
	CGO_ENABLED=0 ALLURE_OUTPUT_PATH=$(shell pwd)/allure-results ALLURE_OUTPUT_FOLDER=comments go test -v -tags=$(INTEGRATION_TAG) ./comments/tests/integration

bench:
	go test -bench=BenchmarkInMemoryRepository -benchmem ./cart/internal/domain/cart/repository -benchtime 3s

.PHONY: .serve-swagger
.serve-swagger:
	bin/swagger serve api/openapiv2/loms/v1/loms.swagger.json --no-open
