-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (55 loc) · 2.01 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
67
# Makefile
#
.PHONY: lint build clean outdated ensure-fieldalignment check-fieldalignment autofix-fieldalignment build-docker deploy-test-kafka-helm undeploy-test-kafka-helm
# Check Make version (we need at least GNU Make 3.82). Fortunately,
# 'undefine' directive has been introduced exactly in GNU Make 3.82.
ifeq ($(filter undefine,$(.FEATURES)),)
$(error Unsupported Make version. \
The build system does not work properly with GNU Make $(MAKE_VERSION), \
please use GNU Make 3.82 or above.)
endif
# Set platform-specific build variables
ifeq ($(OS),Windows_NT)
SHELL=C:\Windows\system32\cmd.exe
.SHELLFLAGS=/C
endif
build:
ifeq ($(OS),Windows_NT)
SET CGO_ENABLED=0 & go build -ldflags "-s -w" -o bin\gowait.exe .\cmd\gowait
upx -q bin\gowait.exe
else
CGO_ENABLED=0 go build -ldflags "-s -w" -o bin/gowait ./cmd/gowait
upx -q bin/gowait
endif
lint: check-fieldalignment
@golangci-lint --version
golangci-lint run --timeout=10m --verbose
clean:
ifeq ($(OS),Windows_NT)
IF EXIST bin RD /S /Q bin
else
if [ -d bin ]; then rm -Rf bin; fi
endif
outdated:
ifeq ($(OS),Windows_NT)
PUSHD %HOMEDRIVE%%HOMEPATH% && go install github.com/psampaz/[email protected]
else
hash go-mod-outdated 2>/dev/null || { cd && go install github.com/psampaz/[email protected]; }
endif
go list -json -u -m all | go-mod-outdated -direct -update
ensure-fieldalignment:
ifeq ($(OS),Windows_NT)
PUSHD %HOMEDRIVE%%HOMEPATH% && go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
else
hash fieldalignment 2>/dev/null || { cd && go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest; }
endif
check-fieldalignment: ensure-fieldalignment
fieldalignment ./...
autofix-fieldalignment: ensure-fieldalignment
fieldalignment -fix ./...
build-docker: lint
docker buildx build -t neflyte/gowait:latest .
deploy-test-kafka-helm: build-docker
helm upgrade kafka testdata/helm/v2/kafka/gowait-kafka --install --namespace default
undeploy-test-kafka-helm:
helm delete --purge kafka