-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
66 lines (51 loc) · 1.43 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
VERSION ?= $(shell git describe --tags)
COMMIT = $(shell git rev-parse HEAD)
SHA = $(shell git rev-parse --short HEAD)
CURR_DIR = $(shell pwd)
CURR_DIR_WIN = $(shell cd)
BIN_DIR = $(CURR_DIR)/build
BIN_DIR_WIN = $(CURR_DIR_WIN)/build
export GO111MODULE = on
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GOLANGCI_LINT_VERSION := v1.60.3
# Set BRANCH when running make manually
ifeq ($(BRANCH),)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
endif
# Setup the -ldflags option to pass vars defined here to app vars
LDFLAGS = -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.branch=${BRANCH}"
PKGS = $(shell go list ./...)
PLATFORMS := windows linux darwin
os = $(word 1, $@)
.PHONY: install
install:
go mod download
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_LINT_VERSION)
.PHONY: all
all:
.PHONY: lint-ci
lint-ci:
golangci-lint run ./...
.PHONY: lint
lint:
./bin/golangci-lint run --config .golangci.yml
.PHONY: lint-fix
lint-fix:
./bin/golangci-lint run --config .golangci.yml --fix
.PHONY: test
test: vet lint
.PHONY: vet
vet:
go vet ./...
.PHONY: dev_up
dev_up: ## start local environment
@echo "RUN dev docker-compose.yml "
docker compose pull
docker compose up --build
.PHONY: ci_up
ci_up: ## start ci environment
@echo "RUN ci docker-compose.yml "
docker compose up --build -d
.PHONY: gogen
gogen: ## generate scalegen
go generate ./...