mirror of
https://github.com/nikoksr/notify.git
synced 2024-11-30 08:46:43 +02:00
f692de61ba
Most services are testing by mocking them. To unify the way how and where these mocks are being generated, I added the mock command. The command executes go generate against all subdirectories internally. For this to work every service needs a go:generate comment that defines the mockery command to be executed. For examples, check 'service/amazonses/amazon_ses.go#14'. All newly added tests should make use of this pattern.
55 lines
1.4 KiB
Makefile
55 lines
1.4 KiB
Makefile
export GO111MODULE := on
|
|
export GOPROXY = https://proxy.golang.org,direct
|
|
|
|
###############################################################################
|
|
# DEPENDENCIES
|
|
###############################################################################
|
|
|
|
# Install all the build and lint dependencies
|
|
setup:
|
|
go mod tidy
|
|
@go install mvdan.cc/gofumpt@latest
|
|
@go install github.com/daixiang0/gci@latest
|
|
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
.PHONY: setup
|
|
|
|
###############################################################################
|
|
# TESTS
|
|
###############################################################################
|
|
|
|
# Run all the tests
|
|
test:
|
|
go test -failfast -race -timeout=5m ./...
|
|
.PHONY: test
|
|
|
|
cover:
|
|
go test -race -covermode=atomic -coverprofile=coverage.out ./...
|
|
.PHONY: cover
|
|
|
|
mock:
|
|
@go install github.com/vektra/mockery/v2@latest
|
|
go generate ./...
|
|
.PHONY: mock
|
|
|
|
###############################################################################
|
|
# CODE HEALTH
|
|
###############################################################################
|
|
|
|
fmt:
|
|
@gofumpt -w -l .
|
|
|
|
@gci write --section Standard --section Default --section "Prefix(github.com/nikoksr/notify)" .
|
|
.PHONY: fmt
|
|
|
|
|
|
lint:
|
|
@golangci-lint run --config .golangci.yml
|
|
.PHONY: lint
|
|
|
|
ci: lint test
|
|
.PHONY: ci
|
|
|
|
###############################################################################
|
|
|
|
.DEFAULT_GOAL := ci
|