-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
66 lines (56 loc) · 2.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
SHELL := /bin/bash
.DEFAULT_GOAL := all
all: test format lint run.examples finish
# This target (taken from: https://gist.github.com/prwhite/8168133) is an easy way to print out a usage/ help of all make targets.
# For all make targets the text after \#\# will be printed.
help: ## Prints the help
@echo "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\1\:\2/' | column -c2 -t -s :)"
test: sep gen-mocks ## Runs all unit tests and generates a coverage report.
@echo "--> Run the unit-tests"
@set -o pipefail ; go test $$(go list ./...) -timeout 30s -race -covermode=atomic
test.report: sep ## Runs all unittests and generates a coverage- and a test-report.
@echo "--> Run the unit-tests"
@go test $$(go list ./...) -timeout 30s -race -covermode=atomic -coverprofile=coverage.out -json | tee test-report.out
run.examples: ## Runs the examples
@echo "--> Run the example apps"
@echo "---> Simple Example"
@go run ./examples/simple
@echo ""
@echo "---> Readme Example"
@go run ./examples/readme
@echo ""
@echo "---> Multilevel Example"
@go run ./examples/multilevel
@echo ""
@echo "---> MappingFunc Example"
@go run ./examples/mapfun
@echo ""
@echo "---> Primitive Types Example"
@go run ./examples/primitive
@echo ""
@echo "---> Custom Config Entries Example"
@go run ./examples/custom
@echo ""
@echo "---> Multi Source Example"
@go run ./examples/multisource
@echo ""
@echo "---> External Types Example"
@go run ./examples/external
@echo ""
@echo "---> Required Parameters Example"
@go run ./examples/required
lint: sep ## Runs the linter to check for coding-style issues
@echo "--> Lint project"
@echo "!!!!golangci-lint has to be installed. See: https://github.com/golangci/golangci-lint#install"
@golangci-lint run --enable gofmt
gen-mocks: sep ## Generates test doubles (mocks).
@echo "--> generate mocks (github.com/golang/mock/gomock is required for this)"
@go install github.com/golang/mock/mockgen@latest
@mockgen -source=interfaces/provider.go -destination test/mocks/mock_provider.go
format: ## Formats the code using gofmt
@echo "--> Formatting all sources using go fmt"
@gofmt -w -s .
sep:
@echo "----------------------------------------------------------------------------------"
finish:
@echo "=================================================================================="