forked from chop-dbhi/sql-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (61 loc) · 1.73 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
IMAGE_NAME := dbhi/sql-agent
PROG_NAME := sql-agent
GIT_SHA := $(or $(shell git log -1 --pretty=format:"%h"), "latest")
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null)
GIT_BRANCH := $(shell git symbolic-ref -q --short HEAD)
build:
go build \
-o $(GOPATH)/bin/sql-agent \
./cmd/sql-agent
clean:
go clean ./...
doc:
godoc -http=:6060
install:
go get github.com/jmoiron/sqlx
dist:
rm -f .dockerignore
ln -s .dockerignore.build .dockerignore
docker build -f Dockerfile.build -t dbhi/sql-agent-builder .
docker run --rm -it \
-v ${PWD}/dist/linux-amd64:/go/src/app/dist/linux-amd64 \
dbhi/sql-agent-builder
test-install: install
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get github.com/lib/pq
go get github.com/denisenkom/go-mssqldb
go get github.com/go-sql-driver/mysql
go get github.com/mattn/go-sqlite3
go get github.com/mattn/go-oci8
go get github.com/alexbrainman/odbc
docker:
rm -f .dockerignore
ln -s .dockerignore.dist .dockerignore
docker build -t ${IMAGE_NAME}:${GIT_SHA} .
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:${GIT_BRANCH}
if [ -n "${GIT_TAG}" ] ; then \
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:${GIT_TAG} ; \
fi;
if [ "${GIT_BRANCH}" == "master" ]; then \
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:latest ; \
fi;
test-travis:
./test-cover.sh
bench:
go test -run=none -bench=. -benchmem ./...
docker-push:
docker push ${IMAGE_NAME}:${GIT_SHA}
docker push ${IMAGE_NAME}:${GIT_BRANCH}
if [ -n "${GIT_TAG}" ]; then \
docker push ${IMAGE_NAME}:${GIT_TAG} ; \
fi;
if [ "${GIT_BRANCH}" == "master" ]; then \
docker push ${IMAGE_NAME}:latest ; \
fi;
fmt:
go vet ./...
go fmt ./...
lint:
golint ./...
.PHONY: build dist