-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (47 loc) · 1.43 KB
/
Makefile
File metadata and controls
63 lines (47 loc) · 1.43 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
58
59
60
61
62
63
.PHONY: all deps clean docker test fmt lint install
TAGS =
INSTALL_DIR = $(GOPATH)/bin
DEST_DIR = ./target
PATHINSTBIN = $(DEST_DIR)/bin
PATHINSTDOCKER = $(DEST_DIR)/docker
VERSION := $(shell git describe --tags || echo "v0.0.0")
VER_CUT := $(shell echo $(VERSION) | cut -c2-)
VER_MAJOR := $(shell echo $(VER_CUT) | cut -f1 -d.)
VER_MINOR := $(shell echo $(VER_CUT) | cut -f2 -d.)
VER_PATCH := $(shell echo $(VER_CUT) | cut -f3 -d.)
VER_RC := $(shell echo $(VER_PATCH) | cut -f2 -d-)
DATE := $(shell date +"%Y-%m-%dT%H:%M:%SZ")
LD_FLAGS = -w -s
GO_FLAGS =
DOCS_FLAGS =
APPS = oracle-example
all: $(APPS)
oracle-example:
@go build -o $(PATHINSTBIN)/oracle-example ./cmd/oracle-example
install: $(APPS)
@mkdir -p bin
@cp $(PATHINSTBIN)/oracle-example ./bin/
deps:
@go mod tidy
@go mod vendor
docker: deps
@docker build -f ./resources/docker/Dockerfile . -t dimozone/oracle-example:$(VER_CUT)
@docker tag dimozone/oracle-example:$(VER_CUT) dimozone/oracle-example:latest
fmt:
@go list -f {{.Dir}} ./... | xargs -I{} gofmt -w -s {}
@go mod tidy
lint:
@golangci-lint run ./...
test: $(APPS)
@go test $(GO_FLAGS) -timeout 3m -race ./...
migrate:
@go run ./cmd/oracle-example migrate
sqlboiler:
@sqlboiler psql --no-tests --wipe
addmigration:
@goose -dir internal/db/migrations create rename_me sql
clean:
rm -rf $(PATHINSTBIN)
rm -rf $(DEST_DIR)/dist
rm -rf $(PATHINSTDOCKER)
rm -rf ./vendor