-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
57 lines (47 loc) · 1.88 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
PROJECT_PATH=${PWD}
DOCKER_HAPROXY_VERSION?=3.0
SWAGGER_VERSION=v0.31.0
GO_VERSION:=${shell go mod edit -json | jq -r .Go}
GOLANGCI_LINT_VERSION=1.61.0
.PHONY: test
test:
go test ./...
.PHONY: e2e
e2e:
go install github.com/oktalz/gotest@latest
gotest -t integration
.PHONY: e2e-docker
e2e-docker:
docker build -f e2e/Dockerfile --build-arg GO_VERSION=${GO_VERSION} --build-arg HAPROXY_VERSION=${DOCKER_HAPROXY_VERSION} -t client-native-test:${DOCKER_HAPROXY_VERSION} .
docker run --rm -t client-native-test:${DOCKER_HAPROXY_VERSION}
# config-parser auto-generated types
.PHONY: gentypes
gentypes:
cd config-parser && go run generate/*.go ${PROJECT_PATH}/config-parser
.PHONY: spec
spec:
go run cmd/specification/*.go -file specification/haproxy-spec.yaml > specification/build/haproxy_spec.yaml
.PHONY: models
models: gentypes spec swagger-check
./bin/swagger generate model --additional-initialism=FCGI -f ${PROJECT_PATH}/specification/build/haproxy_spec.yaml -r ${PROJECT_PATH}/specification/copyright.txt -m models -t ${PROJECT_PATH}
rm -rf models/server_params_prepare_for_runtime.go
rm -rf models/*_compare.go
rm -rf models/*_compare_test.go
go run cmd/struct_equal_generator/*.go -l ${PROJECT_PATH}/specification/copyright.txt ${PROJECT_PATH}/models
go run cmd/struct_tags_checker/*.go ${PROJECT_PATH}/models
go run cmd/kubebuilder_marker_generator/*.go ${PROJECT_PATH}/models
go run cmd/server_params_runtime/*.go ${PROJECT_PATH}/models
.PHONY: swagger-check
swagger-check:
cd bin; SWAGGER_VERSION=${SWAGGER_VERSION} sh swagger-check.sh
.PHONY: lint
lint:
cd bin;GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION} sh lint-check.sh
bin/golangci-lint run --timeout 5m --color always --max-issues-per-linter 0 --max-same-issues 0
.PHONY: lint-yaml
lint-yaml:
docker run --rm -v ${PROJECT_PATH}:/data cytopia/yamllint .
.PHONY: gofumpt
gofumpt:
go install mvdan.cc/gofumpt@latest
gofumpt -l -w .