forked from sqls-server/sqls
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (42 loc) · 1.26 KB
/
Makefile
File metadata and controls
51 lines (42 loc) · 1.26 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
NAME := sqls
VERSION := $(shell git describe --tags `git rev-list --tags --max-count=1`)
REVISION := $(shell git rev-parse --short HEAD)
GOVERSION := $(go version)
GITHUB_TOKEN := $(GITHUB_TOKEN)
SRCS := $(shell find . -type f -name '*.go')
LDFLAGS := -ldflags="-s -w -X \"main.version=$(VERSION)\" -X \"main.revision=$(REVISION)\""
DIST_DIRS := find * -type d -exec
.PHONY: test
test:
go test ./...
.PHONY: build
build: $(SRCS)
go build $(LDFLAGS) ./...
.PHONY: install
install: $(SRCS)
go install $(LDFLAGS) ./...
.PHONY: lint
lint: $(SRCS)
golangci-lint run
.PHONY: coverage
coverage:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
.PHONY: stringer
stringer:
stringer -type Kind ./token/kind.go
.PHONY: snapshot
snapshot: $(SRCS)
docker run --rm --privileged \
-v ${PWD}:/go/src/github.com/lighttiger2505/sqls \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/lighttiger2505/sqls \
mailchain/goreleaser-xcgo --snapshot --rm-dist
.PHONY: publish
publish: $(SRCS)
docker run --rm --privileged \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-v ${PWD}:/go/src/github.com/lighttiger2505/sqls \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/lighttiger2505/sqls \
mailchain/goreleaser-xcgo --rm-dist