-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (45 loc) · 1.22 KB
/
Makefile
File metadata and controls
57 lines (45 loc) · 1.22 KB
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
SHELL = /bin/bash
VERSION ?= "latest"
build_dir := ./.build
.PHONY: clean
clean:
rm -rf ${build_dir}
.PHONY: clean-cache
clean-cache:
go clean -cache -modcache -i -r
.PHONY: build
build: clean generate discover
@echo "Go version: $(GO_VERSION)"
@go mod download
@go build $(GO_BUILD_FLAGS) -o ${build_dir}/server/server ./cmd/server/
.PHONY: mod
mod:
go mod download && go mod tidy && go mod verify
.PHONY: vet
vet:
go vet ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: lint
lint: mod vet fmt
echo "Running golangci-lint..."
@golangci-lint run -c .golangci.yml --timeout=5m
.PHONY: test
test:
go test -race -count=1 ./...
.PHONY: service-from-static
service-from-static:
@echo "Generating new static service..."
@go run github.com/mockzilla/mockzilla/v2/cmd/gen/service -type static -name=$(name) -output=pkg/$(name)
.PHONY: service
service:
@echo "Generating new OpenAPI service..."
@go run github.com/mockzilla/mockzilla/v2/cmd/gen/service -type openapi -name=$(name) -output=pkg/$(name)
.PHONY: discover
discover:
@echo "Discovering services to generate service imports..."
@go run github.com/mockzilla/mockzilla/v2/cmd/gen/discover -output cmd/server/services_gen.go pkg
#.PHONY: generate
generate:
@go generate ./...